app.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742
  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. console.log(this.credentials.splice(index, 1));
  1995. }
  1996. }
  1997. });
  1998. /***/ }),
  1999. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  2000. /*!*********************************************************************************************************************************************************************!*\
  2001. !*** ./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& ***!
  2002. \*********************************************************************************************************************************************************************/
  2003. /*! exports provided: default */
  2004. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2005. "use strict";
  2006. __webpack_require__.r(__webpack_exports__);
  2007. //
  2008. //
  2009. //
  2010. //
  2011. //
  2012. //
  2013. //
  2014. //
  2015. //
  2016. //
  2017. //
  2018. //
  2019. //
  2020. //
  2021. //
  2022. //
  2023. //
  2024. //
  2025. //
  2026. //
  2027. //
  2028. //
  2029. //
  2030. //
  2031. //
  2032. //
  2033. //
  2034. //
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. //
  2046. //
  2047. //
  2048. //
  2049. //
  2050. /* harmony default export */ __webpack_exports__["default"] = ({
  2051. props: ['credential', 'descriptions'],
  2052. data: function data() {
  2053. return {
  2054. data: this.credential,
  2055. creddescList: this.descriptions
  2056. };
  2057. },
  2058. mounted: function mounted() {
  2059. var _this = this;
  2060. console.log('credential.' + this.data.credid);
  2061. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  2062. _this.data = e.credential;
  2063. });
  2064. },
  2065. methods: {
  2066. deleteCredential: function deleteCredential() {
  2067. var _this2 = this;
  2068. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2069. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  2070. _this2.$emit('delete-cred');
  2071. })["catch"](function (error) {
  2072. console.error(error);
  2073. });
  2074. }
  2075. }
  2076. });
  2077. /***/ }),
  2078. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2079. /*!********************************************************************************************************************************************************************!*\
  2080. !*** ./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& ***!
  2081. \********************************************************************************************************************************************************************/
  2082. /*! exports provided: default */
  2083. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2084. "use strict";
  2085. __webpack_require__.r(__webpack_exports__);
  2086. //
  2087. //
  2088. //
  2089. //
  2090. //
  2091. /* harmony default export */ __webpack_exports__["default"] = ({
  2092. props: ['errors'],
  2093. data: function data() {
  2094. return {
  2095. errorList: this.errors
  2096. };
  2097. },
  2098. watch: {
  2099. errors: function errors(newErrors) {
  2100. this.errorList = newErrors;
  2101. }
  2102. }
  2103. });
  2104. /***/ }),
  2105. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2106. /*!****************************************************************************************************************************************************************!*\
  2107. !*** ./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& ***!
  2108. \****************************************************************************************************************************************************************/
  2109. /*! exports provided: default */
  2110. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2111. "use strict";
  2112. __webpack_require__.r(__webpack_exports__);
  2113. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2114. //
  2115. //
  2116. //
  2117. //
  2118. //
  2119. //
  2120. //
  2121. //
  2122. //
  2123. //
  2124. //
  2125. //
  2126. //
  2127. //
  2128. //
  2129. //
  2130. //
  2131. //
  2132. //
  2133. //
  2134. //
  2135. //
  2136. //
  2137. //
  2138. //
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. /* harmony default export */ __webpack_exports__["default"] = ({
  2154. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2155. props: ['initialnotes', 'authusername'],
  2156. data: function data() {
  2157. return {
  2158. notes: this.initialnotes
  2159. };
  2160. }
  2161. });
  2162. /***/ }),
  2163. /***/ "./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&":
  2164. /*!****************************************************************************************************************************************************************************!*\
  2165. !*** ./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& ***!
  2166. \****************************************************************************************************************************************************************************/
  2167. /*! exports provided: default */
  2168. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2169. "use strict";
  2170. __webpack_require__.r(__webpack_exports__);
  2171. //
  2172. //
  2173. //
  2174. //
  2175. //
  2176. //
  2177. //
  2178. //
  2179. //
  2180. //
  2181. //
  2182. //
  2183. //
  2184. //
  2185. //
  2186. //
  2187. //
  2188. //
  2189. //
  2190. //
  2191. //
  2192. //
  2193. //
  2194. //
  2195. //
  2196. //
  2197. //
  2198. //
  2199. //
  2200. //
  2201. //
  2202. //
  2203. //
  2204. /* harmony default export */ __webpack_exports__["default"] = ({
  2205. props: ['populateWith', 'storeList', 'modalId'],
  2206. data: function data() {
  2207. return {
  2208. // Copies object from prop, so it doesn't mutate the object
  2209. // from the parent component. Parent component will be updated via
  2210. // Websocket if updateWorkOrder is successful.
  2211. data: JSON.parse(JSON.stringify(this.populateWith)),
  2212. id: this.modalId,
  2213. store: {},
  2214. errors: []
  2215. };
  2216. },
  2217. mounted: function mounted() {
  2218. this.store = {
  2219. 'id': this.data.storeid,
  2220. 'name': this.storeList[this.data.storeid]
  2221. };
  2222. },
  2223. methods: {
  2224. updateWorkOrder: function updateWorkOrder() {
  2225. var _this = this;
  2226. this.data.storeid = this.store.id;
  2227. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2228. $('#workordereditModal').modal('hide');
  2229. })["catch"](function (error) {
  2230. _this.errors = JSON.parse(error.response.request.response).errors;
  2231. });
  2232. }
  2233. }
  2234. });
  2235. /***/ }),
  2236. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2237. /*!*****************************************************************************************************************************************************************!*\
  2238. !*** ./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& ***!
  2239. \*****************************************************************************************************************************************************************/
  2240. /*! exports provided: default */
  2241. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2242. "use strict";
  2243. __webpack_require__.r(__webpack_exports__);
  2244. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2245. //
  2246. //
  2247. //
  2248. //
  2249. //
  2250. //
  2251. //
  2252. //
  2253. //
  2254. //
  2255. //
  2256. //
  2257. //
  2258. //
  2259. //
  2260. //
  2261. //
  2262. //
  2263. //
  2264. //
  2265. /* harmony default export */ __webpack_exports__["default"] = ({
  2266. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2267. props: ['workOrder', 'stores'],
  2268. data: function data() {
  2269. return {
  2270. data: JSON.parse(this.workOrder)
  2271. };
  2272. },
  2273. computed: {
  2274. storeList: function storeList() {
  2275. var list = {};
  2276. JSON.parse(this.stores).map(function (val) {
  2277. list[val.storeid] = val.storesname;
  2278. });
  2279. return list;
  2280. }
  2281. },
  2282. mounted: function mounted() {
  2283. var _this = this;
  2284. Echo.channel('work-order.' + this.data.woid).listen('WorkOrderUpdated', function (e) {
  2285. _this.data = e.data;
  2286. });
  2287. }
  2288. });
  2289. /***/ }),
  2290. /***/ "./node_modules/base64-js/index.js":
  2291. /*!*****************************************!*\
  2292. !*** ./node_modules/base64-js/index.js ***!
  2293. \*****************************************/
  2294. /*! no static exports found */
  2295. /***/ (function(module, exports, __webpack_require__) {
  2296. "use strict";
  2297. exports.byteLength = byteLength
  2298. exports.toByteArray = toByteArray
  2299. exports.fromByteArray = fromByteArray
  2300. var lookup = []
  2301. var revLookup = []
  2302. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2303. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2304. for (var i = 0, len = code.length; i < len; ++i) {
  2305. lookup[i] = code[i]
  2306. revLookup[code.charCodeAt(i)] = i
  2307. }
  2308. // Support decoding URL-safe base64 strings, as Node.js does.
  2309. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2310. revLookup['-'.charCodeAt(0)] = 62
  2311. revLookup['_'.charCodeAt(0)] = 63
  2312. function getLens (b64) {
  2313. var len = b64.length
  2314. if (len % 4 > 0) {
  2315. throw new Error('Invalid string. Length must be a multiple of 4')
  2316. }
  2317. // Trim off extra bytes after placeholder bytes are found
  2318. // See: https://github.com/beatgammit/base64-js/issues/42
  2319. var validLen = b64.indexOf('=')
  2320. if (validLen === -1) validLen = len
  2321. var placeHoldersLen = validLen === len
  2322. ? 0
  2323. : 4 - (validLen % 4)
  2324. return [validLen, placeHoldersLen]
  2325. }
  2326. // base64 is 4/3 + up to two characters of the original data
  2327. function byteLength (b64) {
  2328. var lens = getLens(b64)
  2329. var validLen = lens[0]
  2330. var placeHoldersLen = lens[1]
  2331. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2332. }
  2333. function _byteLength (b64, validLen, placeHoldersLen) {
  2334. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2335. }
  2336. function toByteArray (b64) {
  2337. var tmp
  2338. var lens = getLens(b64)
  2339. var validLen = lens[0]
  2340. var placeHoldersLen = lens[1]
  2341. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2342. var curByte = 0
  2343. // if there are placeholders, only get up to the last complete 4 chars
  2344. var len = placeHoldersLen > 0
  2345. ? validLen - 4
  2346. : validLen
  2347. var i
  2348. for (i = 0; i < len; i += 4) {
  2349. tmp =
  2350. (revLookup[b64.charCodeAt(i)] << 18) |
  2351. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2352. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2353. revLookup[b64.charCodeAt(i + 3)]
  2354. arr[curByte++] = (tmp >> 16) & 0xFF
  2355. arr[curByte++] = (tmp >> 8) & 0xFF
  2356. arr[curByte++] = tmp & 0xFF
  2357. }
  2358. if (placeHoldersLen === 2) {
  2359. tmp =
  2360. (revLookup[b64.charCodeAt(i)] << 2) |
  2361. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2362. arr[curByte++] = tmp & 0xFF
  2363. }
  2364. if (placeHoldersLen === 1) {
  2365. tmp =
  2366. (revLookup[b64.charCodeAt(i)] << 10) |
  2367. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2368. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2369. arr[curByte++] = (tmp >> 8) & 0xFF
  2370. arr[curByte++] = tmp & 0xFF
  2371. }
  2372. return arr
  2373. }
  2374. function tripletToBase64 (num) {
  2375. return lookup[num >> 18 & 0x3F] +
  2376. lookup[num >> 12 & 0x3F] +
  2377. lookup[num >> 6 & 0x3F] +
  2378. lookup[num & 0x3F]
  2379. }
  2380. function encodeChunk (uint8, start, end) {
  2381. var tmp
  2382. var output = []
  2383. for (var i = start; i < end; i += 3) {
  2384. tmp =
  2385. ((uint8[i] << 16) & 0xFF0000) +
  2386. ((uint8[i + 1] << 8) & 0xFF00) +
  2387. (uint8[i + 2] & 0xFF)
  2388. output.push(tripletToBase64(tmp))
  2389. }
  2390. return output.join('')
  2391. }
  2392. function fromByteArray (uint8) {
  2393. var tmp
  2394. var len = uint8.length
  2395. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2396. var parts = []
  2397. var maxChunkLength = 16383 // must be multiple of 3
  2398. // go through the array every three bytes, we'll deal with trailing stuff later
  2399. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2400. parts.push(encodeChunk(
  2401. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2402. ))
  2403. }
  2404. // pad the end with zeros, but make sure to not forget the extra bytes
  2405. if (extraBytes === 1) {
  2406. tmp = uint8[len - 1]
  2407. parts.push(
  2408. lookup[tmp >> 2] +
  2409. lookup[(tmp << 4) & 0x3F] +
  2410. '=='
  2411. )
  2412. } else if (extraBytes === 2) {
  2413. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2414. parts.push(
  2415. lookup[tmp >> 10] +
  2416. lookup[(tmp >> 4) & 0x3F] +
  2417. lookup[(tmp << 2) & 0x3F] +
  2418. '='
  2419. )
  2420. }
  2421. return parts.join('')
  2422. }
  2423. /***/ }),
  2424. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2425. /*!*****************************************************!*\
  2426. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2427. \*****************************************************/
  2428. /*! no static exports found */
  2429. /***/ (function(module, exports, __webpack_require__) {
  2430. /*!
  2431. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2432. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2433. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2434. */
  2435. (function (global, factory) {
  2436. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2437. undefined;
  2438. }(this, (function (exports, $, Popper) { 'use strict';
  2439. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2440. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2441. function _defineProperties(target, props) {
  2442. for (var i = 0; i < props.length; i++) {
  2443. var descriptor = props[i];
  2444. descriptor.enumerable = descriptor.enumerable || false;
  2445. descriptor.configurable = true;
  2446. if ("value" in descriptor) descriptor.writable = true;
  2447. Object.defineProperty(target, descriptor.key, descriptor);
  2448. }
  2449. }
  2450. function _createClass(Constructor, protoProps, staticProps) {
  2451. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2452. if (staticProps) _defineProperties(Constructor, staticProps);
  2453. return Constructor;
  2454. }
  2455. function _defineProperty(obj, key, value) {
  2456. if (key in obj) {
  2457. Object.defineProperty(obj, key, {
  2458. value: value,
  2459. enumerable: true,
  2460. configurable: true,
  2461. writable: true
  2462. });
  2463. } else {
  2464. obj[key] = value;
  2465. }
  2466. return obj;
  2467. }
  2468. function ownKeys(object, enumerableOnly) {
  2469. var keys = Object.keys(object);
  2470. if (Object.getOwnPropertySymbols) {
  2471. var symbols = Object.getOwnPropertySymbols(object);
  2472. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2473. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2474. });
  2475. keys.push.apply(keys, symbols);
  2476. }
  2477. return keys;
  2478. }
  2479. function _objectSpread2(target) {
  2480. for (var i = 1; i < arguments.length; i++) {
  2481. var source = arguments[i] != null ? arguments[i] : {};
  2482. if (i % 2) {
  2483. ownKeys(Object(source), true).forEach(function (key) {
  2484. _defineProperty(target, key, source[key]);
  2485. });
  2486. } else if (Object.getOwnPropertyDescriptors) {
  2487. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2488. } else {
  2489. ownKeys(Object(source)).forEach(function (key) {
  2490. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2491. });
  2492. }
  2493. }
  2494. return target;
  2495. }
  2496. function _inheritsLoose(subClass, superClass) {
  2497. subClass.prototype = Object.create(superClass.prototype);
  2498. subClass.prototype.constructor = subClass;
  2499. subClass.__proto__ = superClass;
  2500. }
  2501. /**
  2502. * --------------------------------------------------------------------------
  2503. * Bootstrap (v4.4.1): util.js
  2504. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2505. * --------------------------------------------------------------------------
  2506. */
  2507. /**
  2508. * ------------------------------------------------------------------------
  2509. * Private TransitionEnd Helpers
  2510. * ------------------------------------------------------------------------
  2511. */
  2512. var TRANSITION_END = 'transitionend';
  2513. var MAX_UID = 1000000;
  2514. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2515. function toType(obj) {
  2516. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2517. }
  2518. function getSpecialTransitionEndEvent() {
  2519. return {
  2520. bindType: TRANSITION_END,
  2521. delegateType: TRANSITION_END,
  2522. handle: function handle(event) {
  2523. if ($(event.target).is(this)) {
  2524. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2525. }
  2526. return undefined; // eslint-disable-line no-undefined
  2527. }
  2528. };
  2529. }
  2530. function transitionEndEmulator(duration) {
  2531. var _this = this;
  2532. var called = false;
  2533. $(this).one(Util.TRANSITION_END, function () {
  2534. called = true;
  2535. });
  2536. setTimeout(function () {
  2537. if (!called) {
  2538. Util.triggerTransitionEnd(_this);
  2539. }
  2540. }, duration);
  2541. return this;
  2542. }
  2543. function setTransitionEndSupport() {
  2544. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2545. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2546. }
  2547. /**
  2548. * --------------------------------------------------------------------------
  2549. * Public Util Api
  2550. * --------------------------------------------------------------------------
  2551. */
  2552. var Util = {
  2553. TRANSITION_END: 'bsTransitionEnd',
  2554. getUID: function getUID(prefix) {
  2555. do {
  2556. // eslint-disable-next-line no-bitwise
  2557. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2558. } while (document.getElementById(prefix));
  2559. return prefix;
  2560. },
  2561. getSelectorFromElement: function getSelectorFromElement(element) {
  2562. var selector = element.getAttribute('data-target');
  2563. if (!selector || selector === '#') {
  2564. var hrefAttr = element.getAttribute('href');
  2565. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2566. }
  2567. try {
  2568. return document.querySelector(selector) ? selector : null;
  2569. } catch (err) {
  2570. return null;
  2571. }
  2572. },
  2573. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2574. if (!element) {
  2575. return 0;
  2576. } // Get transition-duration of the element
  2577. var transitionDuration = $(element).css('transition-duration');
  2578. var transitionDelay = $(element).css('transition-delay');
  2579. var floatTransitionDuration = parseFloat(transitionDuration);
  2580. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2581. if (!floatTransitionDuration && !floatTransitionDelay) {
  2582. return 0;
  2583. } // If multiple durations are defined, take the first
  2584. transitionDuration = transitionDuration.split(',')[0];
  2585. transitionDelay = transitionDelay.split(',')[0];
  2586. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2587. },
  2588. reflow: function reflow(element) {
  2589. return element.offsetHeight;
  2590. },
  2591. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2592. $(element).trigger(TRANSITION_END);
  2593. },
  2594. // TODO: Remove in v5
  2595. supportsTransitionEnd: function supportsTransitionEnd() {
  2596. return Boolean(TRANSITION_END);
  2597. },
  2598. isElement: function isElement(obj) {
  2599. return (obj[0] || obj).nodeType;
  2600. },
  2601. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2602. for (var property in configTypes) {
  2603. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2604. var expectedTypes = configTypes[property];
  2605. var value = config[property];
  2606. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2607. if (!new RegExp(expectedTypes).test(valueType)) {
  2608. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2609. }
  2610. }
  2611. }
  2612. },
  2613. findShadowRoot: function findShadowRoot(element) {
  2614. if (!document.documentElement.attachShadow) {
  2615. return null;
  2616. } // Can find the shadow root otherwise it'll return the document
  2617. if (typeof element.getRootNode === 'function') {
  2618. var root = element.getRootNode();
  2619. return root instanceof ShadowRoot ? root : null;
  2620. }
  2621. if (element instanceof ShadowRoot) {
  2622. return element;
  2623. } // when we don't find a shadow root
  2624. if (!element.parentNode) {
  2625. return null;
  2626. }
  2627. return Util.findShadowRoot(element.parentNode);
  2628. },
  2629. jQueryDetection: function jQueryDetection() {
  2630. if (typeof $ === 'undefined') {
  2631. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2632. }
  2633. var version = $.fn.jquery.split(' ')[0].split('.');
  2634. var minMajor = 1;
  2635. var ltMajor = 2;
  2636. var minMinor = 9;
  2637. var minPatch = 1;
  2638. var maxMajor = 4;
  2639. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2640. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2641. }
  2642. }
  2643. };
  2644. Util.jQueryDetection();
  2645. setTransitionEndSupport();
  2646. /**
  2647. * ------------------------------------------------------------------------
  2648. * Constants
  2649. * ------------------------------------------------------------------------
  2650. */
  2651. var NAME = 'alert';
  2652. var VERSION = '4.4.1';
  2653. var DATA_KEY = 'bs.alert';
  2654. var EVENT_KEY = "." + DATA_KEY;
  2655. var DATA_API_KEY = '.data-api';
  2656. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2657. var Selector = {
  2658. DISMISS: '[data-dismiss="alert"]'
  2659. };
  2660. var Event = {
  2661. CLOSE: "close" + EVENT_KEY,
  2662. CLOSED: "closed" + EVENT_KEY,
  2663. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2664. };
  2665. var ClassName = {
  2666. ALERT: 'alert',
  2667. FADE: 'fade',
  2668. SHOW: 'show'
  2669. };
  2670. /**
  2671. * ------------------------------------------------------------------------
  2672. * Class Definition
  2673. * ------------------------------------------------------------------------
  2674. */
  2675. var Alert =
  2676. /*#__PURE__*/
  2677. function () {
  2678. function Alert(element) {
  2679. this._element = element;
  2680. } // Getters
  2681. var _proto = Alert.prototype;
  2682. // Public
  2683. _proto.close = function close(element) {
  2684. var rootElement = this._element;
  2685. if (element) {
  2686. rootElement = this._getRootElement(element);
  2687. }
  2688. var customEvent = this._triggerCloseEvent(rootElement);
  2689. if (customEvent.isDefaultPrevented()) {
  2690. return;
  2691. }
  2692. this._removeElement(rootElement);
  2693. };
  2694. _proto.dispose = function dispose() {
  2695. $.removeData(this._element, DATA_KEY);
  2696. this._element = null;
  2697. } // Private
  2698. ;
  2699. _proto._getRootElement = function _getRootElement(element) {
  2700. var selector = Util.getSelectorFromElement(element);
  2701. var parent = false;
  2702. if (selector) {
  2703. parent = document.querySelector(selector);
  2704. }
  2705. if (!parent) {
  2706. parent = $(element).closest("." + ClassName.ALERT)[0];
  2707. }
  2708. return parent;
  2709. };
  2710. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2711. var closeEvent = $.Event(Event.CLOSE);
  2712. $(element).trigger(closeEvent);
  2713. return closeEvent;
  2714. };
  2715. _proto._removeElement = function _removeElement(element) {
  2716. var _this = this;
  2717. $(element).removeClass(ClassName.SHOW);
  2718. if (!$(element).hasClass(ClassName.FADE)) {
  2719. this._destroyElement(element);
  2720. return;
  2721. }
  2722. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2723. $(element).one(Util.TRANSITION_END, function (event) {
  2724. return _this._destroyElement(element, event);
  2725. }).emulateTransitionEnd(transitionDuration);
  2726. };
  2727. _proto._destroyElement = function _destroyElement(element) {
  2728. $(element).detach().trigger(Event.CLOSED).remove();
  2729. } // Static
  2730. ;
  2731. Alert._jQueryInterface = function _jQueryInterface(config) {
  2732. return this.each(function () {
  2733. var $element = $(this);
  2734. var data = $element.data(DATA_KEY);
  2735. if (!data) {
  2736. data = new Alert(this);
  2737. $element.data(DATA_KEY, data);
  2738. }
  2739. if (config === 'close') {
  2740. data[config](this);
  2741. }
  2742. });
  2743. };
  2744. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2745. return function (event) {
  2746. if (event) {
  2747. event.preventDefault();
  2748. }
  2749. alertInstance.close(this);
  2750. };
  2751. };
  2752. _createClass(Alert, null, [{
  2753. key: "VERSION",
  2754. get: function get() {
  2755. return VERSION;
  2756. }
  2757. }]);
  2758. return Alert;
  2759. }();
  2760. /**
  2761. * ------------------------------------------------------------------------
  2762. * Data Api implementation
  2763. * ------------------------------------------------------------------------
  2764. */
  2765. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2766. /**
  2767. * ------------------------------------------------------------------------
  2768. * jQuery
  2769. * ------------------------------------------------------------------------
  2770. */
  2771. $.fn[NAME] = Alert._jQueryInterface;
  2772. $.fn[NAME].Constructor = Alert;
  2773. $.fn[NAME].noConflict = function () {
  2774. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2775. return Alert._jQueryInterface;
  2776. };
  2777. /**
  2778. * ------------------------------------------------------------------------
  2779. * Constants
  2780. * ------------------------------------------------------------------------
  2781. */
  2782. var NAME$1 = 'button';
  2783. var VERSION$1 = '4.4.1';
  2784. var DATA_KEY$1 = 'bs.button';
  2785. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2786. var DATA_API_KEY$1 = '.data-api';
  2787. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2788. var ClassName$1 = {
  2789. ACTIVE: 'active',
  2790. BUTTON: 'btn',
  2791. FOCUS: 'focus'
  2792. };
  2793. var Selector$1 = {
  2794. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2795. DATA_TOGGLES: '[data-toggle="buttons"]',
  2796. DATA_TOGGLE: '[data-toggle="button"]',
  2797. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2798. INPUT: 'input:not([type="hidden"])',
  2799. ACTIVE: '.active',
  2800. BUTTON: '.btn'
  2801. };
  2802. var Event$1 = {
  2803. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2804. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2805. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2806. };
  2807. /**
  2808. * ------------------------------------------------------------------------
  2809. * Class Definition
  2810. * ------------------------------------------------------------------------
  2811. */
  2812. var Button =
  2813. /*#__PURE__*/
  2814. function () {
  2815. function Button(element) {
  2816. this._element = element;
  2817. } // Getters
  2818. var _proto = Button.prototype;
  2819. // Public
  2820. _proto.toggle = function toggle() {
  2821. var triggerChangeEvent = true;
  2822. var addAriaPressed = true;
  2823. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2824. if (rootElement) {
  2825. var input = this._element.querySelector(Selector$1.INPUT);
  2826. if (input) {
  2827. if (input.type === 'radio') {
  2828. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2829. triggerChangeEvent = false;
  2830. } else {
  2831. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2832. if (activeElement) {
  2833. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2834. }
  2835. }
  2836. } else if (input.type === 'checkbox') {
  2837. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2838. triggerChangeEvent = false;
  2839. }
  2840. } else {
  2841. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2842. triggerChangeEvent = false;
  2843. }
  2844. if (triggerChangeEvent) {
  2845. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2846. $(input).trigger('change');
  2847. }
  2848. input.focus();
  2849. addAriaPressed = false;
  2850. }
  2851. }
  2852. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2853. if (addAriaPressed) {
  2854. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2855. }
  2856. if (triggerChangeEvent) {
  2857. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2858. }
  2859. }
  2860. };
  2861. _proto.dispose = function dispose() {
  2862. $.removeData(this._element, DATA_KEY$1);
  2863. this._element = null;
  2864. } // Static
  2865. ;
  2866. Button._jQueryInterface = function _jQueryInterface(config) {
  2867. return this.each(function () {
  2868. var data = $(this).data(DATA_KEY$1);
  2869. if (!data) {
  2870. data = new Button(this);
  2871. $(this).data(DATA_KEY$1, data);
  2872. }
  2873. if (config === 'toggle') {
  2874. data[config]();
  2875. }
  2876. });
  2877. };
  2878. _createClass(Button, null, [{
  2879. key: "VERSION",
  2880. get: function get() {
  2881. return VERSION$1;
  2882. }
  2883. }]);
  2884. return Button;
  2885. }();
  2886. /**
  2887. * ------------------------------------------------------------------------
  2888. * Data Api implementation
  2889. * ------------------------------------------------------------------------
  2890. */
  2891. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2892. var button = event.target;
  2893. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2894. button = $(button).closest(Selector$1.BUTTON)[0];
  2895. }
  2896. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2897. event.preventDefault(); // work around Firefox bug #1540995
  2898. } else {
  2899. var inputBtn = button.querySelector(Selector$1.INPUT);
  2900. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2901. event.preventDefault(); // work around Firefox bug #1540995
  2902. return;
  2903. }
  2904. Button._jQueryInterface.call($(button), 'toggle');
  2905. }
  2906. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2907. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2908. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2909. });
  2910. $(window).on(Event$1.LOAD_DATA_API, function () {
  2911. // ensure correct active class is set to match the controls' actual values/states
  2912. // find all checkboxes/readio buttons inside data-toggle groups
  2913. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2914. for (var i = 0, len = buttons.length; i < len; i++) {
  2915. var button = buttons[i];
  2916. var input = button.querySelector(Selector$1.INPUT);
  2917. if (input.checked || input.hasAttribute('checked')) {
  2918. button.classList.add(ClassName$1.ACTIVE);
  2919. } else {
  2920. button.classList.remove(ClassName$1.ACTIVE);
  2921. }
  2922. } // find all button toggles
  2923. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2924. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2925. var _button = buttons[_i];
  2926. if (_button.getAttribute('aria-pressed') === 'true') {
  2927. _button.classList.add(ClassName$1.ACTIVE);
  2928. } else {
  2929. _button.classList.remove(ClassName$1.ACTIVE);
  2930. }
  2931. }
  2932. });
  2933. /**
  2934. * ------------------------------------------------------------------------
  2935. * jQuery
  2936. * ------------------------------------------------------------------------
  2937. */
  2938. $.fn[NAME$1] = Button._jQueryInterface;
  2939. $.fn[NAME$1].Constructor = Button;
  2940. $.fn[NAME$1].noConflict = function () {
  2941. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2942. return Button._jQueryInterface;
  2943. };
  2944. /**
  2945. * ------------------------------------------------------------------------
  2946. * Constants
  2947. * ------------------------------------------------------------------------
  2948. */
  2949. var NAME$2 = 'carousel';
  2950. var VERSION$2 = '4.4.1';
  2951. var DATA_KEY$2 = 'bs.carousel';
  2952. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2953. var DATA_API_KEY$2 = '.data-api';
  2954. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2955. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2956. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2957. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2958. var SWIPE_THRESHOLD = 40;
  2959. var Default = {
  2960. interval: 5000,
  2961. keyboard: true,
  2962. slide: false,
  2963. pause: 'hover',
  2964. wrap: true,
  2965. touch: true
  2966. };
  2967. var DefaultType = {
  2968. interval: '(number|boolean)',
  2969. keyboard: 'boolean',
  2970. slide: '(boolean|string)',
  2971. pause: '(string|boolean)',
  2972. wrap: 'boolean',
  2973. touch: 'boolean'
  2974. };
  2975. var Direction = {
  2976. NEXT: 'next',
  2977. PREV: 'prev',
  2978. LEFT: 'left',
  2979. RIGHT: 'right'
  2980. };
  2981. var Event$2 = {
  2982. SLIDE: "slide" + EVENT_KEY$2,
  2983. SLID: "slid" + EVENT_KEY$2,
  2984. KEYDOWN: "keydown" + EVENT_KEY$2,
  2985. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2986. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2987. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2988. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2989. TOUCHEND: "touchend" + EVENT_KEY$2,
  2990. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2991. POINTERUP: "pointerup" + EVENT_KEY$2,
  2992. DRAG_START: "dragstart" + EVENT_KEY$2,
  2993. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2994. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2995. };
  2996. var ClassName$2 = {
  2997. CAROUSEL: 'carousel',
  2998. ACTIVE: 'active',
  2999. SLIDE: 'slide',
  3000. RIGHT: 'carousel-item-right',
  3001. LEFT: 'carousel-item-left',
  3002. NEXT: 'carousel-item-next',
  3003. PREV: 'carousel-item-prev',
  3004. ITEM: 'carousel-item',
  3005. POINTER_EVENT: 'pointer-event'
  3006. };
  3007. var Selector$2 = {
  3008. ACTIVE: '.active',
  3009. ACTIVE_ITEM: '.active.carousel-item',
  3010. ITEM: '.carousel-item',
  3011. ITEM_IMG: '.carousel-item img',
  3012. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3013. INDICATORS: '.carousel-indicators',
  3014. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3015. DATA_RIDE: '[data-ride="carousel"]'
  3016. };
  3017. var PointerType = {
  3018. TOUCH: 'touch',
  3019. PEN: 'pen'
  3020. };
  3021. /**
  3022. * ------------------------------------------------------------------------
  3023. * Class Definition
  3024. * ------------------------------------------------------------------------
  3025. */
  3026. var Carousel =
  3027. /*#__PURE__*/
  3028. function () {
  3029. function Carousel(element, config) {
  3030. this._items = null;
  3031. this._interval = null;
  3032. this._activeElement = null;
  3033. this._isPaused = false;
  3034. this._isSliding = false;
  3035. this.touchTimeout = null;
  3036. this.touchStartX = 0;
  3037. this.touchDeltaX = 0;
  3038. this._config = this._getConfig(config);
  3039. this._element = element;
  3040. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3041. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3042. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3043. this._addEventListeners();
  3044. } // Getters
  3045. var _proto = Carousel.prototype;
  3046. // Public
  3047. _proto.next = function next() {
  3048. if (!this._isSliding) {
  3049. this._slide(Direction.NEXT);
  3050. }
  3051. };
  3052. _proto.nextWhenVisible = function nextWhenVisible() {
  3053. // Don't call next when the page isn't visible
  3054. // or the carousel or its parent isn't visible
  3055. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3056. this.next();
  3057. }
  3058. };
  3059. _proto.prev = function prev() {
  3060. if (!this._isSliding) {
  3061. this._slide(Direction.PREV);
  3062. }
  3063. };
  3064. _proto.pause = function pause(event) {
  3065. if (!event) {
  3066. this._isPaused = true;
  3067. }
  3068. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3069. Util.triggerTransitionEnd(this._element);
  3070. this.cycle(true);
  3071. }
  3072. clearInterval(this._interval);
  3073. this._interval = null;
  3074. };
  3075. _proto.cycle = function cycle(event) {
  3076. if (!event) {
  3077. this._isPaused = false;
  3078. }
  3079. if (this._interval) {
  3080. clearInterval(this._interval);
  3081. this._interval = null;
  3082. }
  3083. if (this._config.interval && !this._isPaused) {
  3084. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3085. }
  3086. };
  3087. _proto.to = function to(index) {
  3088. var _this = this;
  3089. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3090. var activeIndex = this._getItemIndex(this._activeElement);
  3091. if (index > this._items.length - 1 || index < 0) {
  3092. return;
  3093. }
  3094. if (this._isSliding) {
  3095. $(this._element).one(Event$2.SLID, function () {
  3096. return _this.to(index);
  3097. });
  3098. return;
  3099. }
  3100. if (activeIndex === index) {
  3101. this.pause();
  3102. this.cycle();
  3103. return;
  3104. }
  3105. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3106. this._slide(direction, this._items[index]);
  3107. };
  3108. _proto.dispose = function dispose() {
  3109. $(this._element).off(EVENT_KEY$2);
  3110. $.removeData(this._element, DATA_KEY$2);
  3111. this._items = null;
  3112. this._config = null;
  3113. this._element = null;
  3114. this._interval = null;
  3115. this._isPaused = null;
  3116. this._isSliding = null;
  3117. this._activeElement = null;
  3118. this._indicatorsElement = null;
  3119. } // Private
  3120. ;
  3121. _proto._getConfig = function _getConfig(config) {
  3122. config = _objectSpread2({}, Default, {}, config);
  3123. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3124. return config;
  3125. };
  3126. _proto._handleSwipe = function _handleSwipe() {
  3127. var absDeltax = Math.abs(this.touchDeltaX);
  3128. if (absDeltax <= SWIPE_THRESHOLD) {
  3129. return;
  3130. }
  3131. var direction = absDeltax / this.touchDeltaX;
  3132. this.touchDeltaX = 0; // swipe left
  3133. if (direction > 0) {
  3134. this.prev();
  3135. } // swipe right
  3136. if (direction < 0) {
  3137. this.next();
  3138. }
  3139. };
  3140. _proto._addEventListeners = function _addEventListeners() {
  3141. var _this2 = this;
  3142. if (this._config.keyboard) {
  3143. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3144. return _this2._keydown(event);
  3145. });
  3146. }
  3147. if (this._config.pause === 'hover') {
  3148. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3149. return _this2.pause(event);
  3150. }).on(Event$2.MOUSELEAVE, function (event) {
  3151. return _this2.cycle(event);
  3152. });
  3153. }
  3154. if (this._config.touch) {
  3155. this._addTouchEventListeners();
  3156. }
  3157. };
  3158. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3159. var _this3 = this;
  3160. if (!this._touchSupported) {
  3161. return;
  3162. }
  3163. var start = function start(event) {
  3164. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3165. _this3.touchStartX = event.originalEvent.clientX;
  3166. } else if (!_this3._pointerEvent) {
  3167. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3168. }
  3169. };
  3170. var move = function move(event) {
  3171. // ensure swiping with one touch and not pinching
  3172. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3173. _this3.touchDeltaX = 0;
  3174. } else {
  3175. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3176. }
  3177. };
  3178. var end = function end(event) {
  3179. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3180. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3181. }
  3182. _this3._handleSwipe();
  3183. if (_this3._config.pause === 'hover') {
  3184. // If it's a touch-enabled device, mouseenter/leave are fired as
  3185. // part of the mouse compatibility events on first tap - the carousel
  3186. // would stop cycling until user tapped out of it;
  3187. // here, we listen for touchend, explicitly pause the carousel
  3188. // (as if it's the second time we tap on it, mouseenter compat event
  3189. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3190. // events to fire) we explicitly restart cycling
  3191. _this3.pause();
  3192. if (_this3.touchTimeout) {
  3193. clearTimeout(_this3.touchTimeout);
  3194. }
  3195. _this3.touchTimeout = setTimeout(function (event) {
  3196. return _this3.cycle(event);
  3197. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3198. }
  3199. };
  3200. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3201. return e.preventDefault();
  3202. });
  3203. if (this._pointerEvent) {
  3204. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3205. return start(event);
  3206. });
  3207. $(this._element).on(Event$2.POINTERUP, function (event) {
  3208. return end(event);
  3209. });
  3210. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3211. } else {
  3212. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3213. return start(event);
  3214. });
  3215. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3216. return move(event);
  3217. });
  3218. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3219. return end(event);
  3220. });
  3221. }
  3222. };
  3223. _proto._keydown = function _keydown(event) {
  3224. if (/input|textarea/i.test(event.target.tagName)) {
  3225. return;
  3226. }
  3227. switch (event.which) {
  3228. case ARROW_LEFT_KEYCODE:
  3229. event.preventDefault();
  3230. this.prev();
  3231. break;
  3232. case ARROW_RIGHT_KEYCODE:
  3233. event.preventDefault();
  3234. this.next();
  3235. break;
  3236. }
  3237. };
  3238. _proto._getItemIndex = function _getItemIndex(element) {
  3239. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3240. return this._items.indexOf(element);
  3241. };
  3242. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3243. var isNextDirection = direction === Direction.NEXT;
  3244. var isPrevDirection = direction === Direction.PREV;
  3245. var activeIndex = this._getItemIndex(activeElement);
  3246. var lastItemIndex = this._items.length - 1;
  3247. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3248. if (isGoingToWrap && !this._config.wrap) {
  3249. return activeElement;
  3250. }
  3251. var delta = direction === Direction.PREV ? -1 : 1;
  3252. var itemIndex = (activeIndex + delta) % this._items.length;
  3253. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3254. };
  3255. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3256. var targetIndex = this._getItemIndex(relatedTarget);
  3257. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3258. var slideEvent = $.Event(Event$2.SLIDE, {
  3259. relatedTarget: relatedTarget,
  3260. direction: eventDirectionName,
  3261. from: fromIndex,
  3262. to: targetIndex
  3263. });
  3264. $(this._element).trigger(slideEvent);
  3265. return slideEvent;
  3266. };
  3267. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3268. if (this._indicatorsElement) {
  3269. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3270. $(indicators).removeClass(ClassName$2.ACTIVE);
  3271. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3272. if (nextIndicator) {
  3273. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3274. }
  3275. }
  3276. };
  3277. _proto._slide = function _slide(direction, element) {
  3278. var _this4 = this;
  3279. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3280. var activeElementIndex = this._getItemIndex(activeElement);
  3281. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3282. var nextElementIndex = this._getItemIndex(nextElement);
  3283. var isCycling = Boolean(this._interval);
  3284. var directionalClassName;
  3285. var orderClassName;
  3286. var eventDirectionName;
  3287. if (direction === Direction.NEXT) {
  3288. directionalClassName = ClassName$2.LEFT;
  3289. orderClassName = ClassName$2.NEXT;
  3290. eventDirectionName = Direction.LEFT;
  3291. } else {
  3292. directionalClassName = ClassName$2.RIGHT;
  3293. orderClassName = ClassName$2.PREV;
  3294. eventDirectionName = Direction.RIGHT;
  3295. }
  3296. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3297. this._isSliding = false;
  3298. return;
  3299. }
  3300. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3301. if (slideEvent.isDefaultPrevented()) {
  3302. return;
  3303. }
  3304. if (!activeElement || !nextElement) {
  3305. // Some weirdness is happening, so we bail
  3306. return;
  3307. }
  3308. this._isSliding = true;
  3309. if (isCycling) {
  3310. this.pause();
  3311. }
  3312. this._setActiveIndicatorElement(nextElement);
  3313. var slidEvent = $.Event(Event$2.SLID, {
  3314. relatedTarget: nextElement,
  3315. direction: eventDirectionName,
  3316. from: activeElementIndex,
  3317. to: nextElementIndex
  3318. });
  3319. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3320. $(nextElement).addClass(orderClassName);
  3321. Util.reflow(nextElement);
  3322. $(activeElement).addClass(directionalClassName);
  3323. $(nextElement).addClass(directionalClassName);
  3324. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3325. if (nextElementInterval) {
  3326. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3327. this._config.interval = nextElementInterval;
  3328. } else {
  3329. this._config.interval = this._config.defaultInterval || this._config.interval;
  3330. }
  3331. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3332. $(activeElement).one(Util.TRANSITION_END, function () {
  3333. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3334. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3335. _this4._isSliding = false;
  3336. setTimeout(function () {
  3337. return $(_this4._element).trigger(slidEvent);
  3338. }, 0);
  3339. }).emulateTransitionEnd(transitionDuration);
  3340. } else {
  3341. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3342. $(nextElement).addClass(ClassName$2.ACTIVE);
  3343. this._isSliding = false;
  3344. $(this._element).trigger(slidEvent);
  3345. }
  3346. if (isCycling) {
  3347. this.cycle();
  3348. }
  3349. } // Static
  3350. ;
  3351. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3352. return this.each(function () {
  3353. var data = $(this).data(DATA_KEY$2);
  3354. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3355. if (typeof config === 'object') {
  3356. _config = _objectSpread2({}, _config, {}, config);
  3357. }
  3358. var action = typeof config === 'string' ? config : _config.slide;
  3359. if (!data) {
  3360. data = new Carousel(this, _config);
  3361. $(this).data(DATA_KEY$2, data);
  3362. }
  3363. if (typeof config === 'number') {
  3364. data.to(config);
  3365. } else if (typeof action === 'string') {
  3366. if (typeof data[action] === 'undefined') {
  3367. throw new TypeError("No method named \"" + action + "\"");
  3368. }
  3369. data[action]();
  3370. } else if (_config.interval && _config.ride) {
  3371. data.pause();
  3372. data.cycle();
  3373. }
  3374. });
  3375. };
  3376. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3377. var selector = Util.getSelectorFromElement(this);
  3378. if (!selector) {
  3379. return;
  3380. }
  3381. var target = $(selector)[0];
  3382. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3383. return;
  3384. }
  3385. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3386. var slideIndex = this.getAttribute('data-slide-to');
  3387. if (slideIndex) {
  3388. config.interval = false;
  3389. }
  3390. Carousel._jQueryInterface.call($(target), config);
  3391. if (slideIndex) {
  3392. $(target).data(DATA_KEY$2).to(slideIndex);
  3393. }
  3394. event.preventDefault();
  3395. };
  3396. _createClass(Carousel, null, [{
  3397. key: "VERSION",
  3398. get: function get() {
  3399. return VERSION$2;
  3400. }
  3401. }, {
  3402. key: "Default",
  3403. get: function get() {
  3404. return Default;
  3405. }
  3406. }]);
  3407. return Carousel;
  3408. }();
  3409. /**
  3410. * ------------------------------------------------------------------------
  3411. * Data Api implementation
  3412. * ------------------------------------------------------------------------
  3413. */
  3414. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3415. $(window).on(Event$2.LOAD_DATA_API, function () {
  3416. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3417. for (var i = 0, len = carousels.length; i < len; i++) {
  3418. var $carousel = $(carousels[i]);
  3419. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3420. }
  3421. });
  3422. /**
  3423. * ------------------------------------------------------------------------
  3424. * jQuery
  3425. * ------------------------------------------------------------------------
  3426. */
  3427. $.fn[NAME$2] = Carousel._jQueryInterface;
  3428. $.fn[NAME$2].Constructor = Carousel;
  3429. $.fn[NAME$2].noConflict = function () {
  3430. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3431. return Carousel._jQueryInterface;
  3432. };
  3433. /**
  3434. * ------------------------------------------------------------------------
  3435. * Constants
  3436. * ------------------------------------------------------------------------
  3437. */
  3438. var NAME$3 = 'collapse';
  3439. var VERSION$3 = '4.4.1';
  3440. var DATA_KEY$3 = 'bs.collapse';
  3441. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3442. var DATA_API_KEY$3 = '.data-api';
  3443. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3444. var Default$1 = {
  3445. toggle: true,
  3446. parent: ''
  3447. };
  3448. var DefaultType$1 = {
  3449. toggle: 'boolean',
  3450. parent: '(string|element)'
  3451. };
  3452. var Event$3 = {
  3453. SHOW: "show" + EVENT_KEY$3,
  3454. SHOWN: "shown" + EVENT_KEY$3,
  3455. HIDE: "hide" + EVENT_KEY$3,
  3456. HIDDEN: "hidden" + EVENT_KEY$3,
  3457. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3458. };
  3459. var ClassName$3 = {
  3460. SHOW: 'show',
  3461. COLLAPSE: 'collapse',
  3462. COLLAPSING: 'collapsing',
  3463. COLLAPSED: 'collapsed'
  3464. };
  3465. var Dimension = {
  3466. WIDTH: 'width',
  3467. HEIGHT: 'height'
  3468. };
  3469. var Selector$3 = {
  3470. ACTIVES: '.show, .collapsing',
  3471. DATA_TOGGLE: '[data-toggle="collapse"]'
  3472. };
  3473. /**
  3474. * ------------------------------------------------------------------------
  3475. * Class Definition
  3476. * ------------------------------------------------------------------------
  3477. */
  3478. var Collapse =
  3479. /*#__PURE__*/
  3480. function () {
  3481. function Collapse(element, config) {
  3482. this._isTransitioning = false;
  3483. this._element = element;
  3484. this._config = this._getConfig(config);
  3485. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3486. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3487. for (var i = 0, len = toggleList.length; i < len; i++) {
  3488. var elem = toggleList[i];
  3489. var selector = Util.getSelectorFromElement(elem);
  3490. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3491. return foundElem === element;
  3492. });
  3493. if (selector !== null && filterElement.length > 0) {
  3494. this._selector = selector;
  3495. this._triggerArray.push(elem);
  3496. }
  3497. }
  3498. this._parent = this._config.parent ? this._getParent() : null;
  3499. if (!this._config.parent) {
  3500. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3501. }
  3502. if (this._config.toggle) {
  3503. this.toggle();
  3504. }
  3505. } // Getters
  3506. var _proto = Collapse.prototype;
  3507. // Public
  3508. _proto.toggle = function toggle() {
  3509. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3510. this.hide();
  3511. } else {
  3512. this.show();
  3513. }
  3514. };
  3515. _proto.show = function show() {
  3516. var _this = this;
  3517. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3518. return;
  3519. }
  3520. var actives;
  3521. var activesData;
  3522. if (this._parent) {
  3523. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3524. if (typeof _this._config.parent === 'string') {
  3525. return elem.getAttribute('data-parent') === _this._config.parent;
  3526. }
  3527. return elem.classList.contains(ClassName$3.COLLAPSE);
  3528. });
  3529. if (actives.length === 0) {
  3530. actives = null;
  3531. }
  3532. }
  3533. if (actives) {
  3534. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3535. if (activesData && activesData._isTransitioning) {
  3536. return;
  3537. }
  3538. }
  3539. var startEvent = $.Event(Event$3.SHOW);
  3540. $(this._element).trigger(startEvent);
  3541. if (startEvent.isDefaultPrevented()) {
  3542. return;
  3543. }
  3544. if (actives) {
  3545. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3546. if (!activesData) {
  3547. $(actives).data(DATA_KEY$3, null);
  3548. }
  3549. }
  3550. var dimension = this._getDimension();
  3551. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3552. this._element.style[dimension] = 0;
  3553. if (this._triggerArray.length) {
  3554. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3555. }
  3556. this.setTransitioning(true);
  3557. var complete = function complete() {
  3558. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3559. _this._element.style[dimension] = '';
  3560. _this.setTransitioning(false);
  3561. $(_this._element).trigger(Event$3.SHOWN);
  3562. };
  3563. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3564. var scrollSize = "scroll" + capitalizedDimension;
  3565. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3566. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3567. this._element.style[dimension] = this._element[scrollSize] + "px";
  3568. };
  3569. _proto.hide = function hide() {
  3570. var _this2 = this;
  3571. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3572. return;
  3573. }
  3574. var startEvent = $.Event(Event$3.HIDE);
  3575. $(this._element).trigger(startEvent);
  3576. if (startEvent.isDefaultPrevented()) {
  3577. return;
  3578. }
  3579. var dimension = this._getDimension();
  3580. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3581. Util.reflow(this._element);
  3582. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3583. var triggerArrayLength = this._triggerArray.length;
  3584. if (triggerArrayLength > 0) {
  3585. for (var i = 0; i < triggerArrayLength; i++) {
  3586. var trigger = this._triggerArray[i];
  3587. var selector = Util.getSelectorFromElement(trigger);
  3588. if (selector !== null) {
  3589. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3590. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3591. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3592. }
  3593. }
  3594. }
  3595. }
  3596. this.setTransitioning(true);
  3597. var complete = function complete() {
  3598. _this2.setTransitioning(false);
  3599. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3600. };
  3601. this._element.style[dimension] = '';
  3602. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3603. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3604. };
  3605. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3606. this._isTransitioning = isTransitioning;
  3607. };
  3608. _proto.dispose = function dispose() {
  3609. $.removeData(this._element, DATA_KEY$3);
  3610. this._config = null;
  3611. this._parent = null;
  3612. this._element = null;
  3613. this._triggerArray = null;
  3614. this._isTransitioning = null;
  3615. } // Private
  3616. ;
  3617. _proto._getConfig = function _getConfig(config) {
  3618. config = _objectSpread2({}, Default$1, {}, config);
  3619. config.toggle = Boolean(config.toggle); // Coerce string values
  3620. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3621. return config;
  3622. };
  3623. _proto._getDimension = function _getDimension() {
  3624. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3625. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3626. };
  3627. _proto._getParent = function _getParent() {
  3628. var _this3 = this;
  3629. var parent;
  3630. if (Util.isElement(this._config.parent)) {
  3631. parent = this._config.parent; // It's a jQuery object
  3632. if (typeof this._config.parent.jquery !== 'undefined') {
  3633. parent = this._config.parent[0];
  3634. }
  3635. } else {
  3636. parent = document.querySelector(this._config.parent);
  3637. }
  3638. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3639. var children = [].slice.call(parent.querySelectorAll(selector));
  3640. $(children).each(function (i, element) {
  3641. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3642. });
  3643. return parent;
  3644. };
  3645. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3646. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3647. if (triggerArray.length) {
  3648. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3649. }
  3650. } // Static
  3651. ;
  3652. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3653. var selector = Util.getSelectorFromElement(element);
  3654. return selector ? document.querySelector(selector) : null;
  3655. };
  3656. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3657. return this.each(function () {
  3658. var $this = $(this);
  3659. var data = $this.data(DATA_KEY$3);
  3660. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3661. if (!data && _config.toggle && /show|hide/.test(config)) {
  3662. _config.toggle = false;
  3663. }
  3664. if (!data) {
  3665. data = new Collapse(this, _config);
  3666. $this.data(DATA_KEY$3, data);
  3667. }
  3668. if (typeof config === 'string') {
  3669. if (typeof data[config] === 'undefined') {
  3670. throw new TypeError("No method named \"" + config + "\"");
  3671. }
  3672. data[config]();
  3673. }
  3674. });
  3675. };
  3676. _createClass(Collapse, null, [{
  3677. key: "VERSION",
  3678. get: function get() {
  3679. return VERSION$3;
  3680. }
  3681. }, {
  3682. key: "Default",
  3683. get: function get() {
  3684. return Default$1;
  3685. }
  3686. }]);
  3687. return Collapse;
  3688. }();
  3689. /**
  3690. * ------------------------------------------------------------------------
  3691. * Data Api implementation
  3692. * ------------------------------------------------------------------------
  3693. */
  3694. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3695. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3696. if (event.currentTarget.tagName === 'A') {
  3697. event.preventDefault();
  3698. }
  3699. var $trigger = $(this);
  3700. var selector = Util.getSelectorFromElement(this);
  3701. var selectors = [].slice.call(document.querySelectorAll(selector));
  3702. $(selectors).each(function () {
  3703. var $target = $(this);
  3704. var data = $target.data(DATA_KEY$3);
  3705. var config = data ? 'toggle' : $trigger.data();
  3706. Collapse._jQueryInterface.call($target, config);
  3707. });
  3708. });
  3709. /**
  3710. * ------------------------------------------------------------------------
  3711. * jQuery
  3712. * ------------------------------------------------------------------------
  3713. */
  3714. $.fn[NAME$3] = Collapse._jQueryInterface;
  3715. $.fn[NAME$3].Constructor = Collapse;
  3716. $.fn[NAME$3].noConflict = function () {
  3717. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3718. return Collapse._jQueryInterface;
  3719. };
  3720. /**
  3721. * ------------------------------------------------------------------------
  3722. * Constants
  3723. * ------------------------------------------------------------------------
  3724. */
  3725. var NAME$4 = 'dropdown';
  3726. var VERSION$4 = '4.4.1';
  3727. var DATA_KEY$4 = 'bs.dropdown';
  3728. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3729. var DATA_API_KEY$4 = '.data-api';
  3730. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3731. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3732. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3733. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3734. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3735. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3736. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3737. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3738. var Event$4 = {
  3739. HIDE: "hide" + EVENT_KEY$4,
  3740. HIDDEN: "hidden" + EVENT_KEY$4,
  3741. SHOW: "show" + EVENT_KEY$4,
  3742. SHOWN: "shown" + EVENT_KEY$4,
  3743. CLICK: "click" + EVENT_KEY$4,
  3744. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3745. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3746. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3747. };
  3748. var ClassName$4 = {
  3749. DISABLED: 'disabled',
  3750. SHOW: 'show',
  3751. DROPUP: 'dropup',
  3752. DROPRIGHT: 'dropright',
  3753. DROPLEFT: 'dropleft',
  3754. MENURIGHT: 'dropdown-menu-right',
  3755. MENULEFT: 'dropdown-menu-left',
  3756. POSITION_STATIC: 'position-static'
  3757. };
  3758. var Selector$4 = {
  3759. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3760. FORM_CHILD: '.dropdown form',
  3761. MENU: '.dropdown-menu',
  3762. NAVBAR_NAV: '.navbar-nav',
  3763. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3764. };
  3765. var AttachmentMap = {
  3766. TOP: 'top-start',
  3767. TOPEND: 'top-end',
  3768. BOTTOM: 'bottom-start',
  3769. BOTTOMEND: 'bottom-end',
  3770. RIGHT: 'right-start',
  3771. RIGHTEND: 'right-end',
  3772. LEFT: 'left-start',
  3773. LEFTEND: 'left-end'
  3774. };
  3775. var Default$2 = {
  3776. offset: 0,
  3777. flip: true,
  3778. boundary: 'scrollParent',
  3779. reference: 'toggle',
  3780. display: 'dynamic',
  3781. popperConfig: null
  3782. };
  3783. var DefaultType$2 = {
  3784. offset: '(number|string|function)',
  3785. flip: 'boolean',
  3786. boundary: '(string|element)',
  3787. reference: '(string|element)',
  3788. display: 'string',
  3789. popperConfig: '(null|object)'
  3790. };
  3791. /**
  3792. * ------------------------------------------------------------------------
  3793. * Class Definition
  3794. * ------------------------------------------------------------------------
  3795. */
  3796. var Dropdown =
  3797. /*#__PURE__*/
  3798. function () {
  3799. function Dropdown(element, config) {
  3800. this._element = element;
  3801. this._popper = null;
  3802. this._config = this._getConfig(config);
  3803. this._menu = this._getMenuElement();
  3804. this._inNavbar = this._detectNavbar();
  3805. this._addEventListeners();
  3806. } // Getters
  3807. var _proto = Dropdown.prototype;
  3808. // Public
  3809. _proto.toggle = function toggle() {
  3810. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3811. return;
  3812. }
  3813. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3814. Dropdown._clearMenus();
  3815. if (isActive) {
  3816. return;
  3817. }
  3818. this.show(true);
  3819. };
  3820. _proto.show = function show(usePopper) {
  3821. if (usePopper === void 0) {
  3822. usePopper = false;
  3823. }
  3824. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3825. return;
  3826. }
  3827. var relatedTarget = {
  3828. relatedTarget: this._element
  3829. };
  3830. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3831. var parent = Dropdown._getParentFromElement(this._element);
  3832. $(parent).trigger(showEvent);
  3833. if (showEvent.isDefaultPrevented()) {
  3834. return;
  3835. } // Disable totally Popper.js for Dropdown in Navbar
  3836. if (!this._inNavbar && usePopper) {
  3837. /**
  3838. * Check for Popper dependency
  3839. * Popper - https://popper.js.org
  3840. */
  3841. if (typeof Popper === 'undefined') {
  3842. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3843. }
  3844. var referenceElement = this._element;
  3845. if (this._config.reference === 'parent') {
  3846. referenceElement = parent;
  3847. } else if (Util.isElement(this._config.reference)) {
  3848. referenceElement = this._config.reference; // Check if it's jQuery element
  3849. if (typeof this._config.reference.jquery !== 'undefined') {
  3850. referenceElement = this._config.reference[0];
  3851. }
  3852. } // If boundary is not `scrollParent`, then set position to `static`
  3853. // to allow the menu to "escape" the scroll parent's boundaries
  3854. // https://github.com/twbs/bootstrap/issues/24251
  3855. if (this._config.boundary !== 'scrollParent') {
  3856. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3857. }
  3858. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3859. } // If this is a touch-enabled device we add extra
  3860. // empty mouseover listeners to the body's immediate children;
  3861. // only needed because of broken event delegation on iOS
  3862. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3863. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3864. $(document.body).children().on('mouseover', null, $.noop);
  3865. }
  3866. this._element.focus();
  3867. this._element.setAttribute('aria-expanded', true);
  3868. $(this._menu).toggleClass(ClassName$4.SHOW);
  3869. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3870. };
  3871. _proto.hide = function hide() {
  3872. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3873. return;
  3874. }
  3875. var relatedTarget = {
  3876. relatedTarget: this._element
  3877. };
  3878. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3879. var parent = Dropdown._getParentFromElement(this._element);
  3880. $(parent).trigger(hideEvent);
  3881. if (hideEvent.isDefaultPrevented()) {
  3882. return;
  3883. }
  3884. if (this._popper) {
  3885. this._popper.destroy();
  3886. }
  3887. $(this._menu).toggleClass(ClassName$4.SHOW);
  3888. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3889. };
  3890. _proto.dispose = function dispose() {
  3891. $.removeData(this._element, DATA_KEY$4);
  3892. $(this._element).off(EVENT_KEY$4);
  3893. this._element = null;
  3894. this._menu = null;
  3895. if (this._popper !== null) {
  3896. this._popper.destroy();
  3897. this._popper = null;
  3898. }
  3899. };
  3900. _proto.update = function update() {
  3901. this._inNavbar = this._detectNavbar();
  3902. if (this._popper !== null) {
  3903. this._popper.scheduleUpdate();
  3904. }
  3905. } // Private
  3906. ;
  3907. _proto._addEventListeners = function _addEventListeners() {
  3908. var _this = this;
  3909. $(this._element).on(Event$4.CLICK, function (event) {
  3910. event.preventDefault();
  3911. event.stopPropagation();
  3912. _this.toggle();
  3913. });
  3914. };
  3915. _proto._getConfig = function _getConfig(config) {
  3916. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3917. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3918. return config;
  3919. };
  3920. _proto._getMenuElement = function _getMenuElement() {
  3921. if (!this._menu) {
  3922. var parent = Dropdown._getParentFromElement(this._element);
  3923. if (parent) {
  3924. this._menu = parent.querySelector(Selector$4.MENU);
  3925. }
  3926. }
  3927. return this._menu;
  3928. };
  3929. _proto._getPlacement = function _getPlacement() {
  3930. var $parentDropdown = $(this._element.parentNode);
  3931. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3932. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3933. placement = AttachmentMap.TOP;
  3934. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3935. placement = AttachmentMap.TOPEND;
  3936. }
  3937. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3938. placement = AttachmentMap.RIGHT;
  3939. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3940. placement = AttachmentMap.LEFT;
  3941. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3942. placement = AttachmentMap.BOTTOMEND;
  3943. }
  3944. return placement;
  3945. };
  3946. _proto._detectNavbar = function _detectNavbar() {
  3947. return $(this._element).closest('.navbar').length > 0;
  3948. };
  3949. _proto._getOffset = function _getOffset() {
  3950. var _this2 = this;
  3951. var offset = {};
  3952. if (typeof this._config.offset === 'function') {
  3953. offset.fn = function (data) {
  3954. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3955. return data;
  3956. };
  3957. } else {
  3958. offset.offset = this._config.offset;
  3959. }
  3960. return offset;
  3961. };
  3962. _proto._getPopperConfig = function _getPopperConfig() {
  3963. var popperConfig = {
  3964. placement: this._getPlacement(),
  3965. modifiers: {
  3966. offset: this._getOffset(),
  3967. flip: {
  3968. enabled: this._config.flip
  3969. },
  3970. preventOverflow: {
  3971. boundariesElement: this._config.boundary
  3972. }
  3973. }
  3974. }; // Disable Popper.js if we have a static display
  3975. if (this._config.display === 'static') {
  3976. popperConfig.modifiers.applyStyle = {
  3977. enabled: false
  3978. };
  3979. }
  3980. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3981. } // Static
  3982. ;
  3983. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3984. return this.each(function () {
  3985. var data = $(this).data(DATA_KEY$4);
  3986. var _config = typeof config === 'object' ? config : null;
  3987. if (!data) {
  3988. data = new Dropdown(this, _config);
  3989. $(this).data(DATA_KEY$4, data);
  3990. }
  3991. if (typeof config === 'string') {
  3992. if (typeof data[config] === 'undefined') {
  3993. throw new TypeError("No method named \"" + config + "\"");
  3994. }
  3995. data[config]();
  3996. }
  3997. });
  3998. };
  3999. Dropdown._clearMenus = function _clearMenus(event) {
  4000. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4001. return;
  4002. }
  4003. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4004. for (var i = 0, len = toggles.length; i < len; i++) {
  4005. var parent = Dropdown._getParentFromElement(toggles[i]);
  4006. var context = $(toggles[i]).data(DATA_KEY$4);
  4007. var relatedTarget = {
  4008. relatedTarget: toggles[i]
  4009. };
  4010. if (event && event.type === 'click') {
  4011. relatedTarget.clickEvent = event;
  4012. }
  4013. if (!context) {
  4014. continue;
  4015. }
  4016. var dropdownMenu = context._menu;
  4017. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4018. continue;
  4019. }
  4020. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4021. continue;
  4022. }
  4023. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4024. $(parent).trigger(hideEvent);
  4025. if (hideEvent.isDefaultPrevented()) {
  4026. continue;
  4027. } // If this is a touch-enabled device we remove the extra
  4028. // empty mouseover listeners we added for iOS support
  4029. if ('ontouchstart' in document.documentElement) {
  4030. $(document.body).children().off('mouseover', null, $.noop);
  4031. }
  4032. toggles[i].setAttribute('aria-expanded', 'false');
  4033. if (context._popper) {
  4034. context._popper.destroy();
  4035. }
  4036. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4037. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4038. }
  4039. };
  4040. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4041. var parent;
  4042. var selector = Util.getSelectorFromElement(element);
  4043. if (selector) {
  4044. parent = document.querySelector(selector);
  4045. }
  4046. return parent || element.parentNode;
  4047. } // eslint-disable-next-line complexity
  4048. ;
  4049. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4050. // If not input/textarea:
  4051. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4052. // If input/textarea:
  4053. // - If space key => not a dropdown command
  4054. // - If key is other than escape
  4055. // - If key is not up or down => not a dropdown command
  4056. // - If trigger inside the menu => not a dropdown command
  4057. 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)) {
  4058. return;
  4059. }
  4060. event.preventDefault();
  4061. event.stopPropagation();
  4062. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4063. return;
  4064. }
  4065. var parent = Dropdown._getParentFromElement(this);
  4066. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4067. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4068. return;
  4069. }
  4070. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4071. if (event.which === ESCAPE_KEYCODE) {
  4072. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4073. $(toggle).trigger('focus');
  4074. }
  4075. $(this).trigger('click');
  4076. return;
  4077. }
  4078. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4079. return $(item).is(':visible');
  4080. });
  4081. if (items.length === 0) {
  4082. return;
  4083. }
  4084. var index = items.indexOf(event.target);
  4085. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4086. // Up
  4087. index--;
  4088. }
  4089. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4090. // Down
  4091. index++;
  4092. }
  4093. if (index < 0) {
  4094. index = 0;
  4095. }
  4096. items[index].focus();
  4097. };
  4098. _createClass(Dropdown, null, [{
  4099. key: "VERSION",
  4100. get: function get() {
  4101. return VERSION$4;
  4102. }
  4103. }, {
  4104. key: "Default",
  4105. get: function get() {
  4106. return Default$2;
  4107. }
  4108. }, {
  4109. key: "DefaultType",
  4110. get: function get() {
  4111. return DefaultType$2;
  4112. }
  4113. }]);
  4114. return Dropdown;
  4115. }();
  4116. /**
  4117. * ------------------------------------------------------------------------
  4118. * Data Api implementation
  4119. * ------------------------------------------------------------------------
  4120. */
  4121. $(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) {
  4122. event.preventDefault();
  4123. event.stopPropagation();
  4124. Dropdown._jQueryInterface.call($(this), 'toggle');
  4125. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4126. e.stopPropagation();
  4127. });
  4128. /**
  4129. * ------------------------------------------------------------------------
  4130. * jQuery
  4131. * ------------------------------------------------------------------------
  4132. */
  4133. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4134. $.fn[NAME$4].Constructor = Dropdown;
  4135. $.fn[NAME$4].noConflict = function () {
  4136. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4137. return Dropdown._jQueryInterface;
  4138. };
  4139. /**
  4140. * ------------------------------------------------------------------------
  4141. * Constants
  4142. * ------------------------------------------------------------------------
  4143. */
  4144. var NAME$5 = 'modal';
  4145. var VERSION$5 = '4.4.1';
  4146. var DATA_KEY$5 = 'bs.modal';
  4147. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4148. var DATA_API_KEY$5 = '.data-api';
  4149. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4150. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4151. var Default$3 = {
  4152. backdrop: true,
  4153. keyboard: true,
  4154. focus: true,
  4155. show: true
  4156. };
  4157. var DefaultType$3 = {
  4158. backdrop: '(boolean|string)',
  4159. keyboard: 'boolean',
  4160. focus: 'boolean',
  4161. show: 'boolean'
  4162. };
  4163. var Event$5 = {
  4164. HIDE: "hide" + EVENT_KEY$5,
  4165. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4166. HIDDEN: "hidden" + EVENT_KEY$5,
  4167. SHOW: "show" + EVENT_KEY$5,
  4168. SHOWN: "shown" + EVENT_KEY$5,
  4169. FOCUSIN: "focusin" + EVENT_KEY$5,
  4170. RESIZE: "resize" + EVENT_KEY$5,
  4171. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4172. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4173. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4174. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4175. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4176. };
  4177. var ClassName$5 = {
  4178. SCROLLABLE: 'modal-dialog-scrollable',
  4179. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4180. BACKDROP: 'modal-backdrop',
  4181. OPEN: 'modal-open',
  4182. FADE: 'fade',
  4183. SHOW: 'show',
  4184. STATIC: 'modal-static'
  4185. };
  4186. var Selector$5 = {
  4187. DIALOG: '.modal-dialog',
  4188. MODAL_BODY: '.modal-body',
  4189. DATA_TOGGLE: '[data-toggle="modal"]',
  4190. DATA_DISMISS: '[data-dismiss="modal"]',
  4191. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4192. STICKY_CONTENT: '.sticky-top'
  4193. };
  4194. /**
  4195. * ------------------------------------------------------------------------
  4196. * Class Definition
  4197. * ------------------------------------------------------------------------
  4198. */
  4199. var Modal =
  4200. /*#__PURE__*/
  4201. function () {
  4202. function Modal(element, config) {
  4203. this._config = this._getConfig(config);
  4204. this._element = element;
  4205. this._dialog = element.querySelector(Selector$5.DIALOG);
  4206. this._backdrop = null;
  4207. this._isShown = false;
  4208. this._isBodyOverflowing = false;
  4209. this._ignoreBackdropClick = false;
  4210. this._isTransitioning = false;
  4211. this._scrollbarWidth = 0;
  4212. } // Getters
  4213. var _proto = Modal.prototype;
  4214. // Public
  4215. _proto.toggle = function toggle(relatedTarget) {
  4216. return this._isShown ? this.hide() : this.show(relatedTarget);
  4217. };
  4218. _proto.show = function show(relatedTarget) {
  4219. var _this = this;
  4220. if (this._isShown || this._isTransitioning) {
  4221. return;
  4222. }
  4223. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4224. this._isTransitioning = true;
  4225. }
  4226. var showEvent = $.Event(Event$5.SHOW, {
  4227. relatedTarget: relatedTarget
  4228. });
  4229. $(this._element).trigger(showEvent);
  4230. if (this._isShown || showEvent.isDefaultPrevented()) {
  4231. return;
  4232. }
  4233. this._isShown = true;
  4234. this._checkScrollbar();
  4235. this._setScrollbar();
  4236. this._adjustDialog();
  4237. this._setEscapeEvent();
  4238. this._setResizeEvent();
  4239. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4240. return _this.hide(event);
  4241. });
  4242. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4243. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4244. if ($(event.target).is(_this._element)) {
  4245. _this._ignoreBackdropClick = true;
  4246. }
  4247. });
  4248. });
  4249. this._showBackdrop(function () {
  4250. return _this._showElement(relatedTarget);
  4251. });
  4252. };
  4253. _proto.hide = function hide(event) {
  4254. var _this2 = this;
  4255. if (event) {
  4256. event.preventDefault();
  4257. }
  4258. if (!this._isShown || this._isTransitioning) {
  4259. return;
  4260. }
  4261. var hideEvent = $.Event(Event$5.HIDE);
  4262. $(this._element).trigger(hideEvent);
  4263. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4264. return;
  4265. }
  4266. this._isShown = false;
  4267. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4268. if (transition) {
  4269. this._isTransitioning = true;
  4270. }
  4271. this._setEscapeEvent();
  4272. this._setResizeEvent();
  4273. $(document).off(Event$5.FOCUSIN);
  4274. $(this._element).removeClass(ClassName$5.SHOW);
  4275. $(this._element).off(Event$5.CLICK_DISMISS);
  4276. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4277. if (transition) {
  4278. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4279. $(this._element).one(Util.TRANSITION_END, function (event) {
  4280. return _this2._hideModal(event);
  4281. }).emulateTransitionEnd(transitionDuration);
  4282. } else {
  4283. this._hideModal();
  4284. }
  4285. };
  4286. _proto.dispose = function dispose() {
  4287. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4288. return $(htmlElement).off(EVENT_KEY$5);
  4289. });
  4290. /**
  4291. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4292. * Do not move `document` in `htmlElements` array
  4293. * It will remove `Event.CLICK_DATA_API` event that should remain
  4294. */
  4295. $(document).off(Event$5.FOCUSIN);
  4296. $.removeData(this._element, DATA_KEY$5);
  4297. this._config = null;
  4298. this._element = null;
  4299. this._dialog = null;
  4300. this._backdrop = null;
  4301. this._isShown = null;
  4302. this._isBodyOverflowing = null;
  4303. this._ignoreBackdropClick = null;
  4304. this._isTransitioning = null;
  4305. this._scrollbarWidth = null;
  4306. };
  4307. _proto.handleUpdate = function handleUpdate() {
  4308. this._adjustDialog();
  4309. } // Private
  4310. ;
  4311. _proto._getConfig = function _getConfig(config) {
  4312. config = _objectSpread2({}, Default$3, {}, config);
  4313. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4314. return config;
  4315. };
  4316. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4317. var _this3 = this;
  4318. if (this._config.backdrop === 'static') {
  4319. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4320. $(this._element).trigger(hideEventPrevented);
  4321. if (hideEventPrevented.defaultPrevented) {
  4322. return;
  4323. }
  4324. this._element.classList.add(ClassName$5.STATIC);
  4325. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4326. $(this._element).one(Util.TRANSITION_END, function () {
  4327. _this3._element.classList.remove(ClassName$5.STATIC);
  4328. }).emulateTransitionEnd(modalTransitionDuration);
  4329. this._element.focus();
  4330. } else {
  4331. this.hide();
  4332. }
  4333. };
  4334. _proto._showElement = function _showElement(relatedTarget) {
  4335. var _this4 = this;
  4336. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4337. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4338. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4339. // Don't move modal's DOM position
  4340. document.body.appendChild(this._element);
  4341. }
  4342. this._element.style.display = 'block';
  4343. this._element.removeAttribute('aria-hidden');
  4344. this._element.setAttribute('aria-modal', true);
  4345. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4346. modalBody.scrollTop = 0;
  4347. } else {
  4348. this._element.scrollTop = 0;
  4349. }
  4350. if (transition) {
  4351. Util.reflow(this._element);
  4352. }
  4353. $(this._element).addClass(ClassName$5.SHOW);
  4354. if (this._config.focus) {
  4355. this._enforceFocus();
  4356. }
  4357. var shownEvent = $.Event(Event$5.SHOWN, {
  4358. relatedTarget: relatedTarget
  4359. });
  4360. var transitionComplete = function transitionComplete() {
  4361. if (_this4._config.focus) {
  4362. _this4._element.focus();
  4363. }
  4364. _this4._isTransitioning = false;
  4365. $(_this4._element).trigger(shownEvent);
  4366. };
  4367. if (transition) {
  4368. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4369. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4370. } else {
  4371. transitionComplete();
  4372. }
  4373. };
  4374. _proto._enforceFocus = function _enforceFocus() {
  4375. var _this5 = this;
  4376. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4377. .on(Event$5.FOCUSIN, function (event) {
  4378. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4379. _this5._element.focus();
  4380. }
  4381. });
  4382. };
  4383. _proto._setEscapeEvent = function _setEscapeEvent() {
  4384. var _this6 = this;
  4385. if (this._isShown && this._config.keyboard) {
  4386. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4387. if (event.which === ESCAPE_KEYCODE$1) {
  4388. _this6._triggerBackdropTransition();
  4389. }
  4390. });
  4391. } else if (!this._isShown) {
  4392. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4393. }
  4394. };
  4395. _proto._setResizeEvent = function _setResizeEvent() {
  4396. var _this7 = this;
  4397. if (this._isShown) {
  4398. $(window).on(Event$5.RESIZE, function (event) {
  4399. return _this7.handleUpdate(event);
  4400. });
  4401. } else {
  4402. $(window).off(Event$5.RESIZE);
  4403. }
  4404. };
  4405. _proto._hideModal = function _hideModal() {
  4406. var _this8 = this;
  4407. this._element.style.display = 'none';
  4408. this._element.setAttribute('aria-hidden', true);
  4409. this._element.removeAttribute('aria-modal');
  4410. this._isTransitioning = false;
  4411. this._showBackdrop(function () {
  4412. $(document.body).removeClass(ClassName$5.OPEN);
  4413. _this8._resetAdjustments();
  4414. _this8._resetScrollbar();
  4415. $(_this8._element).trigger(Event$5.HIDDEN);
  4416. });
  4417. };
  4418. _proto._removeBackdrop = function _removeBackdrop() {
  4419. if (this._backdrop) {
  4420. $(this._backdrop).remove();
  4421. this._backdrop = null;
  4422. }
  4423. };
  4424. _proto._showBackdrop = function _showBackdrop(callback) {
  4425. var _this9 = this;
  4426. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4427. if (this._isShown && this._config.backdrop) {
  4428. this._backdrop = document.createElement('div');
  4429. this._backdrop.className = ClassName$5.BACKDROP;
  4430. if (animate) {
  4431. this._backdrop.classList.add(animate);
  4432. }
  4433. $(this._backdrop).appendTo(document.body);
  4434. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4435. if (_this9._ignoreBackdropClick) {
  4436. _this9._ignoreBackdropClick = false;
  4437. return;
  4438. }
  4439. if (event.target !== event.currentTarget) {
  4440. return;
  4441. }
  4442. _this9._triggerBackdropTransition();
  4443. });
  4444. if (animate) {
  4445. Util.reflow(this._backdrop);
  4446. }
  4447. $(this._backdrop).addClass(ClassName$5.SHOW);
  4448. if (!callback) {
  4449. return;
  4450. }
  4451. if (!animate) {
  4452. callback();
  4453. return;
  4454. }
  4455. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4456. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4457. } else if (!this._isShown && this._backdrop) {
  4458. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4459. var callbackRemove = function callbackRemove() {
  4460. _this9._removeBackdrop();
  4461. if (callback) {
  4462. callback();
  4463. }
  4464. };
  4465. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4466. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4467. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4468. } else {
  4469. callbackRemove();
  4470. }
  4471. } else if (callback) {
  4472. callback();
  4473. }
  4474. } // ----------------------------------------------------------------------
  4475. // the following methods are used to handle overflowing modals
  4476. // todo (fat): these should probably be refactored out of modal.js
  4477. // ----------------------------------------------------------------------
  4478. ;
  4479. _proto._adjustDialog = function _adjustDialog() {
  4480. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4481. if (!this._isBodyOverflowing && isModalOverflowing) {
  4482. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4483. }
  4484. if (this._isBodyOverflowing && !isModalOverflowing) {
  4485. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4486. }
  4487. };
  4488. _proto._resetAdjustments = function _resetAdjustments() {
  4489. this._element.style.paddingLeft = '';
  4490. this._element.style.paddingRight = '';
  4491. };
  4492. _proto._checkScrollbar = function _checkScrollbar() {
  4493. var rect = document.body.getBoundingClientRect();
  4494. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4495. this._scrollbarWidth = this._getScrollbarWidth();
  4496. };
  4497. _proto._setScrollbar = function _setScrollbar() {
  4498. var _this10 = this;
  4499. if (this._isBodyOverflowing) {
  4500. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4501. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4502. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4503. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4504. $(fixedContent).each(function (index, element) {
  4505. var actualPadding = element.style.paddingRight;
  4506. var calculatedPadding = $(element).css('padding-right');
  4507. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4508. }); // Adjust sticky content margin
  4509. $(stickyContent).each(function (index, element) {
  4510. var actualMargin = element.style.marginRight;
  4511. var calculatedMargin = $(element).css('margin-right');
  4512. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4513. }); // Adjust body padding
  4514. var actualPadding = document.body.style.paddingRight;
  4515. var calculatedPadding = $(document.body).css('padding-right');
  4516. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4517. }
  4518. $(document.body).addClass(ClassName$5.OPEN);
  4519. };
  4520. _proto._resetScrollbar = function _resetScrollbar() {
  4521. // Restore fixed content padding
  4522. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4523. $(fixedContent).each(function (index, element) {
  4524. var padding = $(element).data('padding-right');
  4525. $(element).removeData('padding-right');
  4526. element.style.paddingRight = padding ? padding : '';
  4527. }); // Restore sticky content
  4528. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4529. $(elements).each(function (index, element) {
  4530. var margin = $(element).data('margin-right');
  4531. if (typeof margin !== 'undefined') {
  4532. $(element).css('margin-right', margin).removeData('margin-right');
  4533. }
  4534. }); // Restore body padding
  4535. var padding = $(document.body).data('padding-right');
  4536. $(document.body).removeData('padding-right');
  4537. document.body.style.paddingRight = padding ? padding : '';
  4538. };
  4539. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4540. // thx d.walsh
  4541. var scrollDiv = document.createElement('div');
  4542. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4543. document.body.appendChild(scrollDiv);
  4544. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4545. document.body.removeChild(scrollDiv);
  4546. return scrollbarWidth;
  4547. } // Static
  4548. ;
  4549. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4550. return this.each(function () {
  4551. var data = $(this).data(DATA_KEY$5);
  4552. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4553. if (!data) {
  4554. data = new Modal(this, _config);
  4555. $(this).data(DATA_KEY$5, data);
  4556. }
  4557. if (typeof config === 'string') {
  4558. if (typeof data[config] === 'undefined') {
  4559. throw new TypeError("No method named \"" + config + "\"");
  4560. }
  4561. data[config](relatedTarget);
  4562. } else if (_config.show) {
  4563. data.show(relatedTarget);
  4564. }
  4565. });
  4566. };
  4567. _createClass(Modal, null, [{
  4568. key: "VERSION",
  4569. get: function get() {
  4570. return VERSION$5;
  4571. }
  4572. }, {
  4573. key: "Default",
  4574. get: function get() {
  4575. return Default$3;
  4576. }
  4577. }]);
  4578. return Modal;
  4579. }();
  4580. /**
  4581. * ------------------------------------------------------------------------
  4582. * Data Api implementation
  4583. * ------------------------------------------------------------------------
  4584. */
  4585. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4586. var _this11 = this;
  4587. var target;
  4588. var selector = Util.getSelectorFromElement(this);
  4589. if (selector) {
  4590. target = document.querySelector(selector);
  4591. }
  4592. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4593. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4594. event.preventDefault();
  4595. }
  4596. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4597. if (showEvent.isDefaultPrevented()) {
  4598. // Only register focus restorer if modal will actually get shown
  4599. return;
  4600. }
  4601. $target.one(Event$5.HIDDEN, function () {
  4602. if ($(_this11).is(':visible')) {
  4603. _this11.focus();
  4604. }
  4605. });
  4606. });
  4607. Modal._jQueryInterface.call($(target), config, this);
  4608. });
  4609. /**
  4610. * ------------------------------------------------------------------------
  4611. * jQuery
  4612. * ------------------------------------------------------------------------
  4613. */
  4614. $.fn[NAME$5] = Modal._jQueryInterface;
  4615. $.fn[NAME$5].Constructor = Modal;
  4616. $.fn[NAME$5].noConflict = function () {
  4617. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4618. return Modal._jQueryInterface;
  4619. };
  4620. /**
  4621. * --------------------------------------------------------------------------
  4622. * Bootstrap (v4.4.1): tools/sanitizer.js
  4623. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4624. * --------------------------------------------------------------------------
  4625. */
  4626. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4627. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4628. var DefaultWhitelist = {
  4629. // Global attributes allowed on any supplied element below.
  4630. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4631. a: ['target', 'href', 'title', 'rel'],
  4632. area: [],
  4633. b: [],
  4634. br: [],
  4635. col: [],
  4636. code: [],
  4637. div: [],
  4638. em: [],
  4639. hr: [],
  4640. h1: [],
  4641. h2: [],
  4642. h3: [],
  4643. h4: [],
  4644. h5: [],
  4645. h6: [],
  4646. i: [],
  4647. img: ['src', 'alt', 'title', 'width', 'height'],
  4648. li: [],
  4649. ol: [],
  4650. p: [],
  4651. pre: [],
  4652. s: [],
  4653. small: [],
  4654. span: [],
  4655. sub: [],
  4656. sup: [],
  4657. strong: [],
  4658. u: [],
  4659. ul: []
  4660. };
  4661. /**
  4662. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4663. *
  4664. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4665. */
  4666. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4667. /**
  4668. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4669. *
  4670. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4671. */
  4672. 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;
  4673. function allowedAttribute(attr, allowedAttributeList) {
  4674. var attrName = attr.nodeName.toLowerCase();
  4675. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4676. if (uriAttrs.indexOf(attrName) !== -1) {
  4677. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4678. }
  4679. return true;
  4680. }
  4681. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4682. return attrRegex instanceof RegExp;
  4683. }); // Check if a regular expression validates the attribute.
  4684. for (var i = 0, l = regExp.length; i < l; i++) {
  4685. if (attrName.match(regExp[i])) {
  4686. return true;
  4687. }
  4688. }
  4689. return false;
  4690. }
  4691. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4692. if (unsafeHtml.length === 0) {
  4693. return unsafeHtml;
  4694. }
  4695. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4696. return sanitizeFn(unsafeHtml);
  4697. }
  4698. var domParser = new window.DOMParser();
  4699. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4700. var whitelistKeys = Object.keys(whiteList);
  4701. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4702. var _loop = function _loop(i, len) {
  4703. var el = elements[i];
  4704. var elName = el.nodeName.toLowerCase();
  4705. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4706. el.parentNode.removeChild(el);
  4707. return "continue";
  4708. }
  4709. var attributeList = [].slice.call(el.attributes);
  4710. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4711. attributeList.forEach(function (attr) {
  4712. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4713. el.removeAttribute(attr.nodeName);
  4714. }
  4715. });
  4716. };
  4717. for (var i = 0, len = elements.length; i < len; i++) {
  4718. var _ret = _loop(i);
  4719. if (_ret === "continue") continue;
  4720. }
  4721. return createdDocument.body.innerHTML;
  4722. }
  4723. /**
  4724. * ------------------------------------------------------------------------
  4725. * Constants
  4726. * ------------------------------------------------------------------------
  4727. */
  4728. var NAME$6 = 'tooltip';
  4729. var VERSION$6 = '4.4.1';
  4730. var DATA_KEY$6 = 'bs.tooltip';
  4731. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4732. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4733. var CLASS_PREFIX = 'bs-tooltip';
  4734. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4735. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4736. var DefaultType$4 = {
  4737. animation: 'boolean',
  4738. template: 'string',
  4739. title: '(string|element|function)',
  4740. trigger: 'string',
  4741. delay: '(number|object)',
  4742. html: 'boolean',
  4743. selector: '(string|boolean)',
  4744. placement: '(string|function)',
  4745. offset: '(number|string|function)',
  4746. container: '(string|element|boolean)',
  4747. fallbackPlacement: '(string|array)',
  4748. boundary: '(string|element)',
  4749. sanitize: 'boolean',
  4750. sanitizeFn: '(null|function)',
  4751. whiteList: 'object',
  4752. popperConfig: '(null|object)'
  4753. };
  4754. var AttachmentMap$1 = {
  4755. AUTO: 'auto',
  4756. TOP: 'top',
  4757. RIGHT: 'right',
  4758. BOTTOM: 'bottom',
  4759. LEFT: 'left'
  4760. };
  4761. var Default$4 = {
  4762. animation: true,
  4763. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4764. trigger: 'hover focus',
  4765. title: '',
  4766. delay: 0,
  4767. html: false,
  4768. selector: false,
  4769. placement: 'top',
  4770. offset: 0,
  4771. container: false,
  4772. fallbackPlacement: 'flip',
  4773. boundary: 'scrollParent',
  4774. sanitize: true,
  4775. sanitizeFn: null,
  4776. whiteList: DefaultWhitelist,
  4777. popperConfig: null
  4778. };
  4779. var HoverState = {
  4780. SHOW: 'show',
  4781. OUT: 'out'
  4782. };
  4783. var Event$6 = {
  4784. HIDE: "hide" + EVENT_KEY$6,
  4785. HIDDEN: "hidden" + EVENT_KEY$6,
  4786. SHOW: "show" + EVENT_KEY$6,
  4787. SHOWN: "shown" + EVENT_KEY$6,
  4788. INSERTED: "inserted" + EVENT_KEY$6,
  4789. CLICK: "click" + EVENT_KEY$6,
  4790. FOCUSIN: "focusin" + EVENT_KEY$6,
  4791. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4792. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4793. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4794. };
  4795. var ClassName$6 = {
  4796. FADE: 'fade',
  4797. SHOW: 'show'
  4798. };
  4799. var Selector$6 = {
  4800. TOOLTIP: '.tooltip',
  4801. TOOLTIP_INNER: '.tooltip-inner',
  4802. ARROW: '.arrow'
  4803. };
  4804. var Trigger = {
  4805. HOVER: 'hover',
  4806. FOCUS: 'focus',
  4807. CLICK: 'click',
  4808. MANUAL: 'manual'
  4809. };
  4810. /**
  4811. * ------------------------------------------------------------------------
  4812. * Class Definition
  4813. * ------------------------------------------------------------------------
  4814. */
  4815. var Tooltip =
  4816. /*#__PURE__*/
  4817. function () {
  4818. function Tooltip(element, config) {
  4819. if (typeof Popper === 'undefined') {
  4820. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4821. } // private
  4822. this._isEnabled = true;
  4823. this._timeout = 0;
  4824. this._hoverState = '';
  4825. this._activeTrigger = {};
  4826. this._popper = null; // Protected
  4827. this.element = element;
  4828. this.config = this._getConfig(config);
  4829. this.tip = null;
  4830. this._setListeners();
  4831. } // Getters
  4832. var _proto = Tooltip.prototype;
  4833. // Public
  4834. _proto.enable = function enable() {
  4835. this._isEnabled = true;
  4836. };
  4837. _proto.disable = function disable() {
  4838. this._isEnabled = false;
  4839. };
  4840. _proto.toggleEnabled = function toggleEnabled() {
  4841. this._isEnabled = !this._isEnabled;
  4842. };
  4843. _proto.toggle = function toggle(event) {
  4844. if (!this._isEnabled) {
  4845. return;
  4846. }
  4847. if (event) {
  4848. var dataKey = this.constructor.DATA_KEY;
  4849. var context = $(event.currentTarget).data(dataKey);
  4850. if (!context) {
  4851. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4852. $(event.currentTarget).data(dataKey, context);
  4853. }
  4854. context._activeTrigger.click = !context._activeTrigger.click;
  4855. if (context._isWithActiveTrigger()) {
  4856. context._enter(null, context);
  4857. } else {
  4858. context._leave(null, context);
  4859. }
  4860. } else {
  4861. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4862. this._leave(null, this);
  4863. return;
  4864. }
  4865. this._enter(null, this);
  4866. }
  4867. };
  4868. _proto.dispose = function dispose() {
  4869. clearTimeout(this._timeout);
  4870. $.removeData(this.element, this.constructor.DATA_KEY);
  4871. $(this.element).off(this.constructor.EVENT_KEY);
  4872. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4873. if (this.tip) {
  4874. $(this.tip).remove();
  4875. }
  4876. this._isEnabled = null;
  4877. this._timeout = null;
  4878. this._hoverState = null;
  4879. this._activeTrigger = null;
  4880. if (this._popper) {
  4881. this._popper.destroy();
  4882. }
  4883. this._popper = null;
  4884. this.element = null;
  4885. this.config = null;
  4886. this.tip = null;
  4887. };
  4888. _proto.show = function show() {
  4889. var _this = this;
  4890. if ($(this.element).css('display') === 'none') {
  4891. throw new Error('Please use show on visible elements');
  4892. }
  4893. var showEvent = $.Event(this.constructor.Event.SHOW);
  4894. if (this.isWithContent() && this._isEnabled) {
  4895. $(this.element).trigger(showEvent);
  4896. var shadowRoot = Util.findShadowRoot(this.element);
  4897. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4898. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4899. return;
  4900. }
  4901. var tip = this.getTipElement();
  4902. var tipId = Util.getUID(this.constructor.NAME);
  4903. tip.setAttribute('id', tipId);
  4904. this.element.setAttribute('aria-describedby', tipId);
  4905. this.setContent();
  4906. if (this.config.animation) {
  4907. $(tip).addClass(ClassName$6.FADE);
  4908. }
  4909. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4910. var attachment = this._getAttachment(placement);
  4911. this.addAttachmentClass(attachment);
  4912. var container = this._getContainer();
  4913. $(tip).data(this.constructor.DATA_KEY, this);
  4914. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4915. $(tip).appendTo(container);
  4916. }
  4917. $(this.element).trigger(this.constructor.Event.INSERTED);
  4918. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4919. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4920. // empty mouseover listeners to the body's immediate children;
  4921. // only needed because of broken event delegation on iOS
  4922. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4923. if ('ontouchstart' in document.documentElement) {
  4924. $(document.body).children().on('mouseover', null, $.noop);
  4925. }
  4926. var complete = function complete() {
  4927. if (_this.config.animation) {
  4928. _this._fixTransition();
  4929. }
  4930. var prevHoverState = _this._hoverState;
  4931. _this._hoverState = null;
  4932. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4933. if (prevHoverState === HoverState.OUT) {
  4934. _this._leave(null, _this);
  4935. }
  4936. };
  4937. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4938. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4939. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4940. } else {
  4941. complete();
  4942. }
  4943. }
  4944. };
  4945. _proto.hide = function hide(callback) {
  4946. var _this2 = this;
  4947. var tip = this.getTipElement();
  4948. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4949. var complete = function complete() {
  4950. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4951. tip.parentNode.removeChild(tip);
  4952. }
  4953. _this2._cleanTipClass();
  4954. _this2.element.removeAttribute('aria-describedby');
  4955. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4956. if (_this2._popper !== null) {
  4957. _this2._popper.destroy();
  4958. }
  4959. if (callback) {
  4960. callback();
  4961. }
  4962. };
  4963. $(this.element).trigger(hideEvent);
  4964. if (hideEvent.isDefaultPrevented()) {
  4965. return;
  4966. }
  4967. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4968. // empty mouseover listeners we added for iOS support
  4969. if ('ontouchstart' in document.documentElement) {
  4970. $(document.body).children().off('mouseover', null, $.noop);
  4971. }
  4972. this._activeTrigger[Trigger.CLICK] = false;
  4973. this._activeTrigger[Trigger.FOCUS] = false;
  4974. this._activeTrigger[Trigger.HOVER] = false;
  4975. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4976. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4977. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4978. } else {
  4979. complete();
  4980. }
  4981. this._hoverState = '';
  4982. };
  4983. _proto.update = function update() {
  4984. if (this._popper !== null) {
  4985. this._popper.scheduleUpdate();
  4986. }
  4987. } // Protected
  4988. ;
  4989. _proto.isWithContent = function isWithContent() {
  4990. return Boolean(this.getTitle());
  4991. };
  4992. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4993. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4994. };
  4995. _proto.getTipElement = function getTipElement() {
  4996. this.tip = this.tip || $(this.config.template)[0];
  4997. return this.tip;
  4998. };
  4999. _proto.setContent = function setContent() {
  5000. var tip = this.getTipElement();
  5001. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5002. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5003. };
  5004. _proto.setElementContent = function setElementContent($element, content) {
  5005. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5006. // Content is a DOM node or a jQuery
  5007. if (this.config.html) {
  5008. if (!$(content).parent().is($element)) {
  5009. $element.empty().append(content);
  5010. }
  5011. } else {
  5012. $element.text($(content).text());
  5013. }
  5014. return;
  5015. }
  5016. if (this.config.html) {
  5017. if (this.config.sanitize) {
  5018. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5019. }
  5020. $element.html(content);
  5021. } else {
  5022. $element.text(content);
  5023. }
  5024. };
  5025. _proto.getTitle = function getTitle() {
  5026. var title = this.element.getAttribute('data-original-title');
  5027. if (!title) {
  5028. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5029. }
  5030. return title;
  5031. } // Private
  5032. ;
  5033. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5034. var _this3 = this;
  5035. var defaultBsConfig = {
  5036. placement: attachment,
  5037. modifiers: {
  5038. offset: this._getOffset(),
  5039. flip: {
  5040. behavior: this.config.fallbackPlacement
  5041. },
  5042. arrow: {
  5043. element: Selector$6.ARROW
  5044. },
  5045. preventOverflow: {
  5046. boundariesElement: this.config.boundary
  5047. }
  5048. },
  5049. onCreate: function onCreate(data) {
  5050. if (data.originalPlacement !== data.placement) {
  5051. _this3._handlePopperPlacementChange(data);
  5052. }
  5053. },
  5054. onUpdate: function onUpdate(data) {
  5055. return _this3._handlePopperPlacementChange(data);
  5056. }
  5057. };
  5058. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5059. };
  5060. _proto._getOffset = function _getOffset() {
  5061. var _this4 = this;
  5062. var offset = {};
  5063. if (typeof this.config.offset === 'function') {
  5064. offset.fn = function (data) {
  5065. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5066. return data;
  5067. };
  5068. } else {
  5069. offset.offset = this.config.offset;
  5070. }
  5071. return offset;
  5072. };
  5073. _proto._getContainer = function _getContainer() {
  5074. if (this.config.container === false) {
  5075. return document.body;
  5076. }
  5077. if (Util.isElement(this.config.container)) {
  5078. return $(this.config.container);
  5079. }
  5080. return $(document).find(this.config.container);
  5081. };
  5082. _proto._getAttachment = function _getAttachment(placement) {
  5083. return AttachmentMap$1[placement.toUpperCase()];
  5084. };
  5085. _proto._setListeners = function _setListeners() {
  5086. var _this5 = this;
  5087. var triggers = this.config.trigger.split(' ');
  5088. triggers.forEach(function (trigger) {
  5089. if (trigger === 'click') {
  5090. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5091. return _this5.toggle(event);
  5092. });
  5093. } else if (trigger !== Trigger.MANUAL) {
  5094. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5095. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5096. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5097. return _this5._enter(event);
  5098. }).on(eventOut, _this5.config.selector, function (event) {
  5099. return _this5._leave(event);
  5100. });
  5101. }
  5102. });
  5103. this._hideModalHandler = function () {
  5104. if (_this5.element) {
  5105. _this5.hide();
  5106. }
  5107. };
  5108. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5109. if (this.config.selector) {
  5110. this.config = _objectSpread2({}, this.config, {
  5111. trigger: 'manual',
  5112. selector: ''
  5113. });
  5114. } else {
  5115. this._fixTitle();
  5116. }
  5117. };
  5118. _proto._fixTitle = function _fixTitle() {
  5119. var titleType = typeof this.element.getAttribute('data-original-title');
  5120. if (this.element.getAttribute('title') || titleType !== 'string') {
  5121. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5122. this.element.setAttribute('title', '');
  5123. }
  5124. };
  5125. _proto._enter = function _enter(event, context) {
  5126. var dataKey = this.constructor.DATA_KEY;
  5127. context = context || $(event.currentTarget).data(dataKey);
  5128. if (!context) {
  5129. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5130. $(event.currentTarget).data(dataKey, context);
  5131. }
  5132. if (event) {
  5133. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5134. }
  5135. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5136. context._hoverState = HoverState.SHOW;
  5137. return;
  5138. }
  5139. clearTimeout(context._timeout);
  5140. context._hoverState = HoverState.SHOW;
  5141. if (!context.config.delay || !context.config.delay.show) {
  5142. context.show();
  5143. return;
  5144. }
  5145. context._timeout = setTimeout(function () {
  5146. if (context._hoverState === HoverState.SHOW) {
  5147. context.show();
  5148. }
  5149. }, context.config.delay.show);
  5150. };
  5151. _proto._leave = function _leave(event, context) {
  5152. var dataKey = this.constructor.DATA_KEY;
  5153. context = context || $(event.currentTarget).data(dataKey);
  5154. if (!context) {
  5155. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5156. $(event.currentTarget).data(dataKey, context);
  5157. }
  5158. if (event) {
  5159. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5160. }
  5161. if (context._isWithActiveTrigger()) {
  5162. return;
  5163. }
  5164. clearTimeout(context._timeout);
  5165. context._hoverState = HoverState.OUT;
  5166. if (!context.config.delay || !context.config.delay.hide) {
  5167. context.hide();
  5168. return;
  5169. }
  5170. context._timeout = setTimeout(function () {
  5171. if (context._hoverState === HoverState.OUT) {
  5172. context.hide();
  5173. }
  5174. }, context.config.delay.hide);
  5175. };
  5176. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5177. for (var trigger in this._activeTrigger) {
  5178. if (this._activeTrigger[trigger]) {
  5179. return true;
  5180. }
  5181. }
  5182. return false;
  5183. };
  5184. _proto._getConfig = function _getConfig(config) {
  5185. var dataAttributes = $(this.element).data();
  5186. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5187. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5188. delete dataAttributes[dataAttr];
  5189. }
  5190. });
  5191. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5192. if (typeof config.delay === 'number') {
  5193. config.delay = {
  5194. show: config.delay,
  5195. hide: config.delay
  5196. };
  5197. }
  5198. if (typeof config.title === 'number') {
  5199. config.title = config.title.toString();
  5200. }
  5201. if (typeof config.content === 'number') {
  5202. config.content = config.content.toString();
  5203. }
  5204. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5205. if (config.sanitize) {
  5206. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5207. }
  5208. return config;
  5209. };
  5210. _proto._getDelegateConfig = function _getDelegateConfig() {
  5211. var config = {};
  5212. if (this.config) {
  5213. for (var key in this.config) {
  5214. if (this.constructor.Default[key] !== this.config[key]) {
  5215. config[key] = this.config[key];
  5216. }
  5217. }
  5218. }
  5219. return config;
  5220. };
  5221. _proto._cleanTipClass = function _cleanTipClass() {
  5222. var $tip = $(this.getTipElement());
  5223. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5224. if (tabClass !== null && tabClass.length) {
  5225. $tip.removeClass(tabClass.join(''));
  5226. }
  5227. };
  5228. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5229. var popperInstance = popperData.instance;
  5230. this.tip = popperInstance.popper;
  5231. this._cleanTipClass();
  5232. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5233. };
  5234. _proto._fixTransition = function _fixTransition() {
  5235. var tip = this.getTipElement();
  5236. var initConfigAnimation = this.config.animation;
  5237. if (tip.getAttribute('x-placement') !== null) {
  5238. return;
  5239. }
  5240. $(tip).removeClass(ClassName$6.FADE);
  5241. this.config.animation = false;
  5242. this.hide();
  5243. this.show();
  5244. this.config.animation = initConfigAnimation;
  5245. } // Static
  5246. ;
  5247. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5248. return this.each(function () {
  5249. var data = $(this).data(DATA_KEY$6);
  5250. var _config = typeof config === 'object' && config;
  5251. if (!data && /dispose|hide/.test(config)) {
  5252. return;
  5253. }
  5254. if (!data) {
  5255. data = new Tooltip(this, _config);
  5256. $(this).data(DATA_KEY$6, data);
  5257. }
  5258. if (typeof config === 'string') {
  5259. if (typeof data[config] === 'undefined') {
  5260. throw new TypeError("No method named \"" + config + "\"");
  5261. }
  5262. data[config]();
  5263. }
  5264. });
  5265. };
  5266. _createClass(Tooltip, null, [{
  5267. key: "VERSION",
  5268. get: function get() {
  5269. return VERSION$6;
  5270. }
  5271. }, {
  5272. key: "Default",
  5273. get: function get() {
  5274. return Default$4;
  5275. }
  5276. }, {
  5277. key: "NAME",
  5278. get: function get() {
  5279. return NAME$6;
  5280. }
  5281. }, {
  5282. key: "DATA_KEY",
  5283. get: function get() {
  5284. return DATA_KEY$6;
  5285. }
  5286. }, {
  5287. key: "Event",
  5288. get: function get() {
  5289. return Event$6;
  5290. }
  5291. }, {
  5292. key: "EVENT_KEY",
  5293. get: function get() {
  5294. return EVENT_KEY$6;
  5295. }
  5296. }, {
  5297. key: "DefaultType",
  5298. get: function get() {
  5299. return DefaultType$4;
  5300. }
  5301. }]);
  5302. return Tooltip;
  5303. }();
  5304. /**
  5305. * ------------------------------------------------------------------------
  5306. * jQuery
  5307. * ------------------------------------------------------------------------
  5308. */
  5309. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5310. $.fn[NAME$6].Constructor = Tooltip;
  5311. $.fn[NAME$6].noConflict = function () {
  5312. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5313. return Tooltip._jQueryInterface;
  5314. };
  5315. /**
  5316. * ------------------------------------------------------------------------
  5317. * Constants
  5318. * ------------------------------------------------------------------------
  5319. */
  5320. var NAME$7 = 'popover';
  5321. var VERSION$7 = '4.4.1';
  5322. var DATA_KEY$7 = 'bs.popover';
  5323. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5324. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5325. var CLASS_PREFIX$1 = 'bs-popover';
  5326. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5327. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5328. placement: 'right',
  5329. trigger: 'click',
  5330. content: '',
  5331. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5332. });
  5333. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5334. content: '(string|element|function)'
  5335. });
  5336. var ClassName$7 = {
  5337. FADE: 'fade',
  5338. SHOW: 'show'
  5339. };
  5340. var Selector$7 = {
  5341. TITLE: '.popover-header',
  5342. CONTENT: '.popover-body'
  5343. };
  5344. var Event$7 = {
  5345. HIDE: "hide" + EVENT_KEY$7,
  5346. HIDDEN: "hidden" + EVENT_KEY$7,
  5347. SHOW: "show" + EVENT_KEY$7,
  5348. SHOWN: "shown" + EVENT_KEY$7,
  5349. INSERTED: "inserted" + EVENT_KEY$7,
  5350. CLICK: "click" + EVENT_KEY$7,
  5351. FOCUSIN: "focusin" + EVENT_KEY$7,
  5352. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5353. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5354. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5355. };
  5356. /**
  5357. * ------------------------------------------------------------------------
  5358. * Class Definition
  5359. * ------------------------------------------------------------------------
  5360. */
  5361. var Popover =
  5362. /*#__PURE__*/
  5363. function (_Tooltip) {
  5364. _inheritsLoose(Popover, _Tooltip);
  5365. function Popover() {
  5366. return _Tooltip.apply(this, arguments) || this;
  5367. }
  5368. var _proto = Popover.prototype;
  5369. // Overrides
  5370. _proto.isWithContent = function isWithContent() {
  5371. return this.getTitle() || this._getContent();
  5372. };
  5373. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5374. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5375. };
  5376. _proto.getTipElement = function getTipElement() {
  5377. this.tip = this.tip || $(this.config.template)[0];
  5378. return this.tip;
  5379. };
  5380. _proto.setContent = function setContent() {
  5381. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5382. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5383. var content = this._getContent();
  5384. if (typeof content === 'function') {
  5385. content = content.call(this.element);
  5386. }
  5387. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5388. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5389. } // Private
  5390. ;
  5391. _proto._getContent = function _getContent() {
  5392. return this.element.getAttribute('data-content') || this.config.content;
  5393. };
  5394. _proto._cleanTipClass = function _cleanTipClass() {
  5395. var $tip = $(this.getTipElement());
  5396. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5397. if (tabClass !== null && tabClass.length > 0) {
  5398. $tip.removeClass(tabClass.join(''));
  5399. }
  5400. } // Static
  5401. ;
  5402. Popover._jQueryInterface = function _jQueryInterface(config) {
  5403. return this.each(function () {
  5404. var data = $(this).data(DATA_KEY$7);
  5405. var _config = typeof config === 'object' ? config : null;
  5406. if (!data && /dispose|hide/.test(config)) {
  5407. return;
  5408. }
  5409. if (!data) {
  5410. data = new Popover(this, _config);
  5411. $(this).data(DATA_KEY$7, data);
  5412. }
  5413. if (typeof config === 'string') {
  5414. if (typeof data[config] === 'undefined') {
  5415. throw new TypeError("No method named \"" + config + "\"");
  5416. }
  5417. data[config]();
  5418. }
  5419. });
  5420. };
  5421. _createClass(Popover, null, [{
  5422. key: "VERSION",
  5423. // Getters
  5424. get: function get() {
  5425. return VERSION$7;
  5426. }
  5427. }, {
  5428. key: "Default",
  5429. get: function get() {
  5430. return Default$5;
  5431. }
  5432. }, {
  5433. key: "NAME",
  5434. get: function get() {
  5435. return NAME$7;
  5436. }
  5437. }, {
  5438. key: "DATA_KEY",
  5439. get: function get() {
  5440. return DATA_KEY$7;
  5441. }
  5442. }, {
  5443. key: "Event",
  5444. get: function get() {
  5445. return Event$7;
  5446. }
  5447. }, {
  5448. key: "EVENT_KEY",
  5449. get: function get() {
  5450. return EVENT_KEY$7;
  5451. }
  5452. }, {
  5453. key: "DefaultType",
  5454. get: function get() {
  5455. return DefaultType$5;
  5456. }
  5457. }]);
  5458. return Popover;
  5459. }(Tooltip);
  5460. /**
  5461. * ------------------------------------------------------------------------
  5462. * jQuery
  5463. * ------------------------------------------------------------------------
  5464. */
  5465. $.fn[NAME$7] = Popover._jQueryInterface;
  5466. $.fn[NAME$7].Constructor = Popover;
  5467. $.fn[NAME$7].noConflict = function () {
  5468. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5469. return Popover._jQueryInterface;
  5470. };
  5471. /**
  5472. * ------------------------------------------------------------------------
  5473. * Constants
  5474. * ------------------------------------------------------------------------
  5475. */
  5476. var NAME$8 = 'scrollspy';
  5477. var VERSION$8 = '4.4.1';
  5478. var DATA_KEY$8 = 'bs.scrollspy';
  5479. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5480. var DATA_API_KEY$6 = '.data-api';
  5481. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5482. var Default$6 = {
  5483. offset: 10,
  5484. method: 'auto',
  5485. target: ''
  5486. };
  5487. var DefaultType$6 = {
  5488. offset: 'number',
  5489. method: 'string',
  5490. target: '(string|element)'
  5491. };
  5492. var Event$8 = {
  5493. ACTIVATE: "activate" + EVENT_KEY$8,
  5494. SCROLL: "scroll" + EVENT_KEY$8,
  5495. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5496. };
  5497. var ClassName$8 = {
  5498. DROPDOWN_ITEM: 'dropdown-item',
  5499. DROPDOWN_MENU: 'dropdown-menu',
  5500. ACTIVE: 'active'
  5501. };
  5502. var Selector$8 = {
  5503. DATA_SPY: '[data-spy="scroll"]',
  5504. ACTIVE: '.active',
  5505. NAV_LIST_GROUP: '.nav, .list-group',
  5506. NAV_LINKS: '.nav-link',
  5507. NAV_ITEMS: '.nav-item',
  5508. LIST_ITEMS: '.list-group-item',
  5509. DROPDOWN: '.dropdown',
  5510. DROPDOWN_ITEMS: '.dropdown-item',
  5511. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5512. };
  5513. var OffsetMethod = {
  5514. OFFSET: 'offset',
  5515. POSITION: 'position'
  5516. };
  5517. /**
  5518. * ------------------------------------------------------------------------
  5519. * Class Definition
  5520. * ------------------------------------------------------------------------
  5521. */
  5522. var ScrollSpy =
  5523. /*#__PURE__*/
  5524. function () {
  5525. function ScrollSpy(element, config) {
  5526. var _this = this;
  5527. this._element = element;
  5528. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5529. this._config = this._getConfig(config);
  5530. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5531. this._offsets = [];
  5532. this._targets = [];
  5533. this._activeTarget = null;
  5534. this._scrollHeight = 0;
  5535. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5536. return _this._process(event);
  5537. });
  5538. this.refresh();
  5539. this._process();
  5540. } // Getters
  5541. var _proto = ScrollSpy.prototype;
  5542. // Public
  5543. _proto.refresh = function refresh() {
  5544. var _this2 = this;
  5545. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5546. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5547. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5548. this._offsets = [];
  5549. this._targets = [];
  5550. this._scrollHeight = this._getScrollHeight();
  5551. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5552. targets.map(function (element) {
  5553. var target;
  5554. var targetSelector = Util.getSelectorFromElement(element);
  5555. if (targetSelector) {
  5556. target = document.querySelector(targetSelector);
  5557. }
  5558. if (target) {
  5559. var targetBCR = target.getBoundingClientRect();
  5560. if (targetBCR.width || targetBCR.height) {
  5561. // TODO (fat): remove sketch reliance on jQuery position/offset
  5562. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5563. }
  5564. }
  5565. return null;
  5566. }).filter(function (item) {
  5567. return item;
  5568. }).sort(function (a, b) {
  5569. return a[0] - b[0];
  5570. }).forEach(function (item) {
  5571. _this2._offsets.push(item[0]);
  5572. _this2._targets.push(item[1]);
  5573. });
  5574. };
  5575. _proto.dispose = function dispose() {
  5576. $.removeData(this._element, DATA_KEY$8);
  5577. $(this._scrollElement).off(EVENT_KEY$8);
  5578. this._element = null;
  5579. this._scrollElement = null;
  5580. this._config = null;
  5581. this._selector = null;
  5582. this._offsets = null;
  5583. this._targets = null;
  5584. this._activeTarget = null;
  5585. this._scrollHeight = null;
  5586. } // Private
  5587. ;
  5588. _proto._getConfig = function _getConfig(config) {
  5589. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5590. if (typeof config.target !== 'string') {
  5591. var id = $(config.target).attr('id');
  5592. if (!id) {
  5593. id = Util.getUID(NAME$8);
  5594. $(config.target).attr('id', id);
  5595. }
  5596. config.target = "#" + id;
  5597. }
  5598. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5599. return config;
  5600. };
  5601. _proto._getScrollTop = function _getScrollTop() {
  5602. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5603. };
  5604. _proto._getScrollHeight = function _getScrollHeight() {
  5605. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5606. };
  5607. _proto._getOffsetHeight = function _getOffsetHeight() {
  5608. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5609. };
  5610. _proto._process = function _process() {
  5611. var scrollTop = this._getScrollTop() + this._config.offset;
  5612. var scrollHeight = this._getScrollHeight();
  5613. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5614. if (this._scrollHeight !== scrollHeight) {
  5615. this.refresh();
  5616. }
  5617. if (scrollTop >= maxScroll) {
  5618. var target = this._targets[this._targets.length - 1];
  5619. if (this._activeTarget !== target) {
  5620. this._activate(target);
  5621. }
  5622. return;
  5623. }
  5624. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5625. this._activeTarget = null;
  5626. this._clear();
  5627. return;
  5628. }
  5629. var offsetLength = this._offsets.length;
  5630. for (var i = offsetLength; i--;) {
  5631. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5632. if (isActiveTarget) {
  5633. this._activate(this._targets[i]);
  5634. }
  5635. }
  5636. };
  5637. _proto._activate = function _activate(target) {
  5638. this._activeTarget = target;
  5639. this._clear();
  5640. var queries = this._selector.split(',').map(function (selector) {
  5641. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5642. });
  5643. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5644. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5645. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5646. $link.addClass(ClassName$8.ACTIVE);
  5647. } else {
  5648. // Set triggered link as active
  5649. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5650. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5651. $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
  5652. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5653. }
  5654. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5655. relatedTarget: target
  5656. });
  5657. };
  5658. _proto._clear = function _clear() {
  5659. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5660. return node.classList.contains(ClassName$8.ACTIVE);
  5661. }).forEach(function (node) {
  5662. return node.classList.remove(ClassName$8.ACTIVE);
  5663. });
  5664. } // Static
  5665. ;
  5666. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5667. return this.each(function () {
  5668. var data = $(this).data(DATA_KEY$8);
  5669. var _config = typeof config === 'object' && config;
  5670. if (!data) {
  5671. data = new ScrollSpy(this, _config);
  5672. $(this).data(DATA_KEY$8, data);
  5673. }
  5674. if (typeof config === 'string') {
  5675. if (typeof data[config] === 'undefined') {
  5676. throw new TypeError("No method named \"" + config + "\"");
  5677. }
  5678. data[config]();
  5679. }
  5680. });
  5681. };
  5682. _createClass(ScrollSpy, null, [{
  5683. key: "VERSION",
  5684. get: function get() {
  5685. return VERSION$8;
  5686. }
  5687. }, {
  5688. key: "Default",
  5689. get: function get() {
  5690. return Default$6;
  5691. }
  5692. }]);
  5693. return ScrollSpy;
  5694. }();
  5695. /**
  5696. * ------------------------------------------------------------------------
  5697. * Data Api implementation
  5698. * ------------------------------------------------------------------------
  5699. */
  5700. $(window).on(Event$8.LOAD_DATA_API, function () {
  5701. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5702. var scrollSpysLength = scrollSpys.length;
  5703. for (var i = scrollSpysLength; i--;) {
  5704. var $spy = $(scrollSpys[i]);
  5705. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5706. }
  5707. });
  5708. /**
  5709. * ------------------------------------------------------------------------
  5710. * jQuery
  5711. * ------------------------------------------------------------------------
  5712. */
  5713. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5714. $.fn[NAME$8].Constructor = ScrollSpy;
  5715. $.fn[NAME$8].noConflict = function () {
  5716. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5717. return ScrollSpy._jQueryInterface;
  5718. };
  5719. /**
  5720. * ------------------------------------------------------------------------
  5721. * Constants
  5722. * ------------------------------------------------------------------------
  5723. */
  5724. var NAME$9 = 'tab';
  5725. var VERSION$9 = '4.4.1';
  5726. var DATA_KEY$9 = 'bs.tab';
  5727. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5728. var DATA_API_KEY$7 = '.data-api';
  5729. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5730. var Event$9 = {
  5731. HIDE: "hide" + EVENT_KEY$9,
  5732. HIDDEN: "hidden" + EVENT_KEY$9,
  5733. SHOW: "show" + EVENT_KEY$9,
  5734. SHOWN: "shown" + EVENT_KEY$9,
  5735. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5736. };
  5737. var ClassName$9 = {
  5738. DROPDOWN_MENU: 'dropdown-menu',
  5739. ACTIVE: 'active',
  5740. DISABLED: 'disabled',
  5741. FADE: 'fade',
  5742. SHOW: 'show'
  5743. };
  5744. var Selector$9 = {
  5745. DROPDOWN: '.dropdown',
  5746. NAV_LIST_GROUP: '.nav, .list-group',
  5747. ACTIVE: '.active',
  5748. ACTIVE_UL: '> li > .active',
  5749. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5750. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5751. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5752. };
  5753. /**
  5754. * ------------------------------------------------------------------------
  5755. * Class Definition
  5756. * ------------------------------------------------------------------------
  5757. */
  5758. var Tab =
  5759. /*#__PURE__*/
  5760. function () {
  5761. function Tab(element) {
  5762. this._element = element;
  5763. } // Getters
  5764. var _proto = Tab.prototype;
  5765. // Public
  5766. _proto.show = function show() {
  5767. var _this = this;
  5768. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5769. return;
  5770. }
  5771. var target;
  5772. var previous;
  5773. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5774. var selector = Util.getSelectorFromElement(this._element);
  5775. if (listElement) {
  5776. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5777. previous = $.makeArray($(listElement).find(itemSelector));
  5778. previous = previous[previous.length - 1];
  5779. }
  5780. var hideEvent = $.Event(Event$9.HIDE, {
  5781. relatedTarget: this._element
  5782. });
  5783. var showEvent = $.Event(Event$9.SHOW, {
  5784. relatedTarget: previous
  5785. });
  5786. if (previous) {
  5787. $(previous).trigger(hideEvent);
  5788. }
  5789. $(this._element).trigger(showEvent);
  5790. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5791. return;
  5792. }
  5793. if (selector) {
  5794. target = document.querySelector(selector);
  5795. }
  5796. this._activate(this._element, listElement);
  5797. var complete = function complete() {
  5798. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5799. relatedTarget: _this._element
  5800. });
  5801. var shownEvent = $.Event(Event$9.SHOWN, {
  5802. relatedTarget: previous
  5803. });
  5804. $(previous).trigger(hiddenEvent);
  5805. $(_this._element).trigger(shownEvent);
  5806. };
  5807. if (target) {
  5808. this._activate(target, target.parentNode, complete);
  5809. } else {
  5810. complete();
  5811. }
  5812. };
  5813. _proto.dispose = function dispose() {
  5814. $.removeData(this._element, DATA_KEY$9);
  5815. this._element = null;
  5816. } // Private
  5817. ;
  5818. _proto._activate = function _activate(element, container, callback) {
  5819. var _this2 = this;
  5820. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5821. var active = activeElements[0];
  5822. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5823. var complete = function complete() {
  5824. return _this2._transitionComplete(element, active, callback);
  5825. };
  5826. if (active && isTransitioning) {
  5827. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5828. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5829. } else {
  5830. complete();
  5831. }
  5832. };
  5833. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5834. if (active) {
  5835. $(active).removeClass(ClassName$9.ACTIVE);
  5836. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5837. if (dropdownChild) {
  5838. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5839. }
  5840. if (active.getAttribute('role') === 'tab') {
  5841. active.setAttribute('aria-selected', false);
  5842. }
  5843. }
  5844. $(element).addClass(ClassName$9.ACTIVE);
  5845. if (element.getAttribute('role') === 'tab') {
  5846. element.setAttribute('aria-selected', true);
  5847. }
  5848. Util.reflow(element);
  5849. if (element.classList.contains(ClassName$9.FADE)) {
  5850. element.classList.add(ClassName$9.SHOW);
  5851. }
  5852. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5853. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5854. if (dropdownElement) {
  5855. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5856. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5857. }
  5858. element.setAttribute('aria-expanded', true);
  5859. }
  5860. if (callback) {
  5861. callback();
  5862. }
  5863. } // Static
  5864. ;
  5865. Tab._jQueryInterface = function _jQueryInterface(config) {
  5866. return this.each(function () {
  5867. var $this = $(this);
  5868. var data = $this.data(DATA_KEY$9);
  5869. if (!data) {
  5870. data = new Tab(this);
  5871. $this.data(DATA_KEY$9, data);
  5872. }
  5873. if (typeof config === 'string') {
  5874. if (typeof data[config] === 'undefined') {
  5875. throw new TypeError("No method named \"" + config + "\"");
  5876. }
  5877. data[config]();
  5878. }
  5879. });
  5880. };
  5881. _createClass(Tab, null, [{
  5882. key: "VERSION",
  5883. get: function get() {
  5884. return VERSION$9;
  5885. }
  5886. }]);
  5887. return Tab;
  5888. }();
  5889. /**
  5890. * ------------------------------------------------------------------------
  5891. * Data Api implementation
  5892. * ------------------------------------------------------------------------
  5893. */
  5894. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5895. event.preventDefault();
  5896. Tab._jQueryInterface.call($(this), 'show');
  5897. });
  5898. /**
  5899. * ------------------------------------------------------------------------
  5900. * jQuery
  5901. * ------------------------------------------------------------------------
  5902. */
  5903. $.fn[NAME$9] = Tab._jQueryInterface;
  5904. $.fn[NAME$9].Constructor = Tab;
  5905. $.fn[NAME$9].noConflict = function () {
  5906. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5907. return Tab._jQueryInterface;
  5908. };
  5909. /**
  5910. * ------------------------------------------------------------------------
  5911. * Constants
  5912. * ------------------------------------------------------------------------
  5913. */
  5914. var NAME$a = 'toast';
  5915. var VERSION$a = '4.4.1';
  5916. var DATA_KEY$a = 'bs.toast';
  5917. var EVENT_KEY$a = "." + DATA_KEY$a;
  5918. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5919. var Event$a = {
  5920. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5921. HIDE: "hide" + EVENT_KEY$a,
  5922. HIDDEN: "hidden" + EVENT_KEY$a,
  5923. SHOW: "show" + EVENT_KEY$a,
  5924. SHOWN: "shown" + EVENT_KEY$a
  5925. };
  5926. var ClassName$a = {
  5927. FADE: 'fade',
  5928. HIDE: 'hide',
  5929. SHOW: 'show',
  5930. SHOWING: 'showing'
  5931. };
  5932. var DefaultType$7 = {
  5933. animation: 'boolean',
  5934. autohide: 'boolean',
  5935. delay: 'number'
  5936. };
  5937. var Default$7 = {
  5938. animation: true,
  5939. autohide: true,
  5940. delay: 500
  5941. };
  5942. var Selector$a = {
  5943. DATA_DISMISS: '[data-dismiss="toast"]'
  5944. };
  5945. /**
  5946. * ------------------------------------------------------------------------
  5947. * Class Definition
  5948. * ------------------------------------------------------------------------
  5949. */
  5950. var Toast =
  5951. /*#__PURE__*/
  5952. function () {
  5953. function Toast(element, config) {
  5954. this._element = element;
  5955. this._config = this._getConfig(config);
  5956. this._timeout = null;
  5957. this._setListeners();
  5958. } // Getters
  5959. var _proto = Toast.prototype;
  5960. // Public
  5961. _proto.show = function show() {
  5962. var _this = this;
  5963. var showEvent = $.Event(Event$a.SHOW);
  5964. $(this._element).trigger(showEvent);
  5965. if (showEvent.isDefaultPrevented()) {
  5966. return;
  5967. }
  5968. if (this._config.animation) {
  5969. this._element.classList.add(ClassName$a.FADE);
  5970. }
  5971. var complete = function complete() {
  5972. _this._element.classList.remove(ClassName$a.SHOWING);
  5973. _this._element.classList.add(ClassName$a.SHOW);
  5974. $(_this._element).trigger(Event$a.SHOWN);
  5975. if (_this._config.autohide) {
  5976. _this._timeout = setTimeout(function () {
  5977. _this.hide();
  5978. }, _this._config.delay);
  5979. }
  5980. };
  5981. this._element.classList.remove(ClassName$a.HIDE);
  5982. Util.reflow(this._element);
  5983. this._element.classList.add(ClassName$a.SHOWING);
  5984. if (this._config.animation) {
  5985. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5986. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5987. } else {
  5988. complete();
  5989. }
  5990. };
  5991. _proto.hide = function hide() {
  5992. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5993. return;
  5994. }
  5995. var hideEvent = $.Event(Event$a.HIDE);
  5996. $(this._element).trigger(hideEvent);
  5997. if (hideEvent.isDefaultPrevented()) {
  5998. return;
  5999. }
  6000. this._close();
  6001. };
  6002. _proto.dispose = function dispose() {
  6003. clearTimeout(this._timeout);
  6004. this._timeout = null;
  6005. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6006. this._element.classList.remove(ClassName$a.SHOW);
  6007. }
  6008. $(this._element).off(Event$a.CLICK_DISMISS);
  6009. $.removeData(this._element, DATA_KEY$a);
  6010. this._element = null;
  6011. this._config = null;
  6012. } // Private
  6013. ;
  6014. _proto._getConfig = function _getConfig(config) {
  6015. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6016. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6017. return config;
  6018. };
  6019. _proto._setListeners = function _setListeners() {
  6020. var _this2 = this;
  6021. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6022. return _this2.hide();
  6023. });
  6024. };
  6025. _proto._close = function _close() {
  6026. var _this3 = this;
  6027. var complete = function complete() {
  6028. _this3._element.classList.add(ClassName$a.HIDE);
  6029. $(_this3._element).trigger(Event$a.HIDDEN);
  6030. };
  6031. this._element.classList.remove(ClassName$a.SHOW);
  6032. if (this._config.animation) {
  6033. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6034. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6035. } else {
  6036. complete();
  6037. }
  6038. } // Static
  6039. ;
  6040. Toast._jQueryInterface = function _jQueryInterface(config) {
  6041. return this.each(function () {
  6042. var $element = $(this);
  6043. var data = $element.data(DATA_KEY$a);
  6044. var _config = typeof config === 'object' && config;
  6045. if (!data) {
  6046. data = new Toast(this, _config);
  6047. $element.data(DATA_KEY$a, data);
  6048. }
  6049. if (typeof config === 'string') {
  6050. if (typeof data[config] === 'undefined') {
  6051. throw new TypeError("No method named \"" + config + "\"");
  6052. }
  6053. data[config](this);
  6054. }
  6055. });
  6056. };
  6057. _createClass(Toast, null, [{
  6058. key: "VERSION",
  6059. get: function get() {
  6060. return VERSION$a;
  6061. }
  6062. }, {
  6063. key: "DefaultType",
  6064. get: function get() {
  6065. return DefaultType$7;
  6066. }
  6067. }, {
  6068. key: "Default",
  6069. get: function get() {
  6070. return Default$7;
  6071. }
  6072. }]);
  6073. return Toast;
  6074. }();
  6075. /**
  6076. * ------------------------------------------------------------------------
  6077. * jQuery
  6078. * ------------------------------------------------------------------------
  6079. */
  6080. $.fn[NAME$a] = Toast._jQueryInterface;
  6081. $.fn[NAME$a].Constructor = Toast;
  6082. $.fn[NAME$a].noConflict = function () {
  6083. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6084. return Toast._jQueryInterface;
  6085. };
  6086. exports.Alert = Alert;
  6087. exports.Button = Button;
  6088. exports.Carousel = Carousel;
  6089. exports.Collapse = Collapse;
  6090. exports.Dropdown = Dropdown;
  6091. exports.Modal = Modal;
  6092. exports.Popover = Popover;
  6093. exports.Scrollspy = ScrollSpy;
  6094. exports.Tab = Tab;
  6095. exports.Toast = Toast;
  6096. exports.Tooltip = Tooltip;
  6097. exports.Util = Util;
  6098. Object.defineProperty(exports, '__esModule', { value: true });
  6099. })));
  6100. //# sourceMappingURL=bootstrap.js.map
  6101. /***/ }),
  6102. /***/ "./node_modules/buffer/index.js":
  6103. /*!**************************************!*\
  6104. !*** ./node_modules/buffer/index.js ***!
  6105. \**************************************/
  6106. /*! no static exports found */
  6107. /***/ (function(module, exports, __webpack_require__) {
  6108. "use strict";
  6109. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6110. * The buffer module from node.js, for the browser.
  6111. *
  6112. * @author Feross Aboukhadijeh <http://feross.org>
  6113. * @license MIT
  6114. */
  6115. /* eslint-disable no-proto */
  6116. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6117. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6118. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6119. exports.Buffer = Buffer
  6120. exports.SlowBuffer = SlowBuffer
  6121. exports.INSPECT_MAX_BYTES = 50
  6122. /**
  6123. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6124. * === true Use Uint8Array implementation (fastest)
  6125. * === false Use Object implementation (most compatible, even IE6)
  6126. *
  6127. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6128. * Opera 11.6+, iOS 4.2+.
  6129. *
  6130. * Due to various browser bugs, sometimes the Object implementation will be used even
  6131. * when the browser supports typed arrays.
  6132. *
  6133. * Note:
  6134. *
  6135. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6136. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6137. *
  6138. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6139. *
  6140. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6141. * incorrect length in some situations.
  6142. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6143. * get the Object implementation, which is slower but behaves correctly.
  6144. */
  6145. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6146. ? global.TYPED_ARRAY_SUPPORT
  6147. : typedArraySupport()
  6148. /*
  6149. * Export kMaxLength after typed array support is determined.
  6150. */
  6151. exports.kMaxLength = kMaxLength()
  6152. function typedArraySupport () {
  6153. try {
  6154. var arr = new Uint8Array(1)
  6155. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6156. return arr.foo() === 42 && // typed array instances can be augmented
  6157. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6158. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6159. } catch (e) {
  6160. return false
  6161. }
  6162. }
  6163. function kMaxLength () {
  6164. return Buffer.TYPED_ARRAY_SUPPORT
  6165. ? 0x7fffffff
  6166. : 0x3fffffff
  6167. }
  6168. function createBuffer (that, length) {
  6169. if (kMaxLength() < length) {
  6170. throw new RangeError('Invalid typed array length')
  6171. }
  6172. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6173. // Return an augmented `Uint8Array` instance, for best performance
  6174. that = new Uint8Array(length)
  6175. that.__proto__ = Buffer.prototype
  6176. } else {
  6177. // Fallback: Return an object instance of the Buffer class
  6178. if (that === null) {
  6179. that = new Buffer(length)
  6180. }
  6181. that.length = length
  6182. }
  6183. return that
  6184. }
  6185. /**
  6186. * The Buffer constructor returns instances of `Uint8Array` that have their
  6187. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6188. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6189. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6190. * returns a single octet.
  6191. *
  6192. * The `Uint8Array` prototype remains unmodified.
  6193. */
  6194. function Buffer (arg, encodingOrOffset, length) {
  6195. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6196. return new Buffer(arg, encodingOrOffset, length)
  6197. }
  6198. // Common case.
  6199. if (typeof arg === 'number') {
  6200. if (typeof encodingOrOffset === 'string') {
  6201. throw new Error(
  6202. 'If encoding is specified then the first argument must be a string'
  6203. )
  6204. }
  6205. return allocUnsafe(this, arg)
  6206. }
  6207. return from(this, arg, encodingOrOffset, length)
  6208. }
  6209. Buffer.poolSize = 8192 // not used by this implementation
  6210. // TODO: Legacy, not needed anymore. Remove in next major version.
  6211. Buffer._augment = function (arr) {
  6212. arr.__proto__ = Buffer.prototype
  6213. return arr
  6214. }
  6215. function from (that, value, encodingOrOffset, length) {
  6216. if (typeof value === 'number') {
  6217. throw new TypeError('"value" argument must not be a number')
  6218. }
  6219. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6220. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6221. }
  6222. if (typeof value === 'string') {
  6223. return fromString(that, value, encodingOrOffset)
  6224. }
  6225. return fromObject(that, value)
  6226. }
  6227. /**
  6228. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6229. * if value is a number.
  6230. * Buffer.from(str[, encoding])
  6231. * Buffer.from(array)
  6232. * Buffer.from(buffer)
  6233. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6234. **/
  6235. Buffer.from = function (value, encodingOrOffset, length) {
  6236. return from(null, value, encodingOrOffset, length)
  6237. }
  6238. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6239. Buffer.prototype.__proto__ = Uint8Array.prototype
  6240. Buffer.__proto__ = Uint8Array
  6241. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6242. Buffer[Symbol.species] === Buffer) {
  6243. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6244. Object.defineProperty(Buffer, Symbol.species, {
  6245. value: null,
  6246. configurable: true
  6247. })
  6248. }
  6249. }
  6250. function assertSize (size) {
  6251. if (typeof size !== 'number') {
  6252. throw new TypeError('"size" argument must be a number')
  6253. } else if (size < 0) {
  6254. throw new RangeError('"size" argument must not be negative')
  6255. }
  6256. }
  6257. function alloc (that, size, fill, encoding) {
  6258. assertSize(size)
  6259. if (size <= 0) {
  6260. return createBuffer(that, size)
  6261. }
  6262. if (fill !== undefined) {
  6263. // Only pay attention to encoding if it's a string. This
  6264. // prevents accidentally sending in a number that would
  6265. // be interpretted as a start offset.
  6266. return typeof encoding === 'string'
  6267. ? createBuffer(that, size).fill(fill, encoding)
  6268. : createBuffer(that, size).fill(fill)
  6269. }
  6270. return createBuffer(that, size)
  6271. }
  6272. /**
  6273. * Creates a new filled Buffer instance.
  6274. * alloc(size[, fill[, encoding]])
  6275. **/
  6276. Buffer.alloc = function (size, fill, encoding) {
  6277. return alloc(null, size, fill, encoding)
  6278. }
  6279. function allocUnsafe (that, size) {
  6280. assertSize(size)
  6281. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6282. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6283. for (var i = 0; i < size; ++i) {
  6284. that[i] = 0
  6285. }
  6286. }
  6287. return that
  6288. }
  6289. /**
  6290. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6291. * */
  6292. Buffer.allocUnsafe = function (size) {
  6293. return allocUnsafe(null, size)
  6294. }
  6295. /**
  6296. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6297. */
  6298. Buffer.allocUnsafeSlow = function (size) {
  6299. return allocUnsafe(null, size)
  6300. }
  6301. function fromString (that, string, encoding) {
  6302. if (typeof encoding !== 'string' || encoding === '') {
  6303. encoding = 'utf8'
  6304. }
  6305. if (!Buffer.isEncoding(encoding)) {
  6306. throw new TypeError('"encoding" must be a valid string encoding')
  6307. }
  6308. var length = byteLength(string, encoding) | 0
  6309. that = createBuffer(that, length)
  6310. var actual = that.write(string, encoding)
  6311. if (actual !== length) {
  6312. // Writing a hex string, for example, that contains invalid characters will
  6313. // cause everything after the first invalid character to be ignored. (e.g.
  6314. // 'abxxcd' will be treated as 'ab')
  6315. that = that.slice(0, actual)
  6316. }
  6317. return that
  6318. }
  6319. function fromArrayLike (that, array) {
  6320. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6321. that = createBuffer(that, length)
  6322. for (var i = 0; i < length; i += 1) {
  6323. that[i] = array[i] & 255
  6324. }
  6325. return that
  6326. }
  6327. function fromArrayBuffer (that, array, byteOffset, length) {
  6328. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6329. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6330. throw new RangeError('\'offset\' is out of bounds')
  6331. }
  6332. if (array.byteLength < byteOffset + (length || 0)) {
  6333. throw new RangeError('\'length\' is out of bounds')
  6334. }
  6335. if (byteOffset === undefined && length === undefined) {
  6336. array = new Uint8Array(array)
  6337. } else if (length === undefined) {
  6338. array = new Uint8Array(array, byteOffset)
  6339. } else {
  6340. array = new Uint8Array(array, byteOffset, length)
  6341. }
  6342. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6343. // Return an augmented `Uint8Array` instance, for best performance
  6344. that = array
  6345. that.__proto__ = Buffer.prototype
  6346. } else {
  6347. // Fallback: Return an object instance of the Buffer class
  6348. that = fromArrayLike(that, array)
  6349. }
  6350. return that
  6351. }
  6352. function fromObject (that, obj) {
  6353. if (Buffer.isBuffer(obj)) {
  6354. var len = checked(obj.length) | 0
  6355. that = createBuffer(that, len)
  6356. if (that.length === 0) {
  6357. return that
  6358. }
  6359. obj.copy(that, 0, 0, len)
  6360. return that
  6361. }
  6362. if (obj) {
  6363. if ((typeof ArrayBuffer !== 'undefined' &&
  6364. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6365. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6366. return createBuffer(that, 0)
  6367. }
  6368. return fromArrayLike(that, obj)
  6369. }
  6370. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6371. return fromArrayLike(that, obj.data)
  6372. }
  6373. }
  6374. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6375. }
  6376. function checked (length) {
  6377. // Note: cannot use `length < kMaxLength()` here because that fails when
  6378. // length is NaN (which is otherwise coerced to zero.)
  6379. if (length >= kMaxLength()) {
  6380. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6381. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6382. }
  6383. return length | 0
  6384. }
  6385. function SlowBuffer (length) {
  6386. if (+length != length) { // eslint-disable-line eqeqeq
  6387. length = 0
  6388. }
  6389. return Buffer.alloc(+length)
  6390. }
  6391. Buffer.isBuffer = function isBuffer (b) {
  6392. return !!(b != null && b._isBuffer)
  6393. }
  6394. Buffer.compare = function compare (a, b) {
  6395. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6396. throw new TypeError('Arguments must be Buffers')
  6397. }
  6398. if (a === b) return 0
  6399. var x = a.length
  6400. var y = b.length
  6401. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6402. if (a[i] !== b[i]) {
  6403. x = a[i]
  6404. y = b[i]
  6405. break
  6406. }
  6407. }
  6408. if (x < y) return -1
  6409. if (y < x) return 1
  6410. return 0
  6411. }
  6412. Buffer.isEncoding = function isEncoding (encoding) {
  6413. switch (String(encoding).toLowerCase()) {
  6414. case 'hex':
  6415. case 'utf8':
  6416. case 'utf-8':
  6417. case 'ascii':
  6418. case 'latin1':
  6419. case 'binary':
  6420. case 'base64':
  6421. case 'ucs2':
  6422. case 'ucs-2':
  6423. case 'utf16le':
  6424. case 'utf-16le':
  6425. return true
  6426. default:
  6427. return false
  6428. }
  6429. }
  6430. Buffer.concat = function concat (list, length) {
  6431. if (!isArray(list)) {
  6432. throw new TypeError('"list" argument must be an Array of Buffers')
  6433. }
  6434. if (list.length === 0) {
  6435. return Buffer.alloc(0)
  6436. }
  6437. var i
  6438. if (length === undefined) {
  6439. length = 0
  6440. for (i = 0; i < list.length; ++i) {
  6441. length += list[i].length
  6442. }
  6443. }
  6444. var buffer = Buffer.allocUnsafe(length)
  6445. var pos = 0
  6446. for (i = 0; i < list.length; ++i) {
  6447. var buf = list[i]
  6448. if (!Buffer.isBuffer(buf)) {
  6449. throw new TypeError('"list" argument must be an Array of Buffers')
  6450. }
  6451. buf.copy(buffer, pos)
  6452. pos += buf.length
  6453. }
  6454. return buffer
  6455. }
  6456. function byteLength (string, encoding) {
  6457. if (Buffer.isBuffer(string)) {
  6458. return string.length
  6459. }
  6460. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6461. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6462. return string.byteLength
  6463. }
  6464. if (typeof string !== 'string') {
  6465. string = '' + string
  6466. }
  6467. var len = string.length
  6468. if (len === 0) return 0
  6469. // Use a for loop to avoid recursion
  6470. var loweredCase = false
  6471. for (;;) {
  6472. switch (encoding) {
  6473. case 'ascii':
  6474. case 'latin1':
  6475. case 'binary':
  6476. return len
  6477. case 'utf8':
  6478. case 'utf-8':
  6479. case undefined:
  6480. return utf8ToBytes(string).length
  6481. case 'ucs2':
  6482. case 'ucs-2':
  6483. case 'utf16le':
  6484. case 'utf-16le':
  6485. return len * 2
  6486. case 'hex':
  6487. return len >>> 1
  6488. case 'base64':
  6489. return base64ToBytes(string).length
  6490. default:
  6491. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6492. encoding = ('' + encoding).toLowerCase()
  6493. loweredCase = true
  6494. }
  6495. }
  6496. }
  6497. Buffer.byteLength = byteLength
  6498. function slowToString (encoding, start, end) {
  6499. var loweredCase = false
  6500. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6501. // property of a typed array.
  6502. // This behaves neither like String nor Uint8Array in that we set start/end
  6503. // to their upper/lower bounds if the value passed is out of range.
  6504. // undefined is handled specially as per ECMA-262 6th Edition,
  6505. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6506. if (start === undefined || start < 0) {
  6507. start = 0
  6508. }
  6509. // Return early if start > this.length. Done here to prevent potential uint32
  6510. // coercion fail below.
  6511. if (start > this.length) {
  6512. return ''
  6513. }
  6514. if (end === undefined || end > this.length) {
  6515. end = this.length
  6516. }
  6517. if (end <= 0) {
  6518. return ''
  6519. }
  6520. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6521. end >>>= 0
  6522. start >>>= 0
  6523. if (end <= start) {
  6524. return ''
  6525. }
  6526. if (!encoding) encoding = 'utf8'
  6527. while (true) {
  6528. switch (encoding) {
  6529. case 'hex':
  6530. return hexSlice(this, start, end)
  6531. case 'utf8':
  6532. case 'utf-8':
  6533. return utf8Slice(this, start, end)
  6534. case 'ascii':
  6535. return asciiSlice(this, start, end)
  6536. case 'latin1':
  6537. case 'binary':
  6538. return latin1Slice(this, start, end)
  6539. case 'base64':
  6540. return base64Slice(this, start, end)
  6541. case 'ucs2':
  6542. case 'ucs-2':
  6543. case 'utf16le':
  6544. case 'utf-16le':
  6545. return utf16leSlice(this, start, end)
  6546. default:
  6547. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6548. encoding = (encoding + '').toLowerCase()
  6549. loweredCase = true
  6550. }
  6551. }
  6552. }
  6553. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6554. // Buffer instances.
  6555. Buffer.prototype._isBuffer = true
  6556. function swap (b, n, m) {
  6557. var i = b[n]
  6558. b[n] = b[m]
  6559. b[m] = i
  6560. }
  6561. Buffer.prototype.swap16 = function swap16 () {
  6562. var len = this.length
  6563. if (len % 2 !== 0) {
  6564. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6565. }
  6566. for (var i = 0; i < len; i += 2) {
  6567. swap(this, i, i + 1)
  6568. }
  6569. return this
  6570. }
  6571. Buffer.prototype.swap32 = function swap32 () {
  6572. var len = this.length
  6573. if (len % 4 !== 0) {
  6574. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6575. }
  6576. for (var i = 0; i < len; i += 4) {
  6577. swap(this, i, i + 3)
  6578. swap(this, i + 1, i + 2)
  6579. }
  6580. return this
  6581. }
  6582. Buffer.prototype.swap64 = function swap64 () {
  6583. var len = this.length
  6584. if (len % 8 !== 0) {
  6585. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6586. }
  6587. for (var i = 0; i < len; i += 8) {
  6588. swap(this, i, i + 7)
  6589. swap(this, i + 1, i + 6)
  6590. swap(this, i + 2, i + 5)
  6591. swap(this, i + 3, i + 4)
  6592. }
  6593. return this
  6594. }
  6595. Buffer.prototype.toString = function toString () {
  6596. var length = this.length | 0
  6597. if (length === 0) return ''
  6598. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6599. return slowToString.apply(this, arguments)
  6600. }
  6601. Buffer.prototype.equals = function equals (b) {
  6602. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6603. if (this === b) return true
  6604. return Buffer.compare(this, b) === 0
  6605. }
  6606. Buffer.prototype.inspect = function inspect () {
  6607. var str = ''
  6608. var max = exports.INSPECT_MAX_BYTES
  6609. if (this.length > 0) {
  6610. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6611. if (this.length > max) str += ' ... '
  6612. }
  6613. return '<Buffer ' + str + '>'
  6614. }
  6615. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6616. if (!Buffer.isBuffer(target)) {
  6617. throw new TypeError('Argument must be a Buffer')
  6618. }
  6619. if (start === undefined) {
  6620. start = 0
  6621. }
  6622. if (end === undefined) {
  6623. end = target ? target.length : 0
  6624. }
  6625. if (thisStart === undefined) {
  6626. thisStart = 0
  6627. }
  6628. if (thisEnd === undefined) {
  6629. thisEnd = this.length
  6630. }
  6631. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6632. throw new RangeError('out of range index')
  6633. }
  6634. if (thisStart >= thisEnd && start >= end) {
  6635. return 0
  6636. }
  6637. if (thisStart >= thisEnd) {
  6638. return -1
  6639. }
  6640. if (start >= end) {
  6641. return 1
  6642. }
  6643. start >>>= 0
  6644. end >>>= 0
  6645. thisStart >>>= 0
  6646. thisEnd >>>= 0
  6647. if (this === target) return 0
  6648. var x = thisEnd - thisStart
  6649. var y = end - start
  6650. var len = Math.min(x, y)
  6651. var thisCopy = this.slice(thisStart, thisEnd)
  6652. var targetCopy = target.slice(start, end)
  6653. for (var i = 0; i < len; ++i) {
  6654. if (thisCopy[i] !== targetCopy[i]) {
  6655. x = thisCopy[i]
  6656. y = targetCopy[i]
  6657. break
  6658. }
  6659. }
  6660. if (x < y) return -1
  6661. if (y < x) return 1
  6662. return 0
  6663. }
  6664. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6665. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6666. //
  6667. // Arguments:
  6668. // - buffer - a Buffer to search
  6669. // - val - a string, Buffer, or number
  6670. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6671. // - encoding - an optional encoding, relevant is val is a string
  6672. // - dir - true for indexOf, false for lastIndexOf
  6673. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6674. // Empty buffer means no match
  6675. if (buffer.length === 0) return -1
  6676. // Normalize byteOffset
  6677. if (typeof byteOffset === 'string') {
  6678. encoding = byteOffset
  6679. byteOffset = 0
  6680. } else if (byteOffset > 0x7fffffff) {
  6681. byteOffset = 0x7fffffff
  6682. } else if (byteOffset < -0x80000000) {
  6683. byteOffset = -0x80000000
  6684. }
  6685. byteOffset = +byteOffset // Coerce to Number.
  6686. if (isNaN(byteOffset)) {
  6687. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6688. byteOffset = dir ? 0 : (buffer.length - 1)
  6689. }
  6690. // Normalize byteOffset: negative offsets start from the end of the buffer
  6691. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6692. if (byteOffset >= buffer.length) {
  6693. if (dir) return -1
  6694. else byteOffset = buffer.length - 1
  6695. } else if (byteOffset < 0) {
  6696. if (dir) byteOffset = 0
  6697. else return -1
  6698. }
  6699. // Normalize val
  6700. if (typeof val === 'string') {
  6701. val = Buffer.from(val, encoding)
  6702. }
  6703. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6704. if (Buffer.isBuffer(val)) {
  6705. // Special case: looking for empty string/buffer always fails
  6706. if (val.length === 0) {
  6707. return -1
  6708. }
  6709. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6710. } else if (typeof val === 'number') {
  6711. val = val & 0xFF // Search for a byte value [0-255]
  6712. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6713. typeof Uint8Array.prototype.indexOf === 'function') {
  6714. if (dir) {
  6715. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6716. } else {
  6717. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6718. }
  6719. }
  6720. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6721. }
  6722. throw new TypeError('val must be string, number or Buffer')
  6723. }
  6724. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6725. var indexSize = 1
  6726. var arrLength = arr.length
  6727. var valLength = val.length
  6728. if (encoding !== undefined) {
  6729. encoding = String(encoding).toLowerCase()
  6730. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6731. encoding === 'utf16le' || encoding === 'utf-16le') {
  6732. if (arr.length < 2 || val.length < 2) {
  6733. return -1
  6734. }
  6735. indexSize = 2
  6736. arrLength /= 2
  6737. valLength /= 2
  6738. byteOffset /= 2
  6739. }
  6740. }
  6741. function read (buf, i) {
  6742. if (indexSize === 1) {
  6743. return buf[i]
  6744. } else {
  6745. return buf.readUInt16BE(i * indexSize)
  6746. }
  6747. }
  6748. var i
  6749. if (dir) {
  6750. var foundIndex = -1
  6751. for (i = byteOffset; i < arrLength; i++) {
  6752. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6753. if (foundIndex === -1) foundIndex = i
  6754. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6755. } else {
  6756. if (foundIndex !== -1) i -= i - foundIndex
  6757. foundIndex = -1
  6758. }
  6759. }
  6760. } else {
  6761. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6762. for (i = byteOffset; i >= 0; i--) {
  6763. var found = true
  6764. for (var j = 0; j < valLength; j++) {
  6765. if (read(arr, i + j) !== read(val, j)) {
  6766. found = false
  6767. break
  6768. }
  6769. }
  6770. if (found) return i
  6771. }
  6772. }
  6773. return -1
  6774. }
  6775. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6776. return this.indexOf(val, byteOffset, encoding) !== -1
  6777. }
  6778. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6779. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6780. }
  6781. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6782. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6783. }
  6784. function hexWrite (buf, string, offset, length) {
  6785. offset = Number(offset) || 0
  6786. var remaining = buf.length - offset
  6787. if (!length) {
  6788. length = remaining
  6789. } else {
  6790. length = Number(length)
  6791. if (length > remaining) {
  6792. length = remaining
  6793. }
  6794. }
  6795. // must be an even number of digits
  6796. var strLen = string.length
  6797. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6798. if (length > strLen / 2) {
  6799. length = strLen / 2
  6800. }
  6801. for (var i = 0; i < length; ++i) {
  6802. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6803. if (isNaN(parsed)) return i
  6804. buf[offset + i] = parsed
  6805. }
  6806. return i
  6807. }
  6808. function utf8Write (buf, string, offset, length) {
  6809. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6810. }
  6811. function asciiWrite (buf, string, offset, length) {
  6812. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6813. }
  6814. function latin1Write (buf, string, offset, length) {
  6815. return asciiWrite(buf, string, offset, length)
  6816. }
  6817. function base64Write (buf, string, offset, length) {
  6818. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6819. }
  6820. function ucs2Write (buf, string, offset, length) {
  6821. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6822. }
  6823. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6824. // Buffer#write(string)
  6825. if (offset === undefined) {
  6826. encoding = 'utf8'
  6827. length = this.length
  6828. offset = 0
  6829. // Buffer#write(string, encoding)
  6830. } else if (length === undefined && typeof offset === 'string') {
  6831. encoding = offset
  6832. length = this.length
  6833. offset = 0
  6834. // Buffer#write(string, offset[, length][, encoding])
  6835. } else if (isFinite(offset)) {
  6836. offset = offset | 0
  6837. if (isFinite(length)) {
  6838. length = length | 0
  6839. if (encoding === undefined) encoding = 'utf8'
  6840. } else {
  6841. encoding = length
  6842. length = undefined
  6843. }
  6844. // legacy write(string, encoding, offset, length) - remove in v0.13
  6845. } else {
  6846. throw new Error(
  6847. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6848. )
  6849. }
  6850. var remaining = this.length - offset
  6851. if (length === undefined || length > remaining) length = remaining
  6852. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6853. throw new RangeError('Attempt to write outside buffer bounds')
  6854. }
  6855. if (!encoding) encoding = 'utf8'
  6856. var loweredCase = false
  6857. for (;;) {
  6858. switch (encoding) {
  6859. case 'hex':
  6860. return hexWrite(this, string, offset, length)
  6861. case 'utf8':
  6862. case 'utf-8':
  6863. return utf8Write(this, string, offset, length)
  6864. case 'ascii':
  6865. return asciiWrite(this, string, offset, length)
  6866. case 'latin1':
  6867. case 'binary':
  6868. return latin1Write(this, string, offset, length)
  6869. case 'base64':
  6870. // Warning: maxLength not taken into account in base64Write
  6871. return base64Write(this, string, offset, length)
  6872. case 'ucs2':
  6873. case 'ucs-2':
  6874. case 'utf16le':
  6875. case 'utf-16le':
  6876. return ucs2Write(this, string, offset, length)
  6877. default:
  6878. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6879. encoding = ('' + encoding).toLowerCase()
  6880. loweredCase = true
  6881. }
  6882. }
  6883. }
  6884. Buffer.prototype.toJSON = function toJSON () {
  6885. return {
  6886. type: 'Buffer',
  6887. data: Array.prototype.slice.call(this._arr || this, 0)
  6888. }
  6889. }
  6890. function base64Slice (buf, start, end) {
  6891. if (start === 0 && end === buf.length) {
  6892. return base64.fromByteArray(buf)
  6893. } else {
  6894. return base64.fromByteArray(buf.slice(start, end))
  6895. }
  6896. }
  6897. function utf8Slice (buf, start, end) {
  6898. end = Math.min(buf.length, end)
  6899. var res = []
  6900. var i = start
  6901. while (i < end) {
  6902. var firstByte = buf[i]
  6903. var codePoint = null
  6904. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6905. : (firstByte > 0xDF) ? 3
  6906. : (firstByte > 0xBF) ? 2
  6907. : 1
  6908. if (i + bytesPerSequence <= end) {
  6909. var secondByte, thirdByte, fourthByte, tempCodePoint
  6910. switch (bytesPerSequence) {
  6911. case 1:
  6912. if (firstByte < 0x80) {
  6913. codePoint = firstByte
  6914. }
  6915. break
  6916. case 2:
  6917. secondByte = buf[i + 1]
  6918. if ((secondByte & 0xC0) === 0x80) {
  6919. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6920. if (tempCodePoint > 0x7F) {
  6921. codePoint = tempCodePoint
  6922. }
  6923. }
  6924. break
  6925. case 3:
  6926. secondByte = buf[i + 1]
  6927. thirdByte = buf[i + 2]
  6928. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6929. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6930. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6931. codePoint = tempCodePoint
  6932. }
  6933. }
  6934. break
  6935. case 4:
  6936. secondByte = buf[i + 1]
  6937. thirdByte = buf[i + 2]
  6938. fourthByte = buf[i + 3]
  6939. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6940. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6941. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6942. codePoint = tempCodePoint
  6943. }
  6944. }
  6945. }
  6946. }
  6947. if (codePoint === null) {
  6948. // we did not generate a valid codePoint so insert a
  6949. // replacement char (U+FFFD) and advance only 1 byte
  6950. codePoint = 0xFFFD
  6951. bytesPerSequence = 1
  6952. } else if (codePoint > 0xFFFF) {
  6953. // encode to utf16 (surrogate pair dance)
  6954. codePoint -= 0x10000
  6955. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6956. codePoint = 0xDC00 | codePoint & 0x3FF
  6957. }
  6958. res.push(codePoint)
  6959. i += bytesPerSequence
  6960. }
  6961. return decodeCodePointsArray(res)
  6962. }
  6963. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6964. // the lowest limit is Chrome, with 0x10000 args.
  6965. // We go 1 magnitude less, for safety
  6966. var MAX_ARGUMENTS_LENGTH = 0x1000
  6967. function decodeCodePointsArray (codePoints) {
  6968. var len = codePoints.length
  6969. if (len <= MAX_ARGUMENTS_LENGTH) {
  6970. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6971. }
  6972. // Decode in chunks to avoid "call stack size exceeded".
  6973. var res = ''
  6974. var i = 0
  6975. while (i < len) {
  6976. res += String.fromCharCode.apply(
  6977. String,
  6978. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6979. )
  6980. }
  6981. return res
  6982. }
  6983. function asciiSlice (buf, start, end) {
  6984. var ret = ''
  6985. end = Math.min(buf.length, end)
  6986. for (var i = start; i < end; ++i) {
  6987. ret += String.fromCharCode(buf[i] & 0x7F)
  6988. }
  6989. return ret
  6990. }
  6991. function latin1Slice (buf, start, end) {
  6992. var ret = ''
  6993. end = Math.min(buf.length, end)
  6994. for (var i = start; i < end; ++i) {
  6995. ret += String.fromCharCode(buf[i])
  6996. }
  6997. return ret
  6998. }
  6999. function hexSlice (buf, start, end) {
  7000. var len = buf.length
  7001. if (!start || start < 0) start = 0
  7002. if (!end || end < 0 || end > len) end = len
  7003. var out = ''
  7004. for (var i = start; i < end; ++i) {
  7005. out += toHex(buf[i])
  7006. }
  7007. return out
  7008. }
  7009. function utf16leSlice (buf, start, end) {
  7010. var bytes = buf.slice(start, end)
  7011. var res = ''
  7012. for (var i = 0; i < bytes.length; i += 2) {
  7013. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7014. }
  7015. return res
  7016. }
  7017. Buffer.prototype.slice = function slice (start, end) {
  7018. var len = this.length
  7019. start = ~~start
  7020. end = end === undefined ? len : ~~end
  7021. if (start < 0) {
  7022. start += len
  7023. if (start < 0) start = 0
  7024. } else if (start > len) {
  7025. start = len
  7026. }
  7027. if (end < 0) {
  7028. end += len
  7029. if (end < 0) end = 0
  7030. } else if (end > len) {
  7031. end = len
  7032. }
  7033. if (end < start) end = start
  7034. var newBuf
  7035. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7036. newBuf = this.subarray(start, end)
  7037. newBuf.__proto__ = Buffer.prototype
  7038. } else {
  7039. var sliceLen = end - start
  7040. newBuf = new Buffer(sliceLen, undefined)
  7041. for (var i = 0; i < sliceLen; ++i) {
  7042. newBuf[i] = this[i + start]
  7043. }
  7044. }
  7045. return newBuf
  7046. }
  7047. /*
  7048. * Need to make sure that buffer isn't trying to write out of bounds.
  7049. */
  7050. function checkOffset (offset, ext, length) {
  7051. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7052. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7053. }
  7054. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7055. offset = offset | 0
  7056. byteLength = byteLength | 0
  7057. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7058. var val = this[offset]
  7059. var mul = 1
  7060. var i = 0
  7061. while (++i < byteLength && (mul *= 0x100)) {
  7062. val += this[offset + i] * mul
  7063. }
  7064. return val
  7065. }
  7066. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7067. offset = offset | 0
  7068. byteLength = byteLength | 0
  7069. if (!noAssert) {
  7070. checkOffset(offset, byteLength, this.length)
  7071. }
  7072. var val = this[offset + --byteLength]
  7073. var mul = 1
  7074. while (byteLength > 0 && (mul *= 0x100)) {
  7075. val += this[offset + --byteLength] * mul
  7076. }
  7077. return val
  7078. }
  7079. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7080. if (!noAssert) checkOffset(offset, 1, this.length)
  7081. return this[offset]
  7082. }
  7083. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7084. if (!noAssert) checkOffset(offset, 2, this.length)
  7085. return this[offset] | (this[offset + 1] << 8)
  7086. }
  7087. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7088. if (!noAssert) checkOffset(offset, 2, this.length)
  7089. return (this[offset] << 8) | this[offset + 1]
  7090. }
  7091. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7092. if (!noAssert) checkOffset(offset, 4, this.length)
  7093. return ((this[offset]) |
  7094. (this[offset + 1] << 8) |
  7095. (this[offset + 2] << 16)) +
  7096. (this[offset + 3] * 0x1000000)
  7097. }
  7098. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7099. if (!noAssert) checkOffset(offset, 4, this.length)
  7100. return (this[offset] * 0x1000000) +
  7101. ((this[offset + 1] << 16) |
  7102. (this[offset + 2] << 8) |
  7103. this[offset + 3])
  7104. }
  7105. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7106. offset = offset | 0
  7107. byteLength = byteLength | 0
  7108. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7109. var val = this[offset]
  7110. var mul = 1
  7111. var i = 0
  7112. while (++i < byteLength && (mul *= 0x100)) {
  7113. val += this[offset + i] * mul
  7114. }
  7115. mul *= 0x80
  7116. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7117. return val
  7118. }
  7119. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7120. offset = offset | 0
  7121. byteLength = byteLength | 0
  7122. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7123. var i = byteLength
  7124. var mul = 1
  7125. var val = this[offset + --i]
  7126. while (i > 0 && (mul *= 0x100)) {
  7127. val += this[offset + --i] * mul
  7128. }
  7129. mul *= 0x80
  7130. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7131. return val
  7132. }
  7133. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7134. if (!noAssert) checkOffset(offset, 1, this.length)
  7135. if (!(this[offset] & 0x80)) return (this[offset])
  7136. return ((0xff - this[offset] + 1) * -1)
  7137. }
  7138. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7139. if (!noAssert) checkOffset(offset, 2, this.length)
  7140. var val = this[offset] | (this[offset + 1] << 8)
  7141. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7142. }
  7143. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7144. if (!noAssert) checkOffset(offset, 2, this.length)
  7145. var val = this[offset + 1] | (this[offset] << 8)
  7146. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7147. }
  7148. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7149. if (!noAssert) checkOffset(offset, 4, this.length)
  7150. return (this[offset]) |
  7151. (this[offset + 1] << 8) |
  7152. (this[offset + 2] << 16) |
  7153. (this[offset + 3] << 24)
  7154. }
  7155. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7156. if (!noAssert) checkOffset(offset, 4, this.length)
  7157. return (this[offset] << 24) |
  7158. (this[offset + 1] << 16) |
  7159. (this[offset + 2] << 8) |
  7160. (this[offset + 3])
  7161. }
  7162. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7163. if (!noAssert) checkOffset(offset, 4, this.length)
  7164. return ieee754.read(this, offset, true, 23, 4)
  7165. }
  7166. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7167. if (!noAssert) checkOffset(offset, 4, this.length)
  7168. return ieee754.read(this, offset, false, 23, 4)
  7169. }
  7170. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7171. if (!noAssert) checkOffset(offset, 8, this.length)
  7172. return ieee754.read(this, offset, true, 52, 8)
  7173. }
  7174. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7175. if (!noAssert) checkOffset(offset, 8, this.length)
  7176. return ieee754.read(this, offset, false, 52, 8)
  7177. }
  7178. function checkInt (buf, value, offset, ext, max, min) {
  7179. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7180. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7181. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7182. }
  7183. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7184. value = +value
  7185. offset = offset | 0
  7186. byteLength = byteLength | 0
  7187. if (!noAssert) {
  7188. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7189. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7190. }
  7191. var mul = 1
  7192. var i = 0
  7193. this[offset] = value & 0xFF
  7194. while (++i < byteLength && (mul *= 0x100)) {
  7195. this[offset + i] = (value / mul) & 0xFF
  7196. }
  7197. return offset + byteLength
  7198. }
  7199. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7200. value = +value
  7201. offset = offset | 0
  7202. byteLength = byteLength | 0
  7203. if (!noAssert) {
  7204. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7205. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7206. }
  7207. var i = byteLength - 1
  7208. var mul = 1
  7209. this[offset + i] = value & 0xFF
  7210. while (--i >= 0 && (mul *= 0x100)) {
  7211. this[offset + i] = (value / mul) & 0xFF
  7212. }
  7213. return offset + byteLength
  7214. }
  7215. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7216. value = +value
  7217. offset = offset | 0
  7218. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7219. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7220. this[offset] = (value & 0xff)
  7221. return offset + 1
  7222. }
  7223. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7224. if (value < 0) value = 0xffff + value + 1
  7225. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7226. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7227. (littleEndian ? i : 1 - i) * 8
  7228. }
  7229. }
  7230. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7231. value = +value
  7232. offset = offset | 0
  7233. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7234. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7235. this[offset] = (value & 0xff)
  7236. this[offset + 1] = (value >>> 8)
  7237. } else {
  7238. objectWriteUInt16(this, value, offset, true)
  7239. }
  7240. return offset + 2
  7241. }
  7242. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7243. value = +value
  7244. offset = offset | 0
  7245. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7246. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7247. this[offset] = (value >>> 8)
  7248. this[offset + 1] = (value & 0xff)
  7249. } else {
  7250. objectWriteUInt16(this, value, offset, false)
  7251. }
  7252. return offset + 2
  7253. }
  7254. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7255. if (value < 0) value = 0xffffffff + value + 1
  7256. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7257. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7258. }
  7259. }
  7260. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7261. value = +value
  7262. offset = offset | 0
  7263. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7264. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7265. this[offset + 3] = (value >>> 24)
  7266. this[offset + 2] = (value >>> 16)
  7267. this[offset + 1] = (value >>> 8)
  7268. this[offset] = (value & 0xff)
  7269. } else {
  7270. objectWriteUInt32(this, value, offset, true)
  7271. }
  7272. return offset + 4
  7273. }
  7274. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7275. value = +value
  7276. offset = offset | 0
  7277. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7278. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7279. this[offset] = (value >>> 24)
  7280. this[offset + 1] = (value >>> 16)
  7281. this[offset + 2] = (value >>> 8)
  7282. this[offset + 3] = (value & 0xff)
  7283. } else {
  7284. objectWriteUInt32(this, value, offset, false)
  7285. }
  7286. return offset + 4
  7287. }
  7288. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7289. value = +value
  7290. offset = offset | 0
  7291. if (!noAssert) {
  7292. var limit = Math.pow(2, 8 * byteLength - 1)
  7293. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7294. }
  7295. var i = 0
  7296. var mul = 1
  7297. var sub = 0
  7298. this[offset] = value & 0xFF
  7299. while (++i < byteLength && (mul *= 0x100)) {
  7300. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7301. sub = 1
  7302. }
  7303. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7304. }
  7305. return offset + byteLength
  7306. }
  7307. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7308. value = +value
  7309. offset = offset | 0
  7310. if (!noAssert) {
  7311. var limit = Math.pow(2, 8 * byteLength - 1)
  7312. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7313. }
  7314. var i = byteLength - 1
  7315. var mul = 1
  7316. var sub = 0
  7317. this[offset + i] = value & 0xFF
  7318. while (--i >= 0 && (mul *= 0x100)) {
  7319. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7320. sub = 1
  7321. }
  7322. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7323. }
  7324. return offset + byteLength
  7325. }
  7326. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7327. value = +value
  7328. offset = offset | 0
  7329. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7330. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7331. if (value < 0) value = 0xff + value + 1
  7332. this[offset] = (value & 0xff)
  7333. return offset + 1
  7334. }
  7335. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7336. value = +value
  7337. offset = offset | 0
  7338. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7339. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7340. this[offset] = (value & 0xff)
  7341. this[offset + 1] = (value >>> 8)
  7342. } else {
  7343. objectWriteUInt16(this, value, offset, true)
  7344. }
  7345. return offset + 2
  7346. }
  7347. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7348. value = +value
  7349. offset = offset | 0
  7350. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7351. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7352. this[offset] = (value >>> 8)
  7353. this[offset + 1] = (value & 0xff)
  7354. } else {
  7355. objectWriteUInt16(this, value, offset, false)
  7356. }
  7357. return offset + 2
  7358. }
  7359. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7360. value = +value
  7361. offset = offset | 0
  7362. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7363. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7364. this[offset] = (value & 0xff)
  7365. this[offset + 1] = (value >>> 8)
  7366. this[offset + 2] = (value >>> 16)
  7367. this[offset + 3] = (value >>> 24)
  7368. } else {
  7369. objectWriteUInt32(this, value, offset, true)
  7370. }
  7371. return offset + 4
  7372. }
  7373. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7374. value = +value
  7375. offset = offset | 0
  7376. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7377. if (value < 0) value = 0xffffffff + value + 1
  7378. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7379. this[offset] = (value >>> 24)
  7380. this[offset + 1] = (value >>> 16)
  7381. this[offset + 2] = (value >>> 8)
  7382. this[offset + 3] = (value & 0xff)
  7383. } else {
  7384. objectWriteUInt32(this, value, offset, false)
  7385. }
  7386. return offset + 4
  7387. }
  7388. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7389. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7390. if (offset < 0) throw new RangeError('Index out of range')
  7391. }
  7392. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7393. if (!noAssert) {
  7394. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7395. }
  7396. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7397. return offset + 4
  7398. }
  7399. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7400. return writeFloat(this, value, offset, true, noAssert)
  7401. }
  7402. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7403. return writeFloat(this, value, offset, false, noAssert)
  7404. }
  7405. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7406. if (!noAssert) {
  7407. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7408. }
  7409. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7410. return offset + 8
  7411. }
  7412. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7413. return writeDouble(this, value, offset, true, noAssert)
  7414. }
  7415. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7416. return writeDouble(this, value, offset, false, noAssert)
  7417. }
  7418. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7419. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7420. if (!start) start = 0
  7421. if (!end && end !== 0) end = this.length
  7422. if (targetStart >= target.length) targetStart = target.length
  7423. if (!targetStart) targetStart = 0
  7424. if (end > 0 && end < start) end = start
  7425. // Copy 0 bytes; we're done
  7426. if (end === start) return 0
  7427. if (target.length === 0 || this.length === 0) return 0
  7428. // Fatal error conditions
  7429. if (targetStart < 0) {
  7430. throw new RangeError('targetStart out of bounds')
  7431. }
  7432. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7433. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7434. // Are we oob?
  7435. if (end > this.length) end = this.length
  7436. if (target.length - targetStart < end - start) {
  7437. end = target.length - targetStart + start
  7438. }
  7439. var len = end - start
  7440. var i
  7441. if (this === target && start < targetStart && targetStart < end) {
  7442. // descending copy from end
  7443. for (i = len - 1; i >= 0; --i) {
  7444. target[i + targetStart] = this[i + start]
  7445. }
  7446. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7447. // ascending copy from start
  7448. for (i = 0; i < len; ++i) {
  7449. target[i + targetStart] = this[i + start]
  7450. }
  7451. } else {
  7452. Uint8Array.prototype.set.call(
  7453. target,
  7454. this.subarray(start, start + len),
  7455. targetStart
  7456. )
  7457. }
  7458. return len
  7459. }
  7460. // Usage:
  7461. // buffer.fill(number[, offset[, end]])
  7462. // buffer.fill(buffer[, offset[, end]])
  7463. // buffer.fill(string[, offset[, end]][, encoding])
  7464. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7465. // Handle string cases:
  7466. if (typeof val === 'string') {
  7467. if (typeof start === 'string') {
  7468. encoding = start
  7469. start = 0
  7470. end = this.length
  7471. } else if (typeof end === 'string') {
  7472. encoding = end
  7473. end = this.length
  7474. }
  7475. if (val.length === 1) {
  7476. var code = val.charCodeAt(0)
  7477. if (code < 256) {
  7478. val = code
  7479. }
  7480. }
  7481. if (encoding !== undefined && typeof encoding !== 'string') {
  7482. throw new TypeError('encoding must be a string')
  7483. }
  7484. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7485. throw new TypeError('Unknown encoding: ' + encoding)
  7486. }
  7487. } else if (typeof val === 'number') {
  7488. val = val & 255
  7489. }
  7490. // Invalid ranges are not set to a default, so can range check early.
  7491. if (start < 0 || this.length < start || this.length < end) {
  7492. throw new RangeError('Out of range index')
  7493. }
  7494. if (end <= start) {
  7495. return this
  7496. }
  7497. start = start >>> 0
  7498. end = end === undefined ? this.length : end >>> 0
  7499. if (!val) val = 0
  7500. var i
  7501. if (typeof val === 'number') {
  7502. for (i = start; i < end; ++i) {
  7503. this[i] = val
  7504. }
  7505. } else {
  7506. var bytes = Buffer.isBuffer(val)
  7507. ? val
  7508. : utf8ToBytes(new Buffer(val, encoding).toString())
  7509. var len = bytes.length
  7510. for (i = 0; i < end - start; ++i) {
  7511. this[i + start] = bytes[i % len]
  7512. }
  7513. }
  7514. return this
  7515. }
  7516. // HELPER FUNCTIONS
  7517. // ================
  7518. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7519. function base64clean (str) {
  7520. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7521. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7522. // Node converts strings with length < 2 to ''
  7523. if (str.length < 2) return ''
  7524. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7525. while (str.length % 4 !== 0) {
  7526. str = str + '='
  7527. }
  7528. return str
  7529. }
  7530. function stringtrim (str) {
  7531. if (str.trim) return str.trim()
  7532. return str.replace(/^\s+|\s+$/g, '')
  7533. }
  7534. function toHex (n) {
  7535. if (n < 16) return '0' + n.toString(16)
  7536. return n.toString(16)
  7537. }
  7538. function utf8ToBytes (string, units) {
  7539. units = units || Infinity
  7540. var codePoint
  7541. var length = string.length
  7542. var leadSurrogate = null
  7543. var bytes = []
  7544. for (var i = 0; i < length; ++i) {
  7545. codePoint = string.charCodeAt(i)
  7546. // is surrogate component
  7547. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7548. // last char was a lead
  7549. if (!leadSurrogate) {
  7550. // no lead yet
  7551. if (codePoint > 0xDBFF) {
  7552. // unexpected trail
  7553. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7554. continue
  7555. } else if (i + 1 === length) {
  7556. // unpaired lead
  7557. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7558. continue
  7559. }
  7560. // valid lead
  7561. leadSurrogate = codePoint
  7562. continue
  7563. }
  7564. // 2 leads in a row
  7565. if (codePoint < 0xDC00) {
  7566. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7567. leadSurrogate = codePoint
  7568. continue
  7569. }
  7570. // valid surrogate pair
  7571. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7572. } else if (leadSurrogate) {
  7573. // valid bmp char, but last char was a lead
  7574. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7575. }
  7576. leadSurrogate = null
  7577. // encode utf8
  7578. if (codePoint < 0x80) {
  7579. if ((units -= 1) < 0) break
  7580. bytes.push(codePoint)
  7581. } else if (codePoint < 0x800) {
  7582. if ((units -= 2) < 0) break
  7583. bytes.push(
  7584. codePoint >> 0x6 | 0xC0,
  7585. codePoint & 0x3F | 0x80
  7586. )
  7587. } else if (codePoint < 0x10000) {
  7588. if ((units -= 3) < 0) break
  7589. bytes.push(
  7590. codePoint >> 0xC | 0xE0,
  7591. codePoint >> 0x6 & 0x3F | 0x80,
  7592. codePoint & 0x3F | 0x80
  7593. )
  7594. } else if (codePoint < 0x110000) {
  7595. if ((units -= 4) < 0) break
  7596. bytes.push(
  7597. codePoint >> 0x12 | 0xF0,
  7598. codePoint >> 0xC & 0x3F | 0x80,
  7599. codePoint >> 0x6 & 0x3F | 0x80,
  7600. codePoint & 0x3F | 0x80
  7601. )
  7602. } else {
  7603. throw new Error('Invalid code point')
  7604. }
  7605. }
  7606. return bytes
  7607. }
  7608. function asciiToBytes (str) {
  7609. var byteArray = []
  7610. for (var i = 0; i < str.length; ++i) {
  7611. // Node's code seems to be doing this and not & 0x7F..
  7612. byteArray.push(str.charCodeAt(i) & 0xFF)
  7613. }
  7614. return byteArray
  7615. }
  7616. function utf16leToBytes (str, units) {
  7617. var c, hi, lo
  7618. var byteArray = []
  7619. for (var i = 0; i < str.length; ++i) {
  7620. if ((units -= 2) < 0) break
  7621. c = str.charCodeAt(i)
  7622. hi = c >> 8
  7623. lo = c % 256
  7624. byteArray.push(lo)
  7625. byteArray.push(hi)
  7626. }
  7627. return byteArray
  7628. }
  7629. function base64ToBytes (str) {
  7630. return base64.toByteArray(base64clean(str))
  7631. }
  7632. function blitBuffer (src, dst, offset, length) {
  7633. for (var i = 0; i < length; ++i) {
  7634. if ((i + offset >= dst.length) || (i >= src.length)) break
  7635. dst[i + offset] = src[i]
  7636. }
  7637. return i
  7638. }
  7639. function isnan (val) {
  7640. return val !== val // eslint-disable-line no-self-compare
  7641. }
  7642. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7643. /***/ }),
  7644. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7645. /*!**************************************************!*\
  7646. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7647. \**************************************************/
  7648. /*! no static exports found */
  7649. /***/ (function(module, exports, __webpack_require__) {
  7650. /*!
  7651. * clipboard.js v2.0.4
  7652. * https://zenorocha.github.io/clipboard.js
  7653. *
  7654. * Licensed MIT © Zeno Rocha
  7655. */
  7656. (function webpackUniversalModuleDefinition(root, factory) {
  7657. if(true)
  7658. module.exports = factory();
  7659. else {}
  7660. })(this, function() {
  7661. return /******/ (function(modules) { // webpackBootstrap
  7662. /******/ // The module cache
  7663. /******/ var installedModules = {};
  7664. /******/
  7665. /******/ // The require function
  7666. /******/ function __webpack_require__(moduleId) {
  7667. /******/
  7668. /******/ // Check if module is in cache
  7669. /******/ if(installedModules[moduleId]) {
  7670. /******/ return installedModules[moduleId].exports;
  7671. /******/ }
  7672. /******/ // Create a new module (and put it into the cache)
  7673. /******/ var module = installedModules[moduleId] = {
  7674. /******/ i: moduleId,
  7675. /******/ l: false,
  7676. /******/ exports: {}
  7677. /******/ };
  7678. /******/
  7679. /******/ // Execute the module function
  7680. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7681. /******/
  7682. /******/ // Flag the module as loaded
  7683. /******/ module.l = true;
  7684. /******/
  7685. /******/ // Return the exports of the module
  7686. /******/ return module.exports;
  7687. /******/ }
  7688. /******/
  7689. /******/
  7690. /******/ // expose the modules object (__webpack_modules__)
  7691. /******/ __webpack_require__.m = modules;
  7692. /******/
  7693. /******/ // expose the module cache
  7694. /******/ __webpack_require__.c = installedModules;
  7695. /******/
  7696. /******/ // define getter function for harmony exports
  7697. /******/ __webpack_require__.d = function(exports, name, getter) {
  7698. /******/ if(!__webpack_require__.o(exports, name)) {
  7699. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7700. /******/ }
  7701. /******/ };
  7702. /******/
  7703. /******/ // define __esModule on exports
  7704. /******/ __webpack_require__.r = function(exports) {
  7705. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7706. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7707. /******/ }
  7708. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7709. /******/ };
  7710. /******/
  7711. /******/ // create a fake namespace object
  7712. /******/ // mode & 1: value is a module id, require it
  7713. /******/ // mode & 2: merge all properties of value into the ns
  7714. /******/ // mode & 4: return value when already ns object
  7715. /******/ // mode & 8|1: behave like require
  7716. /******/ __webpack_require__.t = function(value, mode) {
  7717. /******/ if(mode & 1) value = __webpack_require__(value);
  7718. /******/ if(mode & 8) return value;
  7719. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7720. /******/ var ns = Object.create(null);
  7721. /******/ __webpack_require__.r(ns);
  7722. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7723. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7724. /******/ return ns;
  7725. /******/ };
  7726. /******/
  7727. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7728. /******/ __webpack_require__.n = function(module) {
  7729. /******/ var getter = module && module.__esModule ?
  7730. /******/ function getDefault() { return module['default']; } :
  7731. /******/ function getModuleExports() { return module; };
  7732. /******/ __webpack_require__.d(getter, 'a', getter);
  7733. /******/ return getter;
  7734. /******/ };
  7735. /******/
  7736. /******/ // Object.prototype.hasOwnProperty.call
  7737. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7738. /******/
  7739. /******/ // __webpack_public_path__
  7740. /******/ __webpack_require__.p = "";
  7741. /******/
  7742. /******/
  7743. /******/ // Load entry module and return exports
  7744. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7745. /******/ })
  7746. /************************************************************************/
  7747. /******/ ([
  7748. /* 0 */
  7749. /***/ (function(module, exports, __webpack_require__) {
  7750. "use strict";
  7751. 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; };
  7752. 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; }; }();
  7753. var _clipboardAction = __webpack_require__(1);
  7754. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7755. var _tinyEmitter = __webpack_require__(3);
  7756. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7757. var _goodListener = __webpack_require__(4);
  7758. var _goodListener2 = _interopRequireDefault(_goodListener);
  7759. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7760. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7761. 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; }
  7762. 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; }
  7763. /**
  7764. * Base class which takes one or more elements, adds event listeners to them,
  7765. * and instantiates a new `ClipboardAction` on each click.
  7766. */
  7767. var Clipboard = function (_Emitter) {
  7768. _inherits(Clipboard, _Emitter);
  7769. /**
  7770. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7771. * @param {Object} options
  7772. */
  7773. function Clipboard(trigger, options) {
  7774. _classCallCheck(this, Clipboard);
  7775. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7776. _this.resolveOptions(options);
  7777. _this.listenClick(trigger);
  7778. return _this;
  7779. }
  7780. /**
  7781. * Defines if attributes would be resolved using internal setter functions
  7782. * or custom functions that were passed in the constructor.
  7783. * @param {Object} options
  7784. */
  7785. _createClass(Clipboard, [{
  7786. key: 'resolveOptions',
  7787. value: function resolveOptions() {
  7788. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7789. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7790. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7791. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7792. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7793. }
  7794. /**
  7795. * Adds a click event listener to the passed trigger.
  7796. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7797. */
  7798. }, {
  7799. key: 'listenClick',
  7800. value: function listenClick(trigger) {
  7801. var _this2 = this;
  7802. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7803. return _this2.onClick(e);
  7804. });
  7805. }
  7806. /**
  7807. * Defines a new `ClipboardAction` on each click event.
  7808. * @param {Event} e
  7809. */
  7810. }, {
  7811. key: 'onClick',
  7812. value: function onClick(e) {
  7813. var trigger = e.delegateTarget || e.currentTarget;
  7814. if (this.clipboardAction) {
  7815. this.clipboardAction = null;
  7816. }
  7817. this.clipboardAction = new _clipboardAction2.default({
  7818. action: this.action(trigger),
  7819. target: this.target(trigger),
  7820. text: this.text(trigger),
  7821. container: this.container,
  7822. trigger: trigger,
  7823. emitter: this
  7824. });
  7825. }
  7826. /**
  7827. * Default `action` lookup function.
  7828. * @param {Element} trigger
  7829. */
  7830. }, {
  7831. key: 'defaultAction',
  7832. value: function defaultAction(trigger) {
  7833. return getAttributeValue('action', trigger);
  7834. }
  7835. /**
  7836. * Default `target` lookup function.
  7837. * @param {Element} trigger
  7838. */
  7839. }, {
  7840. key: 'defaultTarget',
  7841. value: function defaultTarget(trigger) {
  7842. var selector = getAttributeValue('target', trigger);
  7843. if (selector) {
  7844. return document.querySelector(selector);
  7845. }
  7846. }
  7847. /**
  7848. * Returns the support of the given action, or all actions if no action is
  7849. * given.
  7850. * @param {String} [action]
  7851. */
  7852. }, {
  7853. key: 'defaultText',
  7854. /**
  7855. * Default `text` lookup function.
  7856. * @param {Element} trigger
  7857. */
  7858. value: function defaultText(trigger) {
  7859. return getAttributeValue('text', trigger);
  7860. }
  7861. /**
  7862. * Destroy lifecycle.
  7863. */
  7864. }, {
  7865. key: 'destroy',
  7866. value: function destroy() {
  7867. this.listener.destroy();
  7868. if (this.clipboardAction) {
  7869. this.clipboardAction.destroy();
  7870. this.clipboardAction = null;
  7871. }
  7872. }
  7873. }], [{
  7874. key: 'isSupported',
  7875. value: function isSupported() {
  7876. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7877. var actions = typeof action === 'string' ? [action] : action;
  7878. var support = !!document.queryCommandSupported;
  7879. actions.forEach(function (action) {
  7880. support = support && !!document.queryCommandSupported(action);
  7881. });
  7882. return support;
  7883. }
  7884. }]);
  7885. return Clipboard;
  7886. }(_tinyEmitter2.default);
  7887. /**
  7888. * Helper function to retrieve attribute value.
  7889. * @param {String} suffix
  7890. * @param {Element} element
  7891. */
  7892. function getAttributeValue(suffix, element) {
  7893. var attribute = 'data-clipboard-' + suffix;
  7894. if (!element.hasAttribute(attribute)) {
  7895. return;
  7896. }
  7897. return element.getAttribute(attribute);
  7898. }
  7899. module.exports = Clipboard;
  7900. /***/ }),
  7901. /* 1 */
  7902. /***/ (function(module, exports, __webpack_require__) {
  7903. "use strict";
  7904. 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; };
  7905. 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; }; }();
  7906. var _select = __webpack_require__(2);
  7907. var _select2 = _interopRequireDefault(_select);
  7908. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7909. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7910. /**
  7911. * Inner class which performs selection from either `text` or `target`
  7912. * properties and then executes copy or cut operations.
  7913. */
  7914. var ClipboardAction = function () {
  7915. /**
  7916. * @param {Object} options
  7917. */
  7918. function ClipboardAction(options) {
  7919. _classCallCheck(this, ClipboardAction);
  7920. this.resolveOptions(options);
  7921. this.initSelection();
  7922. }
  7923. /**
  7924. * Defines base properties passed from constructor.
  7925. * @param {Object} options
  7926. */
  7927. _createClass(ClipboardAction, [{
  7928. key: 'resolveOptions',
  7929. value: function resolveOptions() {
  7930. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7931. this.action = options.action;
  7932. this.container = options.container;
  7933. this.emitter = options.emitter;
  7934. this.target = options.target;
  7935. this.text = options.text;
  7936. this.trigger = options.trigger;
  7937. this.selectedText = '';
  7938. }
  7939. /**
  7940. * Decides which selection strategy is going to be applied based
  7941. * on the existence of `text` and `target` properties.
  7942. */
  7943. }, {
  7944. key: 'initSelection',
  7945. value: function initSelection() {
  7946. if (this.text) {
  7947. this.selectFake();
  7948. } else if (this.target) {
  7949. this.selectTarget();
  7950. }
  7951. }
  7952. /**
  7953. * Creates a fake textarea element, sets its value from `text` property,
  7954. * and makes a selection on it.
  7955. */
  7956. }, {
  7957. key: 'selectFake',
  7958. value: function selectFake() {
  7959. var _this = this;
  7960. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7961. this.removeFake();
  7962. this.fakeHandlerCallback = function () {
  7963. return _this.removeFake();
  7964. };
  7965. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7966. this.fakeElem = document.createElement('textarea');
  7967. // Prevent zooming on iOS
  7968. this.fakeElem.style.fontSize = '12pt';
  7969. // Reset box model
  7970. this.fakeElem.style.border = '0';
  7971. this.fakeElem.style.padding = '0';
  7972. this.fakeElem.style.margin = '0';
  7973. // Move element out of screen horizontally
  7974. this.fakeElem.style.position = 'absolute';
  7975. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7976. // Move element to the same position vertically
  7977. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7978. this.fakeElem.style.top = yPosition + 'px';
  7979. this.fakeElem.setAttribute('readonly', '');
  7980. this.fakeElem.value = this.text;
  7981. this.container.appendChild(this.fakeElem);
  7982. this.selectedText = (0, _select2.default)(this.fakeElem);
  7983. this.copyText();
  7984. }
  7985. /**
  7986. * Only removes the fake element after another click event, that way
  7987. * a user can hit `Ctrl+C` to copy because selection still exists.
  7988. */
  7989. }, {
  7990. key: 'removeFake',
  7991. value: function removeFake() {
  7992. if (this.fakeHandler) {
  7993. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7994. this.fakeHandler = null;
  7995. this.fakeHandlerCallback = null;
  7996. }
  7997. if (this.fakeElem) {
  7998. this.container.removeChild(this.fakeElem);
  7999. this.fakeElem = null;
  8000. }
  8001. }
  8002. /**
  8003. * Selects the content from element passed on `target` property.
  8004. */
  8005. }, {
  8006. key: 'selectTarget',
  8007. value: function selectTarget() {
  8008. this.selectedText = (0, _select2.default)(this.target);
  8009. this.copyText();
  8010. }
  8011. /**
  8012. * Executes the copy operation based on the current selection.
  8013. */
  8014. }, {
  8015. key: 'copyText',
  8016. value: function copyText() {
  8017. var succeeded = void 0;
  8018. try {
  8019. succeeded = document.execCommand(this.action);
  8020. } catch (err) {
  8021. succeeded = false;
  8022. }
  8023. this.handleResult(succeeded);
  8024. }
  8025. /**
  8026. * Fires an event based on the copy operation result.
  8027. * @param {Boolean} succeeded
  8028. */
  8029. }, {
  8030. key: 'handleResult',
  8031. value: function handleResult(succeeded) {
  8032. this.emitter.emit(succeeded ? 'success' : 'error', {
  8033. action: this.action,
  8034. text: this.selectedText,
  8035. trigger: this.trigger,
  8036. clearSelection: this.clearSelection.bind(this)
  8037. });
  8038. }
  8039. /**
  8040. * Moves focus away from `target` and back to the trigger, removes current selection.
  8041. */
  8042. }, {
  8043. key: 'clearSelection',
  8044. value: function clearSelection() {
  8045. if (this.trigger) {
  8046. this.trigger.focus();
  8047. }
  8048. window.getSelection().removeAllRanges();
  8049. }
  8050. /**
  8051. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8052. * @param {String} action
  8053. */
  8054. }, {
  8055. key: 'destroy',
  8056. /**
  8057. * Destroy lifecycle.
  8058. */
  8059. value: function destroy() {
  8060. this.removeFake();
  8061. }
  8062. }, {
  8063. key: 'action',
  8064. set: function set() {
  8065. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8066. this._action = action;
  8067. if (this._action !== 'copy' && this._action !== 'cut') {
  8068. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8069. }
  8070. }
  8071. /**
  8072. * Gets the `action` property.
  8073. * @return {String}
  8074. */
  8075. ,
  8076. get: function get() {
  8077. return this._action;
  8078. }
  8079. /**
  8080. * Sets the `target` property using an element
  8081. * that will be have its content copied.
  8082. * @param {Element} target
  8083. */
  8084. }, {
  8085. key: 'target',
  8086. set: function set(target) {
  8087. if (target !== undefined) {
  8088. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8089. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8090. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8091. }
  8092. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8093. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8094. }
  8095. this._target = target;
  8096. } else {
  8097. throw new Error('Invalid "target" value, use a valid Element');
  8098. }
  8099. }
  8100. }
  8101. /**
  8102. * Gets the `target` property.
  8103. * @return {String|HTMLElement}
  8104. */
  8105. ,
  8106. get: function get() {
  8107. return this._target;
  8108. }
  8109. }]);
  8110. return ClipboardAction;
  8111. }();
  8112. module.exports = ClipboardAction;
  8113. /***/ }),
  8114. /* 2 */
  8115. /***/ (function(module, exports) {
  8116. function select(element) {
  8117. var selectedText;
  8118. if (element.nodeName === 'SELECT') {
  8119. element.focus();
  8120. selectedText = element.value;
  8121. }
  8122. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8123. var isReadOnly = element.hasAttribute('readonly');
  8124. if (!isReadOnly) {
  8125. element.setAttribute('readonly', '');
  8126. }
  8127. element.select();
  8128. element.setSelectionRange(0, element.value.length);
  8129. if (!isReadOnly) {
  8130. element.removeAttribute('readonly');
  8131. }
  8132. selectedText = element.value;
  8133. }
  8134. else {
  8135. if (element.hasAttribute('contenteditable')) {
  8136. element.focus();
  8137. }
  8138. var selection = window.getSelection();
  8139. var range = document.createRange();
  8140. range.selectNodeContents(element);
  8141. selection.removeAllRanges();
  8142. selection.addRange(range);
  8143. selectedText = selection.toString();
  8144. }
  8145. return selectedText;
  8146. }
  8147. module.exports = select;
  8148. /***/ }),
  8149. /* 3 */
  8150. /***/ (function(module, exports) {
  8151. function E () {
  8152. // Keep this empty so it's easier to inherit from
  8153. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8154. }
  8155. E.prototype = {
  8156. on: function (name, callback, ctx) {
  8157. var e = this.e || (this.e = {});
  8158. (e[name] || (e[name] = [])).push({
  8159. fn: callback,
  8160. ctx: ctx
  8161. });
  8162. return this;
  8163. },
  8164. once: function (name, callback, ctx) {
  8165. var self = this;
  8166. function listener () {
  8167. self.off(name, listener);
  8168. callback.apply(ctx, arguments);
  8169. };
  8170. listener._ = callback
  8171. return this.on(name, listener, ctx);
  8172. },
  8173. emit: function (name) {
  8174. var data = [].slice.call(arguments, 1);
  8175. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8176. var i = 0;
  8177. var len = evtArr.length;
  8178. for (i; i < len; i++) {
  8179. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8180. }
  8181. return this;
  8182. },
  8183. off: function (name, callback) {
  8184. var e = this.e || (this.e = {});
  8185. var evts = e[name];
  8186. var liveEvents = [];
  8187. if (evts && callback) {
  8188. for (var i = 0, len = evts.length; i < len; i++) {
  8189. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8190. liveEvents.push(evts[i]);
  8191. }
  8192. }
  8193. // Remove event from queue to prevent memory leak
  8194. // Suggested by https://github.com/lazd
  8195. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8196. (liveEvents.length)
  8197. ? e[name] = liveEvents
  8198. : delete e[name];
  8199. return this;
  8200. }
  8201. };
  8202. module.exports = E;
  8203. /***/ }),
  8204. /* 4 */
  8205. /***/ (function(module, exports, __webpack_require__) {
  8206. var is = __webpack_require__(5);
  8207. var delegate = __webpack_require__(6);
  8208. /**
  8209. * Validates all params and calls the right
  8210. * listener function based on its target type.
  8211. *
  8212. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8213. * @param {String} type
  8214. * @param {Function} callback
  8215. * @return {Object}
  8216. */
  8217. function listen(target, type, callback) {
  8218. if (!target && !type && !callback) {
  8219. throw new Error('Missing required arguments');
  8220. }
  8221. if (!is.string(type)) {
  8222. throw new TypeError('Second argument must be a String');
  8223. }
  8224. if (!is.fn(callback)) {
  8225. throw new TypeError('Third argument must be a Function');
  8226. }
  8227. if (is.node(target)) {
  8228. return listenNode(target, type, callback);
  8229. }
  8230. else if (is.nodeList(target)) {
  8231. return listenNodeList(target, type, callback);
  8232. }
  8233. else if (is.string(target)) {
  8234. return listenSelector(target, type, callback);
  8235. }
  8236. else {
  8237. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8238. }
  8239. }
  8240. /**
  8241. * Adds an event listener to a HTML element
  8242. * and returns a remove listener function.
  8243. *
  8244. * @param {HTMLElement} node
  8245. * @param {String} type
  8246. * @param {Function} callback
  8247. * @return {Object}
  8248. */
  8249. function listenNode(node, type, callback) {
  8250. node.addEventListener(type, callback);
  8251. return {
  8252. destroy: function() {
  8253. node.removeEventListener(type, callback);
  8254. }
  8255. }
  8256. }
  8257. /**
  8258. * Add an event listener to a list of HTML elements
  8259. * and returns a remove listener function.
  8260. *
  8261. * @param {NodeList|HTMLCollection} nodeList
  8262. * @param {String} type
  8263. * @param {Function} callback
  8264. * @return {Object}
  8265. */
  8266. function listenNodeList(nodeList, type, callback) {
  8267. Array.prototype.forEach.call(nodeList, function(node) {
  8268. node.addEventListener(type, callback);
  8269. });
  8270. return {
  8271. destroy: function() {
  8272. Array.prototype.forEach.call(nodeList, function(node) {
  8273. node.removeEventListener(type, callback);
  8274. });
  8275. }
  8276. }
  8277. }
  8278. /**
  8279. * Add an event listener to a selector
  8280. * and returns a remove listener function.
  8281. *
  8282. * @param {String} selector
  8283. * @param {String} type
  8284. * @param {Function} callback
  8285. * @return {Object}
  8286. */
  8287. function listenSelector(selector, type, callback) {
  8288. return delegate(document.body, selector, type, callback);
  8289. }
  8290. module.exports = listen;
  8291. /***/ }),
  8292. /* 5 */
  8293. /***/ (function(module, exports) {
  8294. /**
  8295. * Check if argument is a HTML element.
  8296. *
  8297. * @param {Object} value
  8298. * @return {Boolean}
  8299. */
  8300. exports.node = function(value) {
  8301. return value !== undefined
  8302. && value instanceof HTMLElement
  8303. && value.nodeType === 1;
  8304. };
  8305. /**
  8306. * Check if argument is a list of HTML elements.
  8307. *
  8308. * @param {Object} value
  8309. * @return {Boolean}
  8310. */
  8311. exports.nodeList = function(value) {
  8312. var type = Object.prototype.toString.call(value);
  8313. return value !== undefined
  8314. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8315. && ('length' in value)
  8316. && (value.length === 0 || exports.node(value[0]));
  8317. };
  8318. /**
  8319. * Check if argument is a string.
  8320. *
  8321. * @param {Object} value
  8322. * @return {Boolean}
  8323. */
  8324. exports.string = function(value) {
  8325. return typeof value === 'string'
  8326. || value instanceof String;
  8327. };
  8328. /**
  8329. * Check if argument is a function.
  8330. *
  8331. * @param {Object} value
  8332. * @return {Boolean}
  8333. */
  8334. exports.fn = function(value) {
  8335. var type = Object.prototype.toString.call(value);
  8336. return type === '[object Function]';
  8337. };
  8338. /***/ }),
  8339. /* 6 */
  8340. /***/ (function(module, exports, __webpack_require__) {
  8341. var closest = __webpack_require__(7);
  8342. /**
  8343. * Delegates event to a selector.
  8344. *
  8345. * @param {Element} element
  8346. * @param {String} selector
  8347. * @param {String} type
  8348. * @param {Function} callback
  8349. * @param {Boolean} useCapture
  8350. * @return {Object}
  8351. */
  8352. function _delegate(element, selector, type, callback, useCapture) {
  8353. var listenerFn = listener.apply(this, arguments);
  8354. element.addEventListener(type, listenerFn, useCapture);
  8355. return {
  8356. destroy: function() {
  8357. element.removeEventListener(type, listenerFn, useCapture);
  8358. }
  8359. }
  8360. }
  8361. /**
  8362. * Delegates event to a selector.
  8363. *
  8364. * @param {Element|String|Array} [elements]
  8365. * @param {String} selector
  8366. * @param {String} type
  8367. * @param {Function} callback
  8368. * @param {Boolean} useCapture
  8369. * @return {Object}
  8370. */
  8371. function delegate(elements, selector, type, callback, useCapture) {
  8372. // Handle the regular Element usage
  8373. if (typeof elements.addEventListener === 'function') {
  8374. return _delegate.apply(null, arguments);
  8375. }
  8376. // Handle Element-less usage, it defaults to global delegation
  8377. if (typeof type === 'function') {
  8378. // Use `document` as the first parameter, then apply arguments
  8379. // This is a short way to .unshift `arguments` without running into deoptimizations
  8380. return _delegate.bind(null, document).apply(null, arguments);
  8381. }
  8382. // Handle Selector-based usage
  8383. if (typeof elements === 'string') {
  8384. elements = document.querySelectorAll(elements);
  8385. }
  8386. // Handle Array-like based usage
  8387. return Array.prototype.map.call(elements, function (element) {
  8388. return _delegate(element, selector, type, callback, useCapture);
  8389. });
  8390. }
  8391. /**
  8392. * Finds closest match and invokes callback.
  8393. *
  8394. * @param {Element} element
  8395. * @param {String} selector
  8396. * @param {String} type
  8397. * @param {Function} callback
  8398. * @return {Function}
  8399. */
  8400. function listener(element, selector, type, callback) {
  8401. return function(e) {
  8402. e.delegateTarget = closest(e.target, selector);
  8403. if (e.delegateTarget) {
  8404. callback.call(element, e);
  8405. }
  8406. }
  8407. }
  8408. module.exports = delegate;
  8409. /***/ }),
  8410. /* 7 */
  8411. /***/ (function(module, exports) {
  8412. var DOCUMENT_NODE_TYPE = 9;
  8413. /**
  8414. * A polyfill for Element.matches()
  8415. */
  8416. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8417. var proto = Element.prototype;
  8418. proto.matches = proto.matchesSelector ||
  8419. proto.mozMatchesSelector ||
  8420. proto.msMatchesSelector ||
  8421. proto.oMatchesSelector ||
  8422. proto.webkitMatchesSelector;
  8423. }
  8424. /**
  8425. * Finds the closest parent that matches a selector.
  8426. *
  8427. * @param {Element} element
  8428. * @param {String} selector
  8429. * @return {Function}
  8430. */
  8431. function closest (element, selector) {
  8432. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8433. if (typeof element.matches === 'function' &&
  8434. element.matches(selector)) {
  8435. return element;
  8436. }
  8437. element = element.parentNode;
  8438. }
  8439. }
  8440. module.exports = closest;
  8441. /***/ })
  8442. /******/ ]);
  8443. });
  8444. /***/ }),
  8445. /***/ "./node_modules/ieee754/index.js":
  8446. /*!***************************************!*\
  8447. !*** ./node_modules/ieee754/index.js ***!
  8448. \***************************************/
  8449. /*! no static exports found */
  8450. /***/ (function(module, exports) {
  8451. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8452. var e, m
  8453. var eLen = (nBytes * 8) - mLen - 1
  8454. var eMax = (1 << eLen) - 1
  8455. var eBias = eMax >> 1
  8456. var nBits = -7
  8457. var i = isLE ? (nBytes - 1) : 0
  8458. var d = isLE ? -1 : 1
  8459. var s = buffer[offset + i]
  8460. i += d
  8461. e = s & ((1 << (-nBits)) - 1)
  8462. s >>= (-nBits)
  8463. nBits += eLen
  8464. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8465. m = e & ((1 << (-nBits)) - 1)
  8466. e >>= (-nBits)
  8467. nBits += mLen
  8468. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8469. if (e === 0) {
  8470. e = 1 - eBias
  8471. } else if (e === eMax) {
  8472. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8473. } else {
  8474. m = m + Math.pow(2, mLen)
  8475. e = e - eBias
  8476. }
  8477. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8478. }
  8479. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8480. var e, m, c
  8481. var eLen = (nBytes * 8) - mLen - 1
  8482. var eMax = (1 << eLen) - 1
  8483. var eBias = eMax >> 1
  8484. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8485. var i = isLE ? 0 : (nBytes - 1)
  8486. var d = isLE ? 1 : -1
  8487. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8488. value = Math.abs(value)
  8489. if (isNaN(value) || value === Infinity) {
  8490. m = isNaN(value) ? 1 : 0
  8491. e = eMax
  8492. } else {
  8493. e = Math.floor(Math.log(value) / Math.LN2)
  8494. if (value * (c = Math.pow(2, -e)) < 1) {
  8495. e--
  8496. c *= 2
  8497. }
  8498. if (e + eBias >= 1) {
  8499. value += rt / c
  8500. } else {
  8501. value += rt * Math.pow(2, 1 - eBias)
  8502. }
  8503. if (value * c >= 2) {
  8504. e++
  8505. c /= 2
  8506. }
  8507. if (e + eBias >= eMax) {
  8508. m = 0
  8509. e = eMax
  8510. } else if (e + eBias >= 1) {
  8511. m = ((value * c) - 1) * Math.pow(2, mLen)
  8512. e = e + eBias
  8513. } else {
  8514. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8515. e = 0
  8516. }
  8517. }
  8518. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8519. e = (e << mLen) | m
  8520. eLen += mLen
  8521. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8522. buffer[offset + i - d] |= s * 128
  8523. }
  8524. /***/ }),
  8525. /***/ "./node_modules/isarray/index.js":
  8526. /*!***************************************!*\
  8527. !*** ./node_modules/isarray/index.js ***!
  8528. \***************************************/
  8529. /*! no static exports found */
  8530. /***/ (function(module, exports) {
  8531. var toString = {}.toString;
  8532. module.exports = Array.isArray || function (arr) {
  8533. return toString.call(arr) == '[object Array]';
  8534. };
  8535. /***/ }),
  8536. /***/ "./node_modules/jquery/dist/jquery.js":
  8537. /*!********************************************!*\
  8538. !*** ./node_modules/jquery/dist/jquery.js ***!
  8539. \********************************************/
  8540. /*! no static exports found */
  8541. /***/ (function(module, exports, __webpack_require__) {
  8542. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8543. * jQuery JavaScript Library v3.4.1
  8544. * https://jquery.com/
  8545. *
  8546. * Includes Sizzle.js
  8547. * https://sizzlejs.com/
  8548. *
  8549. * Copyright JS Foundation and other contributors
  8550. * Released under the MIT license
  8551. * https://jquery.org/license
  8552. *
  8553. * Date: 2019-05-01T21:04Z
  8554. */
  8555. ( function( global, factory ) {
  8556. "use strict";
  8557. if ( true && typeof module.exports === "object" ) {
  8558. // For CommonJS and CommonJS-like environments where a proper `window`
  8559. // is present, execute the factory and get jQuery.
  8560. // For environments that do not have a `window` with a `document`
  8561. // (such as Node.js), expose a factory as module.exports.
  8562. // This accentuates the need for the creation of a real `window`.
  8563. // e.g. var jQuery = require("jquery")(window);
  8564. // See ticket #14549 for more info.
  8565. module.exports = global.document ?
  8566. factory( global, true ) :
  8567. function( w ) {
  8568. if ( !w.document ) {
  8569. throw new Error( "jQuery requires a window with a document" );
  8570. }
  8571. return factory( w );
  8572. };
  8573. } else {
  8574. factory( global );
  8575. }
  8576. // Pass this if window is not defined yet
  8577. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8578. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8579. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8580. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8581. // enough that all such attempts are guarded in a try block.
  8582. "use strict";
  8583. var arr = [];
  8584. var document = window.document;
  8585. var getProto = Object.getPrototypeOf;
  8586. var slice = arr.slice;
  8587. var concat = arr.concat;
  8588. var push = arr.push;
  8589. var indexOf = arr.indexOf;
  8590. var class2type = {};
  8591. var toString = class2type.toString;
  8592. var hasOwn = class2type.hasOwnProperty;
  8593. var fnToString = hasOwn.toString;
  8594. var ObjectFunctionString = fnToString.call( Object );
  8595. var support = {};
  8596. var isFunction = function isFunction( obj ) {
  8597. // Support: Chrome <=57, Firefox <=52
  8598. // In some browsers, typeof returns "function" for HTML <object> elements
  8599. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8600. // We don't want to classify *any* DOM node as a function.
  8601. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8602. };
  8603. var isWindow = function isWindow( obj ) {
  8604. return obj != null && obj === obj.window;
  8605. };
  8606. var preservedScriptAttributes = {
  8607. type: true,
  8608. src: true,
  8609. nonce: true,
  8610. noModule: true
  8611. };
  8612. function DOMEval( code, node, doc ) {
  8613. doc = doc || document;
  8614. var i, val,
  8615. script = doc.createElement( "script" );
  8616. script.text = code;
  8617. if ( node ) {
  8618. for ( i in preservedScriptAttributes ) {
  8619. // Support: Firefox 64+, Edge 18+
  8620. // Some browsers don't support the "nonce" property on scripts.
  8621. // On the other hand, just using `getAttribute` is not enough as
  8622. // the `nonce` attribute is reset to an empty string whenever it
  8623. // becomes browsing-context connected.
  8624. // See https://github.com/whatwg/html/issues/2369
  8625. // See https://html.spec.whatwg.org/#nonce-attributes
  8626. // The `node.getAttribute` check was added for the sake of
  8627. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8628. // via an object.
  8629. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8630. if ( val ) {
  8631. script.setAttribute( i, val );
  8632. }
  8633. }
  8634. }
  8635. doc.head.appendChild( script ).parentNode.removeChild( script );
  8636. }
  8637. function toType( obj ) {
  8638. if ( obj == null ) {
  8639. return obj + "";
  8640. }
  8641. // Support: Android <=2.3 only (functionish RegExp)
  8642. return typeof obj === "object" || typeof obj === "function" ?
  8643. class2type[ toString.call( obj ) ] || "object" :
  8644. typeof obj;
  8645. }
  8646. /* global Symbol */
  8647. // Defining this global in .eslintrc.json would create a danger of using the global
  8648. // unguarded in another place, it seems safer to define global only for this module
  8649. var
  8650. version = "3.4.1",
  8651. // Define a local copy of jQuery
  8652. jQuery = function( selector, context ) {
  8653. // The jQuery object is actually just the init constructor 'enhanced'
  8654. // Need init if jQuery is called (just allow error to be thrown if not included)
  8655. return new jQuery.fn.init( selector, context );
  8656. },
  8657. // Support: Android <=4.0 only
  8658. // Make sure we trim BOM and NBSP
  8659. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8660. jQuery.fn = jQuery.prototype = {
  8661. // The current version of jQuery being used
  8662. jquery: version,
  8663. constructor: jQuery,
  8664. // The default length of a jQuery object is 0
  8665. length: 0,
  8666. toArray: function() {
  8667. return slice.call( this );
  8668. },
  8669. // Get the Nth element in the matched element set OR
  8670. // Get the whole matched element set as a clean array
  8671. get: function( num ) {
  8672. // Return all the elements in a clean array
  8673. if ( num == null ) {
  8674. return slice.call( this );
  8675. }
  8676. // Return just the one element from the set
  8677. return num < 0 ? this[ num + this.length ] : this[ num ];
  8678. },
  8679. // Take an array of elements and push it onto the stack
  8680. // (returning the new matched element set)
  8681. pushStack: function( elems ) {
  8682. // Build a new jQuery matched element set
  8683. var ret = jQuery.merge( this.constructor(), elems );
  8684. // Add the old object onto the stack (as a reference)
  8685. ret.prevObject = this;
  8686. // Return the newly-formed element set
  8687. return ret;
  8688. },
  8689. // Execute a callback for every element in the matched set.
  8690. each: function( callback ) {
  8691. return jQuery.each( this, callback );
  8692. },
  8693. map: function( callback ) {
  8694. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8695. return callback.call( elem, i, elem );
  8696. } ) );
  8697. },
  8698. slice: function() {
  8699. return this.pushStack( slice.apply( this, arguments ) );
  8700. },
  8701. first: function() {
  8702. return this.eq( 0 );
  8703. },
  8704. last: function() {
  8705. return this.eq( -1 );
  8706. },
  8707. eq: function( i ) {
  8708. var len = this.length,
  8709. j = +i + ( i < 0 ? len : 0 );
  8710. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8711. },
  8712. end: function() {
  8713. return this.prevObject || this.constructor();
  8714. },
  8715. // For internal use only.
  8716. // Behaves like an Array's method, not like a jQuery method.
  8717. push: push,
  8718. sort: arr.sort,
  8719. splice: arr.splice
  8720. };
  8721. jQuery.extend = jQuery.fn.extend = function() {
  8722. var options, name, src, copy, copyIsArray, clone,
  8723. target = arguments[ 0 ] || {},
  8724. i = 1,
  8725. length = arguments.length,
  8726. deep = false;
  8727. // Handle a deep copy situation
  8728. if ( typeof target === "boolean" ) {
  8729. deep = target;
  8730. // Skip the boolean and the target
  8731. target = arguments[ i ] || {};
  8732. i++;
  8733. }
  8734. // Handle case when target is a string or something (possible in deep copy)
  8735. if ( typeof target !== "object" && !isFunction( target ) ) {
  8736. target = {};
  8737. }
  8738. // Extend jQuery itself if only one argument is passed
  8739. if ( i === length ) {
  8740. target = this;
  8741. i--;
  8742. }
  8743. for ( ; i < length; i++ ) {
  8744. // Only deal with non-null/undefined values
  8745. if ( ( options = arguments[ i ] ) != null ) {
  8746. // Extend the base object
  8747. for ( name in options ) {
  8748. copy = options[ name ];
  8749. // Prevent Object.prototype pollution
  8750. // Prevent never-ending loop
  8751. if ( name === "__proto__" || target === copy ) {
  8752. continue;
  8753. }
  8754. // Recurse if we're merging plain objects or arrays
  8755. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8756. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8757. src = target[ name ];
  8758. // Ensure proper type for the source value
  8759. if ( copyIsArray && !Array.isArray( src ) ) {
  8760. clone = [];
  8761. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8762. clone = {};
  8763. } else {
  8764. clone = src;
  8765. }
  8766. copyIsArray = false;
  8767. // Never move original objects, clone them
  8768. target[ name ] = jQuery.extend( deep, clone, copy );
  8769. // Don't bring in undefined values
  8770. } else if ( copy !== undefined ) {
  8771. target[ name ] = copy;
  8772. }
  8773. }
  8774. }
  8775. }
  8776. // Return the modified object
  8777. return target;
  8778. };
  8779. jQuery.extend( {
  8780. // Unique for each copy of jQuery on the page
  8781. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8782. // Assume jQuery is ready without the ready module
  8783. isReady: true,
  8784. error: function( msg ) {
  8785. throw new Error( msg );
  8786. },
  8787. noop: function() {},
  8788. isPlainObject: function( obj ) {
  8789. var proto, Ctor;
  8790. // Detect obvious negatives
  8791. // Use toString instead of jQuery.type to catch host objects
  8792. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8793. return false;
  8794. }
  8795. proto = getProto( obj );
  8796. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8797. if ( !proto ) {
  8798. return true;
  8799. }
  8800. // Objects with prototype are plain iff they were constructed by a global Object function
  8801. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8802. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8803. },
  8804. isEmptyObject: function( obj ) {
  8805. var name;
  8806. for ( name in obj ) {
  8807. return false;
  8808. }
  8809. return true;
  8810. },
  8811. // Evaluates a script in a global context
  8812. globalEval: function( code, options ) {
  8813. DOMEval( code, { nonce: options && options.nonce } );
  8814. },
  8815. each: function( obj, callback ) {
  8816. var length, i = 0;
  8817. if ( isArrayLike( obj ) ) {
  8818. length = obj.length;
  8819. for ( ; i < length; i++ ) {
  8820. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8821. break;
  8822. }
  8823. }
  8824. } else {
  8825. for ( i in obj ) {
  8826. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8827. break;
  8828. }
  8829. }
  8830. }
  8831. return obj;
  8832. },
  8833. // Support: Android <=4.0 only
  8834. trim: function( text ) {
  8835. return text == null ?
  8836. "" :
  8837. ( text + "" ).replace( rtrim, "" );
  8838. },
  8839. // results is for internal usage only
  8840. makeArray: function( arr, results ) {
  8841. var ret = results || [];
  8842. if ( arr != null ) {
  8843. if ( isArrayLike( Object( arr ) ) ) {
  8844. jQuery.merge( ret,
  8845. typeof arr === "string" ?
  8846. [ arr ] : arr
  8847. );
  8848. } else {
  8849. push.call( ret, arr );
  8850. }
  8851. }
  8852. return ret;
  8853. },
  8854. inArray: function( elem, arr, i ) {
  8855. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8856. },
  8857. // Support: Android <=4.0 only, PhantomJS 1 only
  8858. // push.apply(_, arraylike) throws on ancient WebKit
  8859. merge: function( first, second ) {
  8860. var len = +second.length,
  8861. j = 0,
  8862. i = first.length;
  8863. for ( ; j < len; j++ ) {
  8864. first[ i++ ] = second[ j ];
  8865. }
  8866. first.length = i;
  8867. return first;
  8868. },
  8869. grep: function( elems, callback, invert ) {
  8870. var callbackInverse,
  8871. matches = [],
  8872. i = 0,
  8873. length = elems.length,
  8874. callbackExpect = !invert;
  8875. // Go through the array, only saving the items
  8876. // that pass the validator function
  8877. for ( ; i < length; i++ ) {
  8878. callbackInverse = !callback( elems[ i ], i );
  8879. if ( callbackInverse !== callbackExpect ) {
  8880. matches.push( elems[ i ] );
  8881. }
  8882. }
  8883. return matches;
  8884. },
  8885. // arg is for internal usage only
  8886. map: function( elems, callback, arg ) {
  8887. var length, value,
  8888. i = 0,
  8889. ret = [];
  8890. // Go through the array, translating each of the items to their new values
  8891. if ( isArrayLike( elems ) ) {
  8892. length = elems.length;
  8893. for ( ; i < length; i++ ) {
  8894. value = callback( elems[ i ], i, arg );
  8895. if ( value != null ) {
  8896. ret.push( value );
  8897. }
  8898. }
  8899. // Go through every key on the object,
  8900. } else {
  8901. for ( i in elems ) {
  8902. value = callback( elems[ i ], i, arg );
  8903. if ( value != null ) {
  8904. ret.push( value );
  8905. }
  8906. }
  8907. }
  8908. // Flatten any nested arrays
  8909. return concat.apply( [], ret );
  8910. },
  8911. // A global GUID counter for objects
  8912. guid: 1,
  8913. // jQuery.support is not used in Core but other projects attach their
  8914. // properties to it so it needs to exist.
  8915. support: support
  8916. } );
  8917. if ( typeof Symbol === "function" ) {
  8918. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8919. }
  8920. // Populate the class2type map
  8921. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8922. function( i, name ) {
  8923. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8924. } );
  8925. function isArrayLike( obj ) {
  8926. // Support: real iOS 8.2 only (not reproducible in simulator)
  8927. // `in` check used to prevent JIT error (gh-2145)
  8928. // hasOwn isn't used here due to false negatives
  8929. // regarding Nodelist length in IE
  8930. var length = !!obj && "length" in obj && obj.length,
  8931. type = toType( obj );
  8932. if ( isFunction( obj ) || isWindow( obj ) ) {
  8933. return false;
  8934. }
  8935. return type === "array" || length === 0 ||
  8936. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8937. }
  8938. var Sizzle =
  8939. /*!
  8940. * Sizzle CSS Selector Engine v2.3.4
  8941. * https://sizzlejs.com/
  8942. *
  8943. * Copyright JS Foundation and other contributors
  8944. * Released under the MIT license
  8945. * https://js.foundation/
  8946. *
  8947. * Date: 2019-04-08
  8948. */
  8949. (function( window ) {
  8950. var i,
  8951. support,
  8952. Expr,
  8953. getText,
  8954. isXML,
  8955. tokenize,
  8956. compile,
  8957. select,
  8958. outermostContext,
  8959. sortInput,
  8960. hasDuplicate,
  8961. // Local document vars
  8962. setDocument,
  8963. document,
  8964. docElem,
  8965. documentIsHTML,
  8966. rbuggyQSA,
  8967. rbuggyMatches,
  8968. matches,
  8969. contains,
  8970. // Instance-specific data
  8971. expando = "sizzle" + 1 * new Date(),
  8972. preferredDoc = window.document,
  8973. dirruns = 0,
  8974. done = 0,
  8975. classCache = createCache(),
  8976. tokenCache = createCache(),
  8977. compilerCache = createCache(),
  8978. nonnativeSelectorCache = createCache(),
  8979. sortOrder = function( a, b ) {
  8980. if ( a === b ) {
  8981. hasDuplicate = true;
  8982. }
  8983. return 0;
  8984. },
  8985. // Instance methods
  8986. hasOwn = ({}).hasOwnProperty,
  8987. arr = [],
  8988. pop = arr.pop,
  8989. push_native = arr.push,
  8990. push = arr.push,
  8991. slice = arr.slice,
  8992. // Use a stripped-down indexOf as it's faster than native
  8993. // https://jsperf.com/thor-indexof-vs-for/5
  8994. indexOf = function( list, elem ) {
  8995. var i = 0,
  8996. len = list.length;
  8997. for ( ; i < len; i++ ) {
  8998. if ( list[i] === elem ) {
  8999. return i;
  9000. }
  9001. }
  9002. return -1;
  9003. },
  9004. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9005. // Regular expressions
  9006. // http://www.w3.org/TR/css3-selectors/#whitespace
  9007. whitespace = "[\\x20\\t\\r\\n\\f]",
  9008. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9009. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9010. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9011. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9012. // Operator (capture 2)
  9013. "*([*^$|!~]?=)" + whitespace +
  9014. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9015. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9016. "*\\]",
  9017. pseudos = ":(" + identifier + ")(?:\\((" +
  9018. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9019. // 1. quoted (capture 3; capture 4 or capture 5)
  9020. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9021. // 2. simple (capture 6)
  9022. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9023. // 3. anything else (capture 2)
  9024. ".*" +
  9025. ")\\)|)",
  9026. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9027. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9028. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9029. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9030. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9031. rdescend = new RegExp( whitespace + "|>" ),
  9032. rpseudo = new RegExp( pseudos ),
  9033. ridentifier = new RegExp( "^" + identifier + "$" ),
  9034. matchExpr = {
  9035. "ID": new RegExp( "^#(" + identifier + ")" ),
  9036. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9037. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9038. "ATTR": new RegExp( "^" + attributes ),
  9039. "PSEUDO": new RegExp( "^" + pseudos ),
  9040. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9041. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9042. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9043. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9044. // For use in libraries implementing .is()
  9045. // We use this for POS matching in `select`
  9046. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9047. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9048. },
  9049. rhtml = /HTML$/i,
  9050. rinputs = /^(?:input|select|textarea|button)$/i,
  9051. rheader = /^h\d$/i,
  9052. rnative = /^[^{]+\{\s*\[native \w/,
  9053. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9054. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9055. rsibling = /[+~]/,
  9056. // CSS escapes
  9057. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9058. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9059. funescape = function( _, escaped, escapedWhitespace ) {
  9060. var high = "0x" + escaped - 0x10000;
  9061. // NaN means non-codepoint
  9062. // Support: Firefox<24
  9063. // Workaround erroneous numeric interpretation of +"0x"
  9064. return high !== high || escapedWhitespace ?
  9065. escaped :
  9066. high < 0 ?
  9067. // BMP codepoint
  9068. String.fromCharCode( high + 0x10000 ) :
  9069. // Supplemental Plane codepoint (surrogate pair)
  9070. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9071. },
  9072. // CSS string/identifier serialization
  9073. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9074. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9075. fcssescape = function( ch, asCodePoint ) {
  9076. if ( asCodePoint ) {
  9077. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9078. if ( ch === "\0" ) {
  9079. return "\uFFFD";
  9080. }
  9081. // Control characters and (dependent upon position) numbers get escaped as code points
  9082. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9083. }
  9084. // Other potentially-special ASCII characters get backslash-escaped
  9085. return "\\" + ch;
  9086. },
  9087. // Used for iframes
  9088. // See setDocument()
  9089. // Removing the function wrapper causes a "Permission Denied"
  9090. // error in IE
  9091. unloadHandler = function() {
  9092. setDocument();
  9093. },
  9094. inDisabledFieldset = addCombinator(
  9095. function( elem ) {
  9096. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9097. },
  9098. { dir: "parentNode", next: "legend" }
  9099. );
  9100. // Optimize for push.apply( _, NodeList )
  9101. try {
  9102. push.apply(
  9103. (arr = slice.call( preferredDoc.childNodes )),
  9104. preferredDoc.childNodes
  9105. );
  9106. // Support: Android<4.0
  9107. // Detect silently failing push.apply
  9108. arr[ preferredDoc.childNodes.length ].nodeType;
  9109. } catch ( e ) {
  9110. push = { apply: arr.length ?
  9111. // Leverage slice if possible
  9112. function( target, els ) {
  9113. push_native.apply( target, slice.call(els) );
  9114. } :
  9115. // Support: IE<9
  9116. // Otherwise append directly
  9117. function( target, els ) {
  9118. var j = target.length,
  9119. i = 0;
  9120. // Can't trust NodeList.length
  9121. while ( (target[j++] = els[i++]) ) {}
  9122. target.length = j - 1;
  9123. }
  9124. };
  9125. }
  9126. function Sizzle( selector, context, results, seed ) {
  9127. var m, i, elem, nid, match, groups, newSelector,
  9128. newContext = context && context.ownerDocument,
  9129. // nodeType defaults to 9, since context defaults to document
  9130. nodeType = context ? context.nodeType : 9;
  9131. results = results || [];
  9132. // Return early from calls with invalid selector or context
  9133. if ( typeof selector !== "string" || !selector ||
  9134. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9135. return results;
  9136. }
  9137. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9138. if ( !seed ) {
  9139. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9140. setDocument( context );
  9141. }
  9142. context = context || document;
  9143. if ( documentIsHTML ) {
  9144. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9145. // (excepting DocumentFragment context, where the methods don't exist)
  9146. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9147. // ID selector
  9148. if ( (m = match[1]) ) {
  9149. // Document context
  9150. if ( nodeType === 9 ) {
  9151. if ( (elem = context.getElementById( m )) ) {
  9152. // Support: IE, Opera, Webkit
  9153. // TODO: identify versions
  9154. // getElementById can match elements by name instead of ID
  9155. if ( elem.id === m ) {
  9156. results.push( elem );
  9157. return results;
  9158. }
  9159. } else {
  9160. return results;
  9161. }
  9162. // Element context
  9163. } else {
  9164. // Support: IE, Opera, Webkit
  9165. // TODO: identify versions
  9166. // getElementById can match elements by name instead of ID
  9167. if ( newContext && (elem = newContext.getElementById( m )) &&
  9168. contains( context, elem ) &&
  9169. elem.id === m ) {
  9170. results.push( elem );
  9171. return results;
  9172. }
  9173. }
  9174. // Type selector
  9175. } else if ( match[2] ) {
  9176. push.apply( results, context.getElementsByTagName( selector ) );
  9177. return results;
  9178. // Class selector
  9179. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9180. context.getElementsByClassName ) {
  9181. push.apply( results, context.getElementsByClassName( m ) );
  9182. return results;
  9183. }
  9184. }
  9185. // Take advantage of querySelectorAll
  9186. if ( support.qsa &&
  9187. !nonnativeSelectorCache[ selector + " " ] &&
  9188. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9189. // Support: IE 8 only
  9190. // Exclude object elements
  9191. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9192. newSelector = selector;
  9193. newContext = context;
  9194. // qSA considers elements outside a scoping root when evaluating child or
  9195. // descendant combinators, which is not what we want.
  9196. // In such cases, we work around the behavior by prefixing every selector in the
  9197. // list with an ID selector referencing the scope context.
  9198. // Thanks to Andrew Dupont for this technique.
  9199. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9200. // Capture the context ID, setting it first if necessary
  9201. if ( (nid = context.getAttribute( "id" )) ) {
  9202. nid = nid.replace( rcssescape, fcssescape );
  9203. } else {
  9204. context.setAttribute( "id", (nid = expando) );
  9205. }
  9206. // Prefix every selector in the list
  9207. groups = tokenize( selector );
  9208. i = groups.length;
  9209. while ( i-- ) {
  9210. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9211. }
  9212. newSelector = groups.join( "," );
  9213. // Expand context for sibling selectors
  9214. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9215. context;
  9216. }
  9217. try {
  9218. push.apply( results,
  9219. newContext.querySelectorAll( newSelector )
  9220. );
  9221. return results;
  9222. } catch ( qsaError ) {
  9223. nonnativeSelectorCache( selector, true );
  9224. } finally {
  9225. if ( nid === expando ) {
  9226. context.removeAttribute( "id" );
  9227. }
  9228. }
  9229. }
  9230. }
  9231. }
  9232. // All others
  9233. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9234. }
  9235. /**
  9236. * Create key-value caches of limited size
  9237. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9238. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9239. * deleting the oldest entry
  9240. */
  9241. function createCache() {
  9242. var keys = [];
  9243. function cache( key, value ) {
  9244. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9245. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9246. // Only keep the most recent entries
  9247. delete cache[ keys.shift() ];
  9248. }
  9249. return (cache[ key + " " ] = value);
  9250. }
  9251. return cache;
  9252. }
  9253. /**
  9254. * Mark a function for special use by Sizzle
  9255. * @param {Function} fn The function to mark
  9256. */
  9257. function markFunction( fn ) {
  9258. fn[ expando ] = true;
  9259. return fn;
  9260. }
  9261. /**
  9262. * Support testing using an element
  9263. * @param {Function} fn Passed the created element and returns a boolean result
  9264. */
  9265. function assert( fn ) {
  9266. var el = document.createElement("fieldset");
  9267. try {
  9268. return !!fn( el );
  9269. } catch (e) {
  9270. return false;
  9271. } finally {
  9272. // Remove from its parent by default
  9273. if ( el.parentNode ) {
  9274. el.parentNode.removeChild( el );
  9275. }
  9276. // release memory in IE
  9277. el = null;
  9278. }
  9279. }
  9280. /**
  9281. * Adds the same handler for all of the specified attrs
  9282. * @param {String} attrs Pipe-separated list of attributes
  9283. * @param {Function} handler The method that will be applied
  9284. */
  9285. function addHandle( attrs, handler ) {
  9286. var arr = attrs.split("|"),
  9287. i = arr.length;
  9288. while ( i-- ) {
  9289. Expr.attrHandle[ arr[i] ] = handler;
  9290. }
  9291. }
  9292. /**
  9293. * Checks document order of two siblings
  9294. * @param {Element} a
  9295. * @param {Element} b
  9296. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9297. */
  9298. function siblingCheck( a, b ) {
  9299. var cur = b && a,
  9300. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9301. a.sourceIndex - b.sourceIndex;
  9302. // Use IE sourceIndex if available on both nodes
  9303. if ( diff ) {
  9304. return diff;
  9305. }
  9306. // Check if b follows a
  9307. if ( cur ) {
  9308. while ( (cur = cur.nextSibling) ) {
  9309. if ( cur === b ) {
  9310. return -1;
  9311. }
  9312. }
  9313. }
  9314. return a ? 1 : -1;
  9315. }
  9316. /**
  9317. * Returns a function to use in pseudos for input types
  9318. * @param {String} type
  9319. */
  9320. function createInputPseudo( type ) {
  9321. return function( elem ) {
  9322. var name = elem.nodeName.toLowerCase();
  9323. return name === "input" && elem.type === type;
  9324. };
  9325. }
  9326. /**
  9327. * Returns a function to use in pseudos for buttons
  9328. * @param {String} type
  9329. */
  9330. function createButtonPseudo( type ) {
  9331. return function( elem ) {
  9332. var name = elem.nodeName.toLowerCase();
  9333. return (name === "input" || name === "button") && elem.type === type;
  9334. };
  9335. }
  9336. /**
  9337. * Returns a function to use in pseudos for :enabled/:disabled
  9338. * @param {Boolean} disabled true for :disabled; false for :enabled
  9339. */
  9340. function createDisabledPseudo( disabled ) {
  9341. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9342. return function( elem ) {
  9343. // Only certain elements can match :enabled or :disabled
  9344. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9345. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9346. if ( "form" in elem ) {
  9347. // Check for inherited disabledness on relevant non-disabled elements:
  9348. // * listed form-associated elements in a disabled fieldset
  9349. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9350. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9351. // * option elements in a disabled optgroup
  9352. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9353. // All such elements have a "form" property.
  9354. if ( elem.parentNode && elem.disabled === false ) {
  9355. // Option elements defer to a parent optgroup if present
  9356. if ( "label" in elem ) {
  9357. if ( "label" in elem.parentNode ) {
  9358. return elem.parentNode.disabled === disabled;
  9359. } else {
  9360. return elem.disabled === disabled;
  9361. }
  9362. }
  9363. // Support: IE 6 - 11
  9364. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9365. return elem.isDisabled === disabled ||
  9366. // Where there is no isDisabled, check manually
  9367. /* jshint -W018 */
  9368. elem.isDisabled !== !disabled &&
  9369. inDisabledFieldset( elem ) === disabled;
  9370. }
  9371. return elem.disabled === disabled;
  9372. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9373. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9374. // even exist on them, let alone have a boolean value.
  9375. } else if ( "label" in elem ) {
  9376. return elem.disabled === disabled;
  9377. }
  9378. // Remaining elements are neither :enabled nor :disabled
  9379. return false;
  9380. };
  9381. }
  9382. /**
  9383. * Returns a function to use in pseudos for positionals
  9384. * @param {Function} fn
  9385. */
  9386. function createPositionalPseudo( fn ) {
  9387. return markFunction(function( argument ) {
  9388. argument = +argument;
  9389. return markFunction(function( seed, matches ) {
  9390. var j,
  9391. matchIndexes = fn( [], seed.length, argument ),
  9392. i = matchIndexes.length;
  9393. // Match elements found at the specified indexes
  9394. while ( i-- ) {
  9395. if ( seed[ (j = matchIndexes[i]) ] ) {
  9396. seed[j] = !(matches[j] = seed[j]);
  9397. }
  9398. }
  9399. });
  9400. });
  9401. }
  9402. /**
  9403. * Checks a node for validity as a Sizzle context
  9404. * @param {Element|Object=} context
  9405. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9406. */
  9407. function testContext( context ) {
  9408. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9409. }
  9410. // Expose support vars for convenience
  9411. support = Sizzle.support = {};
  9412. /**
  9413. * Detects XML nodes
  9414. * @param {Element|Object} elem An element or a document
  9415. * @returns {Boolean} True iff elem is a non-HTML XML node
  9416. */
  9417. isXML = Sizzle.isXML = function( elem ) {
  9418. var namespace = elem.namespaceURI,
  9419. docElem = (elem.ownerDocument || elem).documentElement;
  9420. // Support: IE <=8
  9421. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9422. // https://bugs.jquery.com/ticket/4833
  9423. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9424. };
  9425. /**
  9426. * Sets document-related variables once based on the current document
  9427. * @param {Element|Object} [doc] An element or document object to use to set the document
  9428. * @returns {Object} Returns the current document
  9429. */
  9430. setDocument = Sizzle.setDocument = function( node ) {
  9431. var hasCompare, subWindow,
  9432. doc = node ? node.ownerDocument || node : preferredDoc;
  9433. // Return early if doc is invalid or already selected
  9434. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9435. return document;
  9436. }
  9437. // Update global variables
  9438. document = doc;
  9439. docElem = document.documentElement;
  9440. documentIsHTML = !isXML( document );
  9441. // Support: IE 9-11, Edge
  9442. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9443. if ( preferredDoc !== document &&
  9444. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9445. // Support: IE 11, Edge
  9446. if ( subWindow.addEventListener ) {
  9447. subWindow.addEventListener( "unload", unloadHandler, false );
  9448. // Support: IE 9 - 10 only
  9449. } else if ( subWindow.attachEvent ) {
  9450. subWindow.attachEvent( "onunload", unloadHandler );
  9451. }
  9452. }
  9453. /* Attributes
  9454. ---------------------------------------------------------------------- */
  9455. // Support: IE<8
  9456. // Verify that getAttribute really returns attributes and not properties
  9457. // (excepting IE8 booleans)
  9458. support.attributes = assert(function( el ) {
  9459. el.className = "i";
  9460. return !el.getAttribute("className");
  9461. });
  9462. /* getElement(s)By*
  9463. ---------------------------------------------------------------------- */
  9464. // Check if getElementsByTagName("*") returns only elements
  9465. support.getElementsByTagName = assert(function( el ) {
  9466. el.appendChild( document.createComment("") );
  9467. return !el.getElementsByTagName("*").length;
  9468. });
  9469. // Support: IE<9
  9470. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9471. // Support: IE<10
  9472. // Check if getElementById returns elements by name
  9473. // The broken getElementById methods don't pick up programmatically-set names,
  9474. // so use a roundabout getElementsByName test
  9475. support.getById = assert(function( el ) {
  9476. docElem.appendChild( el ).id = expando;
  9477. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9478. });
  9479. // ID filter and find
  9480. if ( support.getById ) {
  9481. Expr.filter["ID"] = function( id ) {
  9482. var attrId = id.replace( runescape, funescape );
  9483. return function( elem ) {
  9484. return elem.getAttribute("id") === attrId;
  9485. };
  9486. };
  9487. Expr.find["ID"] = function( id, context ) {
  9488. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9489. var elem = context.getElementById( id );
  9490. return elem ? [ elem ] : [];
  9491. }
  9492. };
  9493. } else {
  9494. Expr.filter["ID"] = function( id ) {
  9495. var attrId = id.replace( runescape, funescape );
  9496. return function( elem ) {
  9497. var node = typeof elem.getAttributeNode !== "undefined" &&
  9498. elem.getAttributeNode("id");
  9499. return node && node.value === attrId;
  9500. };
  9501. };
  9502. // Support: IE 6 - 7 only
  9503. // getElementById is not reliable as a find shortcut
  9504. Expr.find["ID"] = function( id, context ) {
  9505. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9506. var node, i, elems,
  9507. elem = context.getElementById( id );
  9508. if ( elem ) {
  9509. // Verify the id attribute
  9510. node = elem.getAttributeNode("id");
  9511. if ( node && node.value === id ) {
  9512. return [ elem ];
  9513. }
  9514. // Fall back on getElementsByName
  9515. elems = context.getElementsByName( id );
  9516. i = 0;
  9517. while ( (elem = elems[i++]) ) {
  9518. node = elem.getAttributeNode("id");
  9519. if ( node && node.value === id ) {
  9520. return [ elem ];
  9521. }
  9522. }
  9523. }
  9524. return [];
  9525. }
  9526. };
  9527. }
  9528. // Tag
  9529. Expr.find["TAG"] = support.getElementsByTagName ?
  9530. function( tag, context ) {
  9531. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9532. return context.getElementsByTagName( tag );
  9533. // DocumentFragment nodes don't have gEBTN
  9534. } else if ( support.qsa ) {
  9535. return context.querySelectorAll( tag );
  9536. }
  9537. } :
  9538. function( tag, context ) {
  9539. var elem,
  9540. tmp = [],
  9541. i = 0,
  9542. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9543. results = context.getElementsByTagName( tag );
  9544. // Filter out possible comments
  9545. if ( tag === "*" ) {
  9546. while ( (elem = results[i++]) ) {
  9547. if ( elem.nodeType === 1 ) {
  9548. tmp.push( elem );
  9549. }
  9550. }
  9551. return tmp;
  9552. }
  9553. return results;
  9554. };
  9555. // Class
  9556. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9557. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9558. return context.getElementsByClassName( className );
  9559. }
  9560. };
  9561. /* QSA/matchesSelector
  9562. ---------------------------------------------------------------------- */
  9563. // QSA and matchesSelector support
  9564. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9565. rbuggyMatches = [];
  9566. // qSa(:focus) reports false when true (Chrome 21)
  9567. // We allow this because of a bug in IE8/9 that throws an error
  9568. // whenever `document.activeElement` is accessed on an iframe
  9569. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9570. // See https://bugs.jquery.com/ticket/13378
  9571. rbuggyQSA = [];
  9572. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9573. // Build QSA regex
  9574. // Regex strategy adopted from Diego Perini
  9575. assert(function( el ) {
  9576. // Select is set to empty string on purpose
  9577. // This is to test IE's treatment of not explicitly
  9578. // setting a boolean content attribute,
  9579. // since its presence should be enough
  9580. // https://bugs.jquery.com/ticket/12359
  9581. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9582. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9583. "<option selected=''></option></select>";
  9584. // Support: IE8, Opera 11-12.16
  9585. // Nothing should be selected when empty strings follow ^= or $= or *=
  9586. // The test attribute must be unknown in Opera but "safe" for WinRT
  9587. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9588. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9589. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9590. }
  9591. // Support: IE8
  9592. // Boolean attributes and "value" are not treated correctly
  9593. if ( !el.querySelectorAll("[selected]").length ) {
  9594. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9595. }
  9596. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9597. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9598. rbuggyQSA.push("~=");
  9599. }
  9600. // Webkit/Opera - :checked should return selected option elements
  9601. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9602. // IE8 throws error here and will not see later tests
  9603. if ( !el.querySelectorAll(":checked").length ) {
  9604. rbuggyQSA.push(":checked");
  9605. }
  9606. // Support: Safari 8+, iOS 8+
  9607. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9608. // In-page `selector#id sibling-combinator selector` fails
  9609. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9610. rbuggyQSA.push(".#.+[+~]");
  9611. }
  9612. });
  9613. assert(function( el ) {
  9614. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9615. "<select disabled='disabled'><option/></select>";
  9616. // Support: Windows 8 Native Apps
  9617. // The type and name attributes are restricted during .innerHTML assignment
  9618. var input = document.createElement("input");
  9619. input.setAttribute( "type", "hidden" );
  9620. el.appendChild( input ).setAttribute( "name", "D" );
  9621. // Support: IE8
  9622. // Enforce case-sensitivity of name attribute
  9623. if ( el.querySelectorAll("[name=d]").length ) {
  9624. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9625. }
  9626. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9627. // IE8 throws error here and will not see later tests
  9628. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9629. rbuggyQSA.push( ":enabled", ":disabled" );
  9630. }
  9631. // Support: IE9-11+
  9632. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9633. docElem.appendChild( el ).disabled = true;
  9634. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9635. rbuggyQSA.push( ":enabled", ":disabled" );
  9636. }
  9637. // Opera 10-11 does not throw on post-comma invalid pseudos
  9638. el.querySelectorAll("*,:x");
  9639. rbuggyQSA.push(",.*:");
  9640. });
  9641. }
  9642. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9643. docElem.webkitMatchesSelector ||
  9644. docElem.mozMatchesSelector ||
  9645. docElem.oMatchesSelector ||
  9646. docElem.msMatchesSelector) )) ) {
  9647. assert(function( el ) {
  9648. // Check to see if it's possible to do matchesSelector
  9649. // on a disconnected node (IE 9)
  9650. support.disconnectedMatch = matches.call( el, "*" );
  9651. // This should fail with an exception
  9652. // Gecko does not error, returns false instead
  9653. matches.call( el, "[s!='']:x" );
  9654. rbuggyMatches.push( "!=", pseudos );
  9655. });
  9656. }
  9657. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9658. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9659. /* Contains
  9660. ---------------------------------------------------------------------- */
  9661. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9662. // Element contains another
  9663. // Purposefully self-exclusive
  9664. // As in, an element does not contain itself
  9665. contains = hasCompare || rnative.test( docElem.contains ) ?
  9666. function( a, b ) {
  9667. var adown = a.nodeType === 9 ? a.documentElement : a,
  9668. bup = b && b.parentNode;
  9669. return a === bup || !!( bup && bup.nodeType === 1 && (
  9670. adown.contains ?
  9671. adown.contains( bup ) :
  9672. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9673. ));
  9674. } :
  9675. function( a, b ) {
  9676. if ( b ) {
  9677. while ( (b = b.parentNode) ) {
  9678. if ( b === a ) {
  9679. return true;
  9680. }
  9681. }
  9682. }
  9683. return false;
  9684. };
  9685. /* Sorting
  9686. ---------------------------------------------------------------------- */
  9687. // Document order sorting
  9688. sortOrder = hasCompare ?
  9689. function( a, b ) {
  9690. // Flag for duplicate removal
  9691. if ( a === b ) {
  9692. hasDuplicate = true;
  9693. return 0;
  9694. }
  9695. // Sort on method existence if only one input has compareDocumentPosition
  9696. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9697. if ( compare ) {
  9698. return compare;
  9699. }
  9700. // Calculate position if both inputs belong to the same document
  9701. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9702. a.compareDocumentPosition( b ) :
  9703. // Otherwise we know they are disconnected
  9704. 1;
  9705. // Disconnected nodes
  9706. if ( compare & 1 ||
  9707. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9708. // Choose the first element that is related to our preferred document
  9709. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9710. return -1;
  9711. }
  9712. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9713. return 1;
  9714. }
  9715. // Maintain original order
  9716. return sortInput ?
  9717. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9718. 0;
  9719. }
  9720. return compare & 4 ? -1 : 1;
  9721. } :
  9722. function( a, b ) {
  9723. // Exit early if the nodes are identical
  9724. if ( a === b ) {
  9725. hasDuplicate = true;
  9726. return 0;
  9727. }
  9728. var cur,
  9729. i = 0,
  9730. aup = a.parentNode,
  9731. bup = b.parentNode,
  9732. ap = [ a ],
  9733. bp = [ b ];
  9734. // Parentless nodes are either documents or disconnected
  9735. if ( !aup || !bup ) {
  9736. return a === document ? -1 :
  9737. b === document ? 1 :
  9738. aup ? -1 :
  9739. bup ? 1 :
  9740. sortInput ?
  9741. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9742. 0;
  9743. // If the nodes are siblings, we can do a quick check
  9744. } else if ( aup === bup ) {
  9745. return siblingCheck( a, b );
  9746. }
  9747. // Otherwise we need full lists of their ancestors for comparison
  9748. cur = a;
  9749. while ( (cur = cur.parentNode) ) {
  9750. ap.unshift( cur );
  9751. }
  9752. cur = b;
  9753. while ( (cur = cur.parentNode) ) {
  9754. bp.unshift( cur );
  9755. }
  9756. // Walk down the tree looking for a discrepancy
  9757. while ( ap[i] === bp[i] ) {
  9758. i++;
  9759. }
  9760. return i ?
  9761. // Do a sibling check if the nodes have a common ancestor
  9762. siblingCheck( ap[i], bp[i] ) :
  9763. // Otherwise nodes in our document sort first
  9764. ap[i] === preferredDoc ? -1 :
  9765. bp[i] === preferredDoc ? 1 :
  9766. 0;
  9767. };
  9768. return document;
  9769. };
  9770. Sizzle.matches = function( expr, elements ) {
  9771. return Sizzle( expr, null, null, elements );
  9772. };
  9773. Sizzle.matchesSelector = function( elem, expr ) {
  9774. // Set document vars if needed
  9775. if ( ( elem.ownerDocument || elem ) !== document ) {
  9776. setDocument( elem );
  9777. }
  9778. if ( support.matchesSelector && documentIsHTML &&
  9779. !nonnativeSelectorCache[ expr + " " ] &&
  9780. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9781. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9782. try {
  9783. var ret = matches.call( elem, expr );
  9784. // IE 9's matchesSelector returns false on disconnected nodes
  9785. if ( ret || support.disconnectedMatch ||
  9786. // As well, disconnected nodes are said to be in a document
  9787. // fragment in IE 9
  9788. elem.document && elem.document.nodeType !== 11 ) {
  9789. return ret;
  9790. }
  9791. } catch (e) {
  9792. nonnativeSelectorCache( expr, true );
  9793. }
  9794. }
  9795. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9796. };
  9797. Sizzle.contains = function( context, elem ) {
  9798. // Set document vars if needed
  9799. if ( ( context.ownerDocument || context ) !== document ) {
  9800. setDocument( context );
  9801. }
  9802. return contains( context, elem );
  9803. };
  9804. Sizzle.attr = function( elem, name ) {
  9805. // Set document vars if needed
  9806. if ( ( elem.ownerDocument || elem ) !== document ) {
  9807. setDocument( elem );
  9808. }
  9809. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9810. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9811. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9812. fn( elem, name, !documentIsHTML ) :
  9813. undefined;
  9814. return val !== undefined ?
  9815. val :
  9816. support.attributes || !documentIsHTML ?
  9817. elem.getAttribute( name ) :
  9818. (val = elem.getAttributeNode(name)) && val.specified ?
  9819. val.value :
  9820. null;
  9821. };
  9822. Sizzle.escape = function( sel ) {
  9823. return (sel + "").replace( rcssescape, fcssescape );
  9824. };
  9825. Sizzle.error = function( msg ) {
  9826. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9827. };
  9828. /**
  9829. * Document sorting and removing duplicates
  9830. * @param {ArrayLike} results
  9831. */
  9832. Sizzle.uniqueSort = function( results ) {
  9833. var elem,
  9834. duplicates = [],
  9835. j = 0,
  9836. i = 0;
  9837. // Unless we *know* we can detect duplicates, assume their presence
  9838. hasDuplicate = !support.detectDuplicates;
  9839. sortInput = !support.sortStable && results.slice( 0 );
  9840. results.sort( sortOrder );
  9841. if ( hasDuplicate ) {
  9842. while ( (elem = results[i++]) ) {
  9843. if ( elem === results[ i ] ) {
  9844. j = duplicates.push( i );
  9845. }
  9846. }
  9847. while ( j-- ) {
  9848. results.splice( duplicates[ j ], 1 );
  9849. }
  9850. }
  9851. // Clear input after sorting to release objects
  9852. // See https://github.com/jquery/sizzle/pull/225
  9853. sortInput = null;
  9854. return results;
  9855. };
  9856. /**
  9857. * Utility function for retrieving the text value of an array of DOM nodes
  9858. * @param {Array|Element} elem
  9859. */
  9860. getText = Sizzle.getText = function( elem ) {
  9861. var node,
  9862. ret = "",
  9863. i = 0,
  9864. nodeType = elem.nodeType;
  9865. if ( !nodeType ) {
  9866. // If no nodeType, this is expected to be an array
  9867. while ( (node = elem[i++]) ) {
  9868. // Do not traverse comment nodes
  9869. ret += getText( node );
  9870. }
  9871. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9872. // Use textContent for elements
  9873. // innerText usage removed for consistency of new lines (jQuery #11153)
  9874. if ( typeof elem.textContent === "string" ) {
  9875. return elem.textContent;
  9876. } else {
  9877. // Traverse its children
  9878. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9879. ret += getText( elem );
  9880. }
  9881. }
  9882. } else if ( nodeType === 3 || nodeType === 4 ) {
  9883. return elem.nodeValue;
  9884. }
  9885. // Do not include comment or processing instruction nodes
  9886. return ret;
  9887. };
  9888. Expr = Sizzle.selectors = {
  9889. // Can be adjusted by the user
  9890. cacheLength: 50,
  9891. createPseudo: markFunction,
  9892. match: matchExpr,
  9893. attrHandle: {},
  9894. find: {},
  9895. relative: {
  9896. ">": { dir: "parentNode", first: true },
  9897. " ": { dir: "parentNode" },
  9898. "+": { dir: "previousSibling", first: true },
  9899. "~": { dir: "previousSibling" }
  9900. },
  9901. preFilter: {
  9902. "ATTR": function( match ) {
  9903. match[1] = match[1].replace( runescape, funescape );
  9904. // Move the given value to match[3] whether quoted or unquoted
  9905. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9906. if ( match[2] === "~=" ) {
  9907. match[3] = " " + match[3] + " ";
  9908. }
  9909. return match.slice( 0, 4 );
  9910. },
  9911. "CHILD": function( match ) {
  9912. /* matches from matchExpr["CHILD"]
  9913. 1 type (only|nth|...)
  9914. 2 what (child|of-type)
  9915. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9916. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9917. 5 sign of xn-component
  9918. 6 x of xn-component
  9919. 7 sign of y-component
  9920. 8 y of y-component
  9921. */
  9922. match[1] = match[1].toLowerCase();
  9923. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9924. // nth-* requires argument
  9925. if ( !match[3] ) {
  9926. Sizzle.error( match[0] );
  9927. }
  9928. // numeric x and y parameters for Expr.filter.CHILD
  9929. // remember that false/true cast respectively to 0/1
  9930. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9931. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9932. // other types prohibit arguments
  9933. } else if ( match[3] ) {
  9934. Sizzle.error( match[0] );
  9935. }
  9936. return match;
  9937. },
  9938. "PSEUDO": function( match ) {
  9939. var excess,
  9940. unquoted = !match[6] && match[2];
  9941. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9942. return null;
  9943. }
  9944. // Accept quoted arguments as-is
  9945. if ( match[3] ) {
  9946. match[2] = match[4] || match[5] || "";
  9947. // Strip excess characters from unquoted arguments
  9948. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9949. // Get excess from tokenize (recursively)
  9950. (excess = tokenize( unquoted, true )) &&
  9951. // advance to the next closing parenthesis
  9952. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9953. // excess is a negative index
  9954. match[0] = match[0].slice( 0, excess );
  9955. match[2] = unquoted.slice( 0, excess );
  9956. }
  9957. // Return only captures needed by the pseudo filter method (type and argument)
  9958. return match.slice( 0, 3 );
  9959. }
  9960. },
  9961. filter: {
  9962. "TAG": function( nodeNameSelector ) {
  9963. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9964. return nodeNameSelector === "*" ?
  9965. function() { return true; } :
  9966. function( elem ) {
  9967. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9968. };
  9969. },
  9970. "CLASS": function( className ) {
  9971. var pattern = classCache[ className + " " ];
  9972. return pattern ||
  9973. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9974. classCache( className, function( elem ) {
  9975. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9976. });
  9977. },
  9978. "ATTR": function( name, operator, check ) {
  9979. return function( elem ) {
  9980. var result = Sizzle.attr( elem, name );
  9981. if ( result == null ) {
  9982. return operator === "!=";
  9983. }
  9984. if ( !operator ) {
  9985. return true;
  9986. }
  9987. result += "";
  9988. return operator === "=" ? result === check :
  9989. operator === "!=" ? result !== check :
  9990. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9991. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9992. operator === "$=" ? check && result.slice( -check.length ) === check :
  9993. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9994. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9995. false;
  9996. };
  9997. },
  9998. "CHILD": function( type, what, argument, first, last ) {
  9999. var simple = type.slice( 0, 3 ) !== "nth",
  10000. forward = type.slice( -4 ) !== "last",
  10001. ofType = what === "of-type";
  10002. return first === 1 && last === 0 ?
  10003. // Shortcut for :nth-*(n)
  10004. function( elem ) {
  10005. return !!elem.parentNode;
  10006. } :
  10007. function( elem, context, xml ) {
  10008. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10009. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10010. parent = elem.parentNode,
  10011. name = ofType && elem.nodeName.toLowerCase(),
  10012. useCache = !xml && !ofType,
  10013. diff = false;
  10014. if ( parent ) {
  10015. // :(first|last|only)-(child|of-type)
  10016. if ( simple ) {
  10017. while ( dir ) {
  10018. node = elem;
  10019. while ( (node = node[ dir ]) ) {
  10020. if ( ofType ?
  10021. node.nodeName.toLowerCase() === name :
  10022. node.nodeType === 1 ) {
  10023. return false;
  10024. }
  10025. }
  10026. // Reverse direction for :only-* (if we haven't yet done so)
  10027. start = dir = type === "only" && !start && "nextSibling";
  10028. }
  10029. return true;
  10030. }
  10031. start = [ forward ? parent.firstChild : parent.lastChild ];
  10032. // non-xml :nth-child(...) stores cache data on `parent`
  10033. if ( forward && useCache ) {
  10034. // Seek `elem` from a previously-cached index
  10035. // ...in a gzip-friendly way
  10036. node = parent;
  10037. outerCache = node[ expando ] || (node[ expando ] = {});
  10038. // Support: IE <9 only
  10039. // Defend against cloned attroperties (jQuery gh-1709)
  10040. uniqueCache = outerCache[ node.uniqueID ] ||
  10041. (outerCache[ node.uniqueID ] = {});
  10042. cache = uniqueCache[ type ] || [];
  10043. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10044. diff = nodeIndex && cache[ 2 ];
  10045. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10046. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10047. // Fallback to seeking `elem` from the start
  10048. (diff = nodeIndex = 0) || start.pop()) ) {
  10049. // When found, cache indexes on `parent` and break
  10050. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10051. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10052. break;
  10053. }
  10054. }
  10055. } else {
  10056. // Use previously-cached element index if available
  10057. if ( useCache ) {
  10058. // ...in a gzip-friendly way
  10059. node = elem;
  10060. outerCache = node[ expando ] || (node[ expando ] = {});
  10061. // Support: IE <9 only
  10062. // Defend against cloned attroperties (jQuery gh-1709)
  10063. uniqueCache = outerCache[ node.uniqueID ] ||
  10064. (outerCache[ node.uniqueID ] = {});
  10065. cache = uniqueCache[ type ] || [];
  10066. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10067. diff = nodeIndex;
  10068. }
  10069. // xml :nth-child(...)
  10070. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10071. if ( diff === false ) {
  10072. // Use the same loop as above to seek `elem` from the start
  10073. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10074. (diff = nodeIndex = 0) || start.pop()) ) {
  10075. if ( ( ofType ?
  10076. node.nodeName.toLowerCase() === name :
  10077. node.nodeType === 1 ) &&
  10078. ++diff ) {
  10079. // Cache the index of each encountered element
  10080. if ( useCache ) {
  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. uniqueCache[ type ] = [ dirruns, diff ];
  10087. }
  10088. if ( node === elem ) {
  10089. break;
  10090. }
  10091. }
  10092. }
  10093. }
  10094. }
  10095. // Incorporate the offset, then check against cycle size
  10096. diff -= last;
  10097. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10098. }
  10099. };
  10100. },
  10101. "PSEUDO": function( pseudo, argument ) {
  10102. // pseudo-class names are case-insensitive
  10103. // http://www.w3.org/TR/selectors/#pseudo-classes
  10104. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10105. // Remember that setFilters inherits from pseudos
  10106. var args,
  10107. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10108. Sizzle.error( "unsupported pseudo: " + pseudo );
  10109. // The user may use createPseudo to indicate that
  10110. // arguments are needed to create the filter function
  10111. // just as Sizzle does
  10112. if ( fn[ expando ] ) {
  10113. return fn( argument );
  10114. }
  10115. // But maintain support for old signatures
  10116. if ( fn.length > 1 ) {
  10117. args = [ pseudo, pseudo, "", argument ];
  10118. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10119. markFunction(function( seed, matches ) {
  10120. var idx,
  10121. matched = fn( seed, argument ),
  10122. i = matched.length;
  10123. while ( i-- ) {
  10124. idx = indexOf( seed, matched[i] );
  10125. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10126. }
  10127. }) :
  10128. function( elem ) {
  10129. return fn( elem, 0, args );
  10130. };
  10131. }
  10132. return fn;
  10133. }
  10134. },
  10135. pseudos: {
  10136. // Potentially complex pseudos
  10137. "not": markFunction(function( selector ) {
  10138. // Trim the selector passed to compile
  10139. // to avoid treating leading and trailing
  10140. // spaces as combinators
  10141. var input = [],
  10142. results = [],
  10143. matcher = compile( selector.replace( rtrim, "$1" ) );
  10144. return matcher[ expando ] ?
  10145. markFunction(function( seed, matches, context, xml ) {
  10146. var elem,
  10147. unmatched = matcher( seed, null, xml, [] ),
  10148. i = seed.length;
  10149. // Match elements unmatched by `matcher`
  10150. while ( i-- ) {
  10151. if ( (elem = unmatched[i]) ) {
  10152. seed[i] = !(matches[i] = elem);
  10153. }
  10154. }
  10155. }) :
  10156. function( elem, context, xml ) {
  10157. input[0] = elem;
  10158. matcher( input, null, xml, results );
  10159. // Don't keep the element (issue #299)
  10160. input[0] = null;
  10161. return !results.pop();
  10162. };
  10163. }),
  10164. "has": markFunction(function( selector ) {
  10165. return function( elem ) {
  10166. return Sizzle( selector, elem ).length > 0;
  10167. };
  10168. }),
  10169. "contains": markFunction(function( text ) {
  10170. text = text.replace( runescape, funescape );
  10171. return function( elem ) {
  10172. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10173. };
  10174. }),
  10175. // "Whether an element is represented by a :lang() selector
  10176. // is based solely on the element's language value
  10177. // being equal to the identifier C,
  10178. // or beginning with the identifier C immediately followed by "-".
  10179. // The matching of C against the element's language value is performed case-insensitively.
  10180. // The identifier C does not have to be a valid language name."
  10181. // http://www.w3.org/TR/selectors/#lang-pseudo
  10182. "lang": markFunction( function( lang ) {
  10183. // lang value must be a valid identifier
  10184. if ( !ridentifier.test(lang || "") ) {
  10185. Sizzle.error( "unsupported lang: " + lang );
  10186. }
  10187. lang = lang.replace( runescape, funescape ).toLowerCase();
  10188. return function( elem ) {
  10189. var elemLang;
  10190. do {
  10191. if ( (elemLang = documentIsHTML ?
  10192. elem.lang :
  10193. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10194. elemLang = elemLang.toLowerCase();
  10195. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10196. }
  10197. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10198. return false;
  10199. };
  10200. }),
  10201. // Miscellaneous
  10202. "target": function( elem ) {
  10203. var hash = window.location && window.location.hash;
  10204. return hash && hash.slice( 1 ) === elem.id;
  10205. },
  10206. "root": function( elem ) {
  10207. return elem === docElem;
  10208. },
  10209. "focus": function( elem ) {
  10210. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10211. },
  10212. // Boolean properties
  10213. "enabled": createDisabledPseudo( false ),
  10214. "disabled": createDisabledPseudo( true ),
  10215. "checked": function( elem ) {
  10216. // In CSS3, :checked should return both checked and selected elements
  10217. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10218. var nodeName = elem.nodeName.toLowerCase();
  10219. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10220. },
  10221. "selected": function( elem ) {
  10222. // Accessing this property makes selected-by-default
  10223. // options in Safari work properly
  10224. if ( elem.parentNode ) {
  10225. elem.parentNode.selectedIndex;
  10226. }
  10227. return elem.selected === true;
  10228. },
  10229. // Contents
  10230. "empty": function( elem ) {
  10231. // http://www.w3.org/TR/selectors/#empty-pseudo
  10232. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10233. // but not by others (comment: 8; processing instruction: 7; etc.)
  10234. // nodeType < 6 works because attributes (2) do not appear as children
  10235. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10236. if ( elem.nodeType < 6 ) {
  10237. return false;
  10238. }
  10239. }
  10240. return true;
  10241. },
  10242. "parent": function( elem ) {
  10243. return !Expr.pseudos["empty"]( elem );
  10244. },
  10245. // Element/input types
  10246. "header": function( elem ) {
  10247. return rheader.test( elem.nodeName );
  10248. },
  10249. "input": function( elem ) {
  10250. return rinputs.test( elem.nodeName );
  10251. },
  10252. "button": function( elem ) {
  10253. var name = elem.nodeName.toLowerCase();
  10254. return name === "input" && elem.type === "button" || name === "button";
  10255. },
  10256. "text": function( elem ) {
  10257. var attr;
  10258. return elem.nodeName.toLowerCase() === "input" &&
  10259. elem.type === "text" &&
  10260. // Support: IE<8
  10261. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10262. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10263. },
  10264. // Position-in-collection
  10265. "first": createPositionalPseudo(function() {
  10266. return [ 0 ];
  10267. }),
  10268. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10269. return [ length - 1 ];
  10270. }),
  10271. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10272. return [ argument < 0 ? argument + length : argument ];
  10273. }),
  10274. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10275. var i = 0;
  10276. for ( ; i < length; i += 2 ) {
  10277. matchIndexes.push( i );
  10278. }
  10279. return matchIndexes;
  10280. }),
  10281. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10282. var i = 1;
  10283. for ( ; i < length; i += 2 ) {
  10284. matchIndexes.push( i );
  10285. }
  10286. return matchIndexes;
  10287. }),
  10288. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10289. var i = argument < 0 ?
  10290. argument + length :
  10291. argument > length ?
  10292. length :
  10293. argument;
  10294. for ( ; --i >= 0; ) {
  10295. matchIndexes.push( i );
  10296. }
  10297. return matchIndexes;
  10298. }),
  10299. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10300. var i = argument < 0 ? argument + length : argument;
  10301. for ( ; ++i < length; ) {
  10302. matchIndexes.push( i );
  10303. }
  10304. return matchIndexes;
  10305. })
  10306. }
  10307. };
  10308. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10309. // Add button/input type pseudos
  10310. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10311. Expr.pseudos[ i ] = createInputPseudo( i );
  10312. }
  10313. for ( i in { submit: true, reset: true } ) {
  10314. Expr.pseudos[ i ] = createButtonPseudo( i );
  10315. }
  10316. // Easy API for creating new setFilters
  10317. function setFilters() {}
  10318. setFilters.prototype = Expr.filters = Expr.pseudos;
  10319. Expr.setFilters = new setFilters();
  10320. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10321. var matched, match, tokens, type,
  10322. soFar, groups, preFilters,
  10323. cached = tokenCache[ selector + " " ];
  10324. if ( cached ) {
  10325. return parseOnly ? 0 : cached.slice( 0 );
  10326. }
  10327. soFar = selector;
  10328. groups = [];
  10329. preFilters = Expr.preFilter;
  10330. while ( soFar ) {
  10331. // Comma and first run
  10332. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10333. if ( match ) {
  10334. // Don't consume trailing commas as valid
  10335. soFar = soFar.slice( match[0].length ) || soFar;
  10336. }
  10337. groups.push( (tokens = []) );
  10338. }
  10339. matched = false;
  10340. // Combinators
  10341. if ( (match = rcombinators.exec( soFar )) ) {
  10342. matched = match.shift();
  10343. tokens.push({
  10344. value: matched,
  10345. // Cast descendant combinators to space
  10346. type: match[0].replace( rtrim, " " )
  10347. });
  10348. soFar = soFar.slice( matched.length );
  10349. }
  10350. // Filters
  10351. for ( type in Expr.filter ) {
  10352. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10353. (match = preFilters[ type ]( match ))) ) {
  10354. matched = match.shift();
  10355. tokens.push({
  10356. value: matched,
  10357. type: type,
  10358. matches: match
  10359. });
  10360. soFar = soFar.slice( matched.length );
  10361. }
  10362. }
  10363. if ( !matched ) {
  10364. break;
  10365. }
  10366. }
  10367. // Return the length of the invalid excess
  10368. // if we're just parsing
  10369. // Otherwise, throw an error or return tokens
  10370. return parseOnly ?
  10371. soFar.length :
  10372. soFar ?
  10373. Sizzle.error( selector ) :
  10374. // Cache the tokens
  10375. tokenCache( selector, groups ).slice( 0 );
  10376. };
  10377. function toSelector( tokens ) {
  10378. var i = 0,
  10379. len = tokens.length,
  10380. selector = "";
  10381. for ( ; i < len; i++ ) {
  10382. selector += tokens[i].value;
  10383. }
  10384. return selector;
  10385. }
  10386. function addCombinator( matcher, combinator, base ) {
  10387. var dir = combinator.dir,
  10388. skip = combinator.next,
  10389. key = skip || dir,
  10390. checkNonElements = base && key === "parentNode",
  10391. doneName = done++;
  10392. return combinator.first ?
  10393. // Check against closest ancestor/preceding element
  10394. function( elem, context, xml ) {
  10395. while ( (elem = elem[ dir ]) ) {
  10396. if ( elem.nodeType === 1 || checkNonElements ) {
  10397. return matcher( elem, context, xml );
  10398. }
  10399. }
  10400. return false;
  10401. } :
  10402. // Check against all ancestor/preceding elements
  10403. function( elem, context, xml ) {
  10404. var oldCache, uniqueCache, outerCache,
  10405. newCache = [ dirruns, doneName ];
  10406. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10407. if ( xml ) {
  10408. while ( (elem = elem[ dir ]) ) {
  10409. if ( elem.nodeType === 1 || checkNonElements ) {
  10410. if ( matcher( elem, context, xml ) ) {
  10411. return true;
  10412. }
  10413. }
  10414. }
  10415. } else {
  10416. while ( (elem = elem[ dir ]) ) {
  10417. if ( elem.nodeType === 1 || checkNonElements ) {
  10418. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10419. // Support: IE <9 only
  10420. // Defend against cloned attroperties (jQuery gh-1709)
  10421. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10422. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10423. elem = elem[ dir ] || elem;
  10424. } else if ( (oldCache = uniqueCache[ key ]) &&
  10425. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10426. // Assign to newCache so results back-propagate to previous elements
  10427. return (newCache[ 2 ] = oldCache[ 2 ]);
  10428. } else {
  10429. // Reuse newcache so results back-propagate to previous elements
  10430. uniqueCache[ key ] = newCache;
  10431. // A match means we're done; a fail means we have to keep checking
  10432. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10433. return true;
  10434. }
  10435. }
  10436. }
  10437. }
  10438. }
  10439. return false;
  10440. };
  10441. }
  10442. function elementMatcher( matchers ) {
  10443. return matchers.length > 1 ?
  10444. function( elem, context, xml ) {
  10445. var i = matchers.length;
  10446. while ( i-- ) {
  10447. if ( !matchers[i]( elem, context, xml ) ) {
  10448. return false;
  10449. }
  10450. }
  10451. return true;
  10452. } :
  10453. matchers[0];
  10454. }
  10455. function multipleContexts( selector, contexts, results ) {
  10456. var i = 0,
  10457. len = contexts.length;
  10458. for ( ; i < len; i++ ) {
  10459. Sizzle( selector, contexts[i], results );
  10460. }
  10461. return results;
  10462. }
  10463. function condense( unmatched, map, filter, context, xml ) {
  10464. var elem,
  10465. newUnmatched = [],
  10466. i = 0,
  10467. len = unmatched.length,
  10468. mapped = map != null;
  10469. for ( ; i < len; i++ ) {
  10470. if ( (elem = unmatched[i]) ) {
  10471. if ( !filter || filter( elem, context, xml ) ) {
  10472. newUnmatched.push( elem );
  10473. if ( mapped ) {
  10474. map.push( i );
  10475. }
  10476. }
  10477. }
  10478. }
  10479. return newUnmatched;
  10480. }
  10481. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10482. if ( postFilter && !postFilter[ expando ] ) {
  10483. postFilter = setMatcher( postFilter );
  10484. }
  10485. if ( postFinder && !postFinder[ expando ] ) {
  10486. postFinder = setMatcher( postFinder, postSelector );
  10487. }
  10488. return markFunction(function( seed, results, context, xml ) {
  10489. var temp, i, elem,
  10490. preMap = [],
  10491. postMap = [],
  10492. preexisting = results.length,
  10493. // Get initial elements from seed or context
  10494. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10495. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10496. matcherIn = preFilter && ( seed || !selector ) ?
  10497. condense( elems, preMap, preFilter, context, xml ) :
  10498. elems,
  10499. matcherOut = matcher ?
  10500. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10501. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10502. // ...intermediate processing is necessary
  10503. [] :
  10504. // ...otherwise use results directly
  10505. results :
  10506. matcherIn;
  10507. // Find primary matches
  10508. if ( matcher ) {
  10509. matcher( matcherIn, matcherOut, context, xml );
  10510. }
  10511. // Apply postFilter
  10512. if ( postFilter ) {
  10513. temp = condense( matcherOut, postMap );
  10514. postFilter( temp, [], context, xml );
  10515. // Un-match failing elements by moving them back to matcherIn
  10516. i = temp.length;
  10517. while ( i-- ) {
  10518. if ( (elem = temp[i]) ) {
  10519. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10520. }
  10521. }
  10522. }
  10523. if ( seed ) {
  10524. if ( postFinder || preFilter ) {
  10525. if ( postFinder ) {
  10526. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10527. temp = [];
  10528. i = matcherOut.length;
  10529. while ( i-- ) {
  10530. if ( (elem = matcherOut[i]) ) {
  10531. // Restore matcherIn since elem is not yet a final match
  10532. temp.push( (matcherIn[i] = elem) );
  10533. }
  10534. }
  10535. postFinder( null, (matcherOut = []), temp, xml );
  10536. }
  10537. // Move matched elements from seed to results to keep them synchronized
  10538. i = matcherOut.length;
  10539. while ( i-- ) {
  10540. if ( (elem = matcherOut[i]) &&
  10541. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10542. seed[temp] = !(results[temp] = elem);
  10543. }
  10544. }
  10545. }
  10546. // Add elements to results, through postFinder if defined
  10547. } else {
  10548. matcherOut = condense(
  10549. matcherOut === results ?
  10550. matcherOut.splice( preexisting, matcherOut.length ) :
  10551. matcherOut
  10552. );
  10553. if ( postFinder ) {
  10554. postFinder( null, results, matcherOut, xml );
  10555. } else {
  10556. push.apply( results, matcherOut );
  10557. }
  10558. }
  10559. });
  10560. }
  10561. function matcherFromTokens( tokens ) {
  10562. var checkContext, matcher, j,
  10563. len = tokens.length,
  10564. leadingRelative = Expr.relative[ tokens[0].type ],
  10565. implicitRelative = leadingRelative || Expr.relative[" "],
  10566. i = leadingRelative ? 1 : 0,
  10567. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10568. matchContext = addCombinator( function( elem ) {
  10569. return elem === checkContext;
  10570. }, implicitRelative, true ),
  10571. matchAnyContext = addCombinator( function( elem ) {
  10572. return indexOf( checkContext, elem ) > -1;
  10573. }, implicitRelative, true ),
  10574. matchers = [ function( elem, context, xml ) {
  10575. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10576. (checkContext = context).nodeType ?
  10577. matchContext( elem, context, xml ) :
  10578. matchAnyContext( elem, context, xml ) );
  10579. // Avoid hanging onto element (issue #299)
  10580. checkContext = null;
  10581. return ret;
  10582. } ];
  10583. for ( ; i < len; i++ ) {
  10584. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10585. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10586. } else {
  10587. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10588. // Return special upon seeing a positional matcher
  10589. if ( matcher[ expando ] ) {
  10590. // Find the next relative operator (if any) for proper handling
  10591. j = ++i;
  10592. for ( ; j < len; j++ ) {
  10593. if ( Expr.relative[ tokens[j].type ] ) {
  10594. break;
  10595. }
  10596. }
  10597. return setMatcher(
  10598. i > 1 && elementMatcher( matchers ),
  10599. i > 1 && toSelector(
  10600. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10601. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10602. ).replace( rtrim, "$1" ),
  10603. matcher,
  10604. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10605. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10606. j < len && toSelector( tokens )
  10607. );
  10608. }
  10609. matchers.push( matcher );
  10610. }
  10611. }
  10612. return elementMatcher( matchers );
  10613. }
  10614. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10615. var bySet = setMatchers.length > 0,
  10616. byElement = elementMatchers.length > 0,
  10617. superMatcher = function( seed, context, xml, results, outermost ) {
  10618. var elem, j, matcher,
  10619. matchedCount = 0,
  10620. i = "0",
  10621. unmatched = seed && [],
  10622. setMatched = [],
  10623. contextBackup = outermostContext,
  10624. // We must always have either seed elements or outermost context
  10625. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10626. // Use integer dirruns iff this is the outermost matcher
  10627. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10628. len = elems.length;
  10629. if ( outermost ) {
  10630. outermostContext = context === document || context || outermost;
  10631. }
  10632. // Add elements passing elementMatchers directly to results
  10633. // Support: IE<9, Safari
  10634. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10635. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10636. if ( byElement && elem ) {
  10637. j = 0;
  10638. if ( !context && elem.ownerDocument !== document ) {
  10639. setDocument( elem );
  10640. xml = !documentIsHTML;
  10641. }
  10642. while ( (matcher = elementMatchers[j++]) ) {
  10643. if ( matcher( elem, context || document, xml) ) {
  10644. results.push( elem );
  10645. break;
  10646. }
  10647. }
  10648. if ( outermost ) {
  10649. dirruns = dirrunsUnique;
  10650. }
  10651. }
  10652. // Track unmatched elements for set filters
  10653. if ( bySet ) {
  10654. // They will have gone through all possible matchers
  10655. if ( (elem = !matcher && elem) ) {
  10656. matchedCount--;
  10657. }
  10658. // Lengthen the array for every element, matched or not
  10659. if ( seed ) {
  10660. unmatched.push( elem );
  10661. }
  10662. }
  10663. }
  10664. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10665. // makes the latter nonnegative.
  10666. matchedCount += i;
  10667. // Apply set filters to unmatched elements
  10668. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10669. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10670. // no element matchers and no seed.
  10671. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10672. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10673. // numerically zero.
  10674. if ( bySet && i !== matchedCount ) {
  10675. j = 0;
  10676. while ( (matcher = setMatchers[j++]) ) {
  10677. matcher( unmatched, setMatched, context, xml );
  10678. }
  10679. if ( seed ) {
  10680. // Reintegrate element matches to eliminate the need for sorting
  10681. if ( matchedCount > 0 ) {
  10682. while ( i-- ) {
  10683. if ( !(unmatched[i] || setMatched[i]) ) {
  10684. setMatched[i] = pop.call( results );
  10685. }
  10686. }
  10687. }
  10688. // Discard index placeholder values to get only actual matches
  10689. setMatched = condense( setMatched );
  10690. }
  10691. // Add matches to results
  10692. push.apply( results, setMatched );
  10693. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10694. if ( outermost && !seed && setMatched.length > 0 &&
  10695. ( matchedCount + setMatchers.length ) > 1 ) {
  10696. Sizzle.uniqueSort( results );
  10697. }
  10698. }
  10699. // Override manipulation of globals by nested matchers
  10700. if ( outermost ) {
  10701. dirruns = dirrunsUnique;
  10702. outermostContext = contextBackup;
  10703. }
  10704. return unmatched;
  10705. };
  10706. return bySet ?
  10707. markFunction( superMatcher ) :
  10708. superMatcher;
  10709. }
  10710. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10711. var i,
  10712. setMatchers = [],
  10713. elementMatchers = [],
  10714. cached = compilerCache[ selector + " " ];
  10715. if ( !cached ) {
  10716. // Generate a function of recursive functions that can be used to check each element
  10717. if ( !match ) {
  10718. match = tokenize( selector );
  10719. }
  10720. i = match.length;
  10721. while ( i-- ) {
  10722. cached = matcherFromTokens( match[i] );
  10723. if ( cached[ expando ] ) {
  10724. setMatchers.push( cached );
  10725. } else {
  10726. elementMatchers.push( cached );
  10727. }
  10728. }
  10729. // Cache the compiled function
  10730. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10731. // Save selector and tokenization
  10732. cached.selector = selector;
  10733. }
  10734. return cached;
  10735. };
  10736. /**
  10737. * A low-level selection function that works with Sizzle's compiled
  10738. * selector functions
  10739. * @param {String|Function} selector A selector or a pre-compiled
  10740. * selector function built with Sizzle.compile
  10741. * @param {Element} context
  10742. * @param {Array} [results]
  10743. * @param {Array} [seed] A set of elements to match against
  10744. */
  10745. select = Sizzle.select = function( selector, context, results, seed ) {
  10746. var i, tokens, token, type, find,
  10747. compiled = typeof selector === "function" && selector,
  10748. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10749. results = results || [];
  10750. // Try to minimize operations if there is only one selector in the list and no seed
  10751. // (the latter of which guarantees us context)
  10752. if ( match.length === 1 ) {
  10753. // Reduce context if the leading compound selector is an ID
  10754. tokens = match[0] = match[0].slice( 0 );
  10755. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10756. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10757. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10758. if ( !context ) {
  10759. return results;
  10760. // Precompiled matchers will still verify ancestry, so step up a level
  10761. } else if ( compiled ) {
  10762. context = context.parentNode;
  10763. }
  10764. selector = selector.slice( tokens.shift().value.length );
  10765. }
  10766. // Fetch a seed set for right-to-left matching
  10767. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10768. while ( i-- ) {
  10769. token = tokens[i];
  10770. // Abort if we hit a combinator
  10771. if ( Expr.relative[ (type = token.type) ] ) {
  10772. break;
  10773. }
  10774. if ( (find = Expr.find[ type ]) ) {
  10775. // Search, expanding context for leading sibling combinators
  10776. if ( (seed = find(
  10777. token.matches[0].replace( runescape, funescape ),
  10778. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10779. )) ) {
  10780. // If seed is empty or no tokens remain, we can return early
  10781. tokens.splice( i, 1 );
  10782. selector = seed.length && toSelector( tokens );
  10783. if ( !selector ) {
  10784. push.apply( results, seed );
  10785. return results;
  10786. }
  10787. break;
  10788. }
  10789. }
  10790. }
  10791. }
  10792. // Compile and execute a filtering function if one is not provided
  10793. // Provide `match` to avoid retokenization if we modified the selector above
  10794. ( compiled || compile( selector, match ) )(
  10795. seed,
  10796. context,
  10797. !documentIsHTML,
  10798. results,
  10799. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10800. );
  10801. return results;
  10802. };
  10803. // One-time assignments
  10804. // Sort stability
  10805. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10806. // Support: Chrome 14-35+
  10807. // Always assume duplicates if they aren't passed to the comparison function
  10808. support.detectDuplicates = !!hasDuplicate;
  10809. // Initialize against the default document
  10810. setDocument();
  10811. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10812. // Detached nodes confoundingly follow *each other*
  10813. support.sortDetached = assert(function( el ) {
  10814. // Should return 1, but returns 4 (following)
  10815. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10816. });
  10817. // Support: IE<8
  10818. // Prevent attribute/property "interpolation"
  10819. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10820. if ( !assert(function( el ) {
  10821. el.innerHTML = "<a href='#'></a>";
  10822. return el.firstChild.getAttribute("href") === "#" ;
  10823. }) ) {
  10824. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10825. if ( !isXML ) {
  10826. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10827. }
  10828. });
  10829. }
  10830. // Support: IE<9
  10831. // Use defaultValue in place of getAttribute("value")
  10832. if ( !support.attributes || !assert(function( el ) {
  10833. el.innerHTML = "<input/>";
  10834. el.firstChild.setAttribute( "value", "" );
  10835. return el.firstChild.getAttribute( "value" ) === "";
  10836. }) ) {
  10837. addHandle( "value", function( elem, name, isXML ) {
  10838. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10839. return elem.defaultValue;
  10840. }
  10841. });
  10842. }
  10843. // Support: IE<9
  10844. // Use getAttributeNode to fetch booleans when getAttribute lies
  10845. if ( !assert(function( el ) {
  10846. return el.getAttribute("disabled") == null;
  10847. }) ) {
  10848. addHandle( booleans, function( elem, name, isXML ) {
  10849. var val;
  10850. if ( !isXML ) {
  10851. return elem[ name ] === true ? name.toLowerCase() :
  10852. (val = elem.getAttributeNode( name )) && val.specified ?
  10853. val.value :
  10854. null;
  10855. }
  10856. });
  10857. }
  10858. return Sizzle;
  10859. })( window );
  10860. jQuery.find = Sizzle;
  10861. jQuery.expr = Sizzle.selectors;
  10862. // Deprecated
  10863. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10864. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10865. jQuery.text = Sizzle.getText;
  10866. jQuery.isXMLDoc = Sizzle.isXML;
  10867. jQuery.contains = Sizzle.contains;
  10868. jQuery.escapeSelector = Sizzle.escape;
  10869. var dir = function( elem, dir, until ) {
  10870. var matched = [],
  10871. truncate = until !== undefined;
  10872. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10873. if ( elem.nodeType === 1 ) {
  10874. if ( truncate && jQuery( elem ).is( until ) ) {
  10875. break;
  10876. }
  10877. matched.push( elem );
  10878. }
  10879. }
  10880. return matched;
  10881. };
  10882. var siblings = function( n, elem ) {
  10883. var matched = [];
  10884. for ( ; n; n = n.nextSibling ) {
  10885. if ( n.nodeType === 1 && n !== elem ) {
  10886. matched.push( n );
  10887. }
  10888. }
  10889. return matched;
  10890. };
  10891. var rneedsContext = jQuery.expr.match.needsContext;
  10892. function nodeName( elem, name ) {
  10893. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10894. };
  10895. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10896. // Implement the identical functionality for filter and not
  10897. function winnow( elements, qualifier, not ) {
  10898. if ( isFunction( qualifier ) ) {
  10899. return jQuery.grep( elements, function( elem, i ) {
  10900. return !!qualifier.call( elem, i, elem ) !== not;
  10901. } );
  10902. }
  10903. // Single element
  10904. if ( qualifier.nodeType ) {
  10905. return jQuery.grep( elements, function( elem ) {
  10906. return ( elem === qualifier ) !== not;
  10907. } );
  10908. }
  10909. // Arraylike of elements (jQuery, arguments, Array)
  10910. if ( typeof qualifier !== "string" ) {
  10911. return jQuery.grep( elements, function( elem ) {
  10912. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10913. } );
  10914. }
  10915. // Filtered directly for both simple and complex selectors
  10916. return jQuery.filter( qualifier, elements, not );
  10917. }
  10918. jQuery.filter = function( expr, elems, not ) {
  10919. var elem = elems[ 0 ];
  10920. if ( not ) {
  10921. expr = ":not(" + expr + ")";
  10922. }
  10923. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10924. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10925. }
  10926. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10927. return elem.nodeType === 1;
  10928. } ) );
  10929. };
  10930. jQuery.fn.extend( {
  10931. find: function( selector ) {
  10932. var i, ret,
  10933. len = this.length,
  10934. self = this;
  10935. if ( typeof selector !== "string" ) {
  10936. return this.pushStack( jQuery( selector ).filter( function() {
  10937. for ( i = 0; i < len; i++ ) {
  10938. if ( jQuery.contains( self[ i ], this ) ) {
  10939. return true;
  10940. }
  10941. }
  10942. } ) );
  10943. }
  10944. ret = this.pushStack( [] );
  10945. for ( i = 0; i < len; i++ ) {
  10946. jQuery.find( selector, self[ i ], ret );
  10947. }
  10948. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10949. },
  10950. filter: function( selector ) {
  10951. return this.pushStack( winnow( this, selector || [], false ) );
  10952. },
  10953. not: function( selector ) {
  10954. return this.pushStack( winnow( this, selector || [], true ) );
  10955. },
  10956. is: function( selector ) {
  10957. return !!winnow(
  10958. this,
  10959. // If this is a positional/relative selector, check membership in the returned set
  10960. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10961. typeof selector === "string" && rneedsContext.test( selector ) ?
  10962. jQuery( selector ) :
  10963. selector || [],
  10964. false
  10965. ).length;
  10966. }
  10967. } );
  10968. // Initialize a jQuery object
  10969. // A central reference to the root jQuery(document)
  10970. var rootjQuery,
  10971. // A simple way to check for HTML strings
  10972. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10973. // Strict HTML recognition (#11290: must start with <)
  10974. // Shortcut simple #id case for speed
  10975. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10976. init = jQuery.fn.init = function( selector, context, root ) {
  10977. var match, elem;
  10978. // HANDLE: $(""), $(null), $(undefined), $(false)
  10979. if ( !selector ) {
  10980. return this;
  10981. }
  10982. // Method init() accepts an alternate rootjQuery
  10983. // so migrate can support jQuery.sub (gh-2101)
  10984. root = root || rootjQuery;
  10985. // Handle HTML strings
  10986. if ( typeof selector === "string" ) {
  10987. if ( selector[ 0 ] === "<" &&
  10988. selector[ selector.length - 1 ] === ">" &&
  10989. selector.length >= 3 ) {
  10990. // Assume that strings that start and end with <> are HTML and skip the regex check
  10991. match = [ null, selector, null ];
  10992. } else {
  10993. match = rquickExpr.exec( selector );
  10994. }
  10995. // Match html or make sure no context is specified for #id
  10996. if ( match && ( match[ 1 ] || !context ) ) {
  10997. // HANDLE: $(html) -> $(array)
  10998. if ( match[ 1 ] ) {
  10999. context = context instanceof jQuery ? context[ 0 ] : context;
  11000. // Option to run scripts is true for back-compat
  11001. // Intentionally let the error be thrown if parseHTML is not present
  11002. jQuery.merge( this, jQuery.parseHTML(
  11003. match[ 1 ],
  11004. context && context.nodeType ? context.ownerDocument || context : document,
  11005. true
  11006. ) );
  11007. // HANDLE: $(html, props)
  11008. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11009. for ( match in context ) {
  11010. // Properties of context are called as methods if possible
  11011. if ( isFunction( this[ match ] ) ) {
  11012. this[ match ]( context[ match ] );
  11013. // ...and otherwise set as attributes
  11014. } else {
  11015. this.attr( match, context[ match ] );
  11016. }
  11017. }
  11018. }
  11019. return this;
  11020. // HANDLE: $(#id)
  11021. } else {
  11022. elem = document.getElementById( match[ 2 ] );
  11023. if ( elem ) {
  11024. // Inject the element directly into the jQuery object
  11025. this[ 0 ] = elem;
  11026. this.length = 1;
  11027. }
  11028. return this;
  11029. }
  11030. // HANDLE: $(expr, $(...))
  11031. } else if ( !context || context.jquery ) {
  11032. return ( context || root ).find( selector );
  11033. // HANDLE: $(expr, context)
  11034. // (which is just equivalent to: $(context).find(expr)
  11035. } else {
  11036. return this.constructor( context ).find( selector );
  11037. }
  11038. // HANDLE: $(DOMElement)
  11039. } else if ( selector.nodeType ) {
  11040. this[ 0 ] = selector;
  11041. this.length = 1;
  11042. return this;
  11043. // HANDLE: $(function)
  11044. // Shortcut for document ready
  11045. } else if ( isFunction( selector ) ) {
  11046. return root.ready !== undefined ?
  11047. root.ready( selector ) :
  11048. // Execute immediately if ready is not present
  11049. selector( jQuery );
  11050. }
  11051. return jQuery.makeArray( selector, this );
  11052. };
  11053. // Give the init function the jQuery prototype for later instantiation
  11054. init.prototype = jQuery.fn;
  11055. // Initialize central reference
  11056. rootjQuery = jQuery( document );
  11057. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11058. // Methods guaranteed to produce a unique set when starting from a unique set
  11059. guaranteedUnique = {
  11060. children: true,
  11061. contents: true,
  11062. next: true,
  11063. prev: true
  11064. };
  11065. jQuery.fn.extend( {
  11066. has: function( target ) {
  11067. var targets = jQuery( target, this ),
  11068. l = targets.length;
  11069. return this.filter( function() {
  11070. var i = 0;
  11071. for ( ; i < l; i++ ) {
  11072. if ( jQuery.contains( this, targets[ i ] ) ) {
  11073. return true;
  11074. }
  11075. }
  11076. } );
  11077. },
  11078. closest: function( selectors, context ) {
  11079. var cur,
  11080. i = 0,
  11081. l = this.length,
  11082. matched = [],
  11083. targets = typeof selectors !== "string" && jQuery( selectors );
  11084. // Positional selectors never match, since there's no _selection_ context
  11085. if ( !rneedsContext.test( selectors ) ) {
  11086. for ( ; i < l; i++ ) {
  11087. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11088. // Always skip document fragments
  11089. if ( cur.nodeType < 11 && ( targets ?
  11090. targets.index( cur ) > -1 :
  11091. // Don't pass non-elements to Sizzle
  11092. cur.nodeType === 1 &&
  11093. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11094. matched.push( cur );
  11095. break;
  11096. }
  11097. }
  11098. }
  11099. }
  11100. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11101. },
  11102. // Determine the position of an element within the set
  11103. index: function( elem ) {
  11104. // No argument, return index in parent
  11105. if ( !elem ) {
  11106. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11107. }
  11108. // Index in selector
  11109. if ( typeof elem === "string" ) {
  11110. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11111. }
  11112. // Locate the position of the desired element
  11113. return indexOf.call( this,
  11114. // If it receives a jQuery object, the first element is used
  11115. elem.jquery ? elem[ 0 ] : elem
  11116. );
  11117. },
  11118. add: function( selector, context ) {
  11119. return this.pushStack(
  11120. jQuery.uniqueSort(
  11121. jQuery.merge( this.get(), jQuery( selector, context ) )
  11122. )
  11123. );
  11124. },
  11125. addBack: function( selector ) {
  11126. return this.add( selector == null ?
  11127. this.prevObject : this.prevObject.filter( selector )
  11128. );
  11129. }
  11130. } );
  11131. function sibling( cur, dir ) {
  11132. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11133. return cur;
  11134. }
  11135. jQuery.each( {
  11136. parent: function( elem ) {
  11137. var parent = elem.parentNode;
  11138. return parent && parent.nodeType !== 11 ? parent : null;
  11139. },
  11140. parents: function( elem ) {
  11141. return dir( elem, "parentNode" );
  11142. },
  11143. parentsUntil: function( elem, i, until ) {
  11144. return dir( elem, "parentNode", until );
  11145. },
  11146. next: function( elem ) {
  11147. return sibling( elem, "nextSibling" );
  11148. },
  11149. prev: function( elem ) {
  11150. return sibling( elem, "previousSibling" );
  11151. },
  11152. nextAll: function( elem ) {
  11153. return dir( elem, "nextSibling" );
  11154. },
  11155. prevAll: function( elem ) {
  11156. return dir( elem, "previousSibling" );
  11157. },
  11158. nextUntil: function( elem, i, until ) {
  11159. return dir( elem, "nextSibling", until );
  11160. },
  11161. prevUntil: function( elem, i, until ) {
  11162. return dir( elem, "previousSibling", until );
  11163. },
  11164. siblings: function( elem ) {
  11165. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11166. },
  11167. children: function( elem ) {
  11168. return siblings( elem.firstChild );
  11169. },
  11170. contents: function( elem ) {
  11171. if ( typeof elem.contentDocument !== "undefined" ) {
  11172. return elem.contentDocument;
  11173. }
  11174. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11175. // Treat the template element as a regular one in browsers that
  11176. // don't support it.
  11177. if ( nodeName( elem, "template" ) ) {
  11178. elem = elem.content || elem;
  11179. }
  11180. return jQuery.merge( [], elem.childNodes );
  11181. }
  11182. }, function( name, fn ) {
  11183. jQuery.fn[ name ] = function( until, selector ) {
  11184. var matched = jQuery.map( this, fn, until );
  11185. if ( name.slice( -5 ) !== "Until" ) {
  11186. selector = until;
  11187. }
  11188. if ( selector && typeof selector === "string" ) {
  11189. matched = jQuery.filter( selector, matched );
  11190. }
  11191. if ( this.length > 1 ) {
  11192. // Remove duplicates
  11193. if ( !guaranteedUnique[ name ] ) {
  11194. jQuery.uniqueSort( matched );
  11195. }
  11196. // Reverse order for parents* and prev-derivatives
  11197. if ( rparentsprev.test( name ) ) {
  11198. matched.reverse();
  11199. }
  11200. }
  11201. return this.pushStack( matched );
  11202. };
  11203. } );
  11204. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11205. // Convert String-formatted options into Object-formatted ones
  11206. function createOptions( options ) {
  11207. var object = {};
  11208. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11209. object[ flag ] = true;
  11210. } );
  11211. return object;
  11212. }
  11213. /*
  11214. * Create a callback list using the following parameters:
  11215. *
  11216. * options: an optional list of space-separated options that will change how
  11217. * the callback list behaves or a more traditional option object
  11218. *
  11219. * By default a callback list will act like an event callback list and can be
  11220. * "fired" multiple times.
  11221. *
  11222. * Possible options:
  11223. *
  11224. * once: will ensure the callback list can only be fired once (like a Deferred)
  11225. *
  11226. * memory: will keep track of previous values and will call any callback added
  11227. * after the list has been fired right away with the latest "memorized"
  11228. * values (like a Deferred)
  11229. *
  11230. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11231. *
  11232. * stopOnFalse: interrupt callings when a callback returns false
  11233. *
  11234. */
  11235. jQuery.Callbacks = function( options ) {
  11236. // Convert options from String-formatted to Object-formatted if needed
  11237. // (we check in cache first)
  11238. options = typeof options === "string" ?
  11239. createOptions( options ) :
  11240. jQuery.extend( {}, options );
  11241. var // Flag to know if list is currently firing
  11242. firing,
  11243. // Last fire value for non-forgettable lists
  11244. memory,
  11245. // Flag to know if list was already fired
  11246. fired,
  11247. // Flag to prevent firing
  11248. locked,
  11249. // Actual callback list
  11250. list = [],
  11251. // Queue of execution data for repeatable lists
  11252. queue = [],
  11253. // Index of currently firing callback (modified by add/remove as needed)
  11254. firingIndex = -1,
  11255. // Fire callbacks
  11256. fire = function() {
  11257. // Enforce single-firing
  11258. locked = locked || options.once;
  11259. // Execute callbacks for all pending executions,
  11260. // respecting firingIndex overrides and runtime changes
  11261. fired = firing = true;
  11262. for ( ; queue.length; firingIndex = -1 ) {
  11263. memory = queue.shift();
  11264. while ( ++firingIndex < list.length ) {
  11265. // Run callback and check for early termination
  11266. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11267. options.stopOnFalse ) {
  11268. // Jump to end and forget the data so .add doesn't re-fire
  11269. firingIndex = list.length;
  11270. memory = false;
  11271. }
  11272. }
  11273. }
  11274. // Forget the data if we're done with it
  11275. if ( !options.memory ) {
  11276. memory = false;
  11277. }
  11278. firing = false;
  11279. // Clean up if we're done firing for good
  11280. if ( locked ) {
  11281. // Keep an empty list if we have data for future add calls
  11282. if ( memory ) {
  11283. list = [];
  11284. // Otherwise, this object is spent
  11285. } else {
  11286. list = "";
  11287. }
  11288. }
  11289. },
  11290. // Actual Callbacks object
  11291. self = {
  11292. // Add a callback or a collection of callbacks to the list
  11293. add: function() {
  11294. if ( list ) {
  11295. // If we have memory from a past run, we should fire after adding
  11296. if ( memory && !firing ) {
  11297. firingIndex = list.length - 1;
  11298. queue.push( memory );
  11299. }
  11300. ( function add( args ) {
  11301. jQuery.each( args, function( _, arg ) {
  11302. if ( isFunction( arg ) ) {
  11303. if ( !options.unique || !self.has( arg ) ) {
  11304. list.push( arg );
  11305. }
  11306. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11307. // Inspect recursively
  11308. add( arg );
  11309. }
  11310. } );
  11311. } )( arguments );
  11312. if ( memory && !firing ) {
  11313. fire();
  11314. }
  11315. }
  11316. return this;
  11317. },
  11318. // Remove a callback from the list
  11319. remove: function() {
  11320. jQuery.each( arguments, function( _, arg ) {
  11321. var index;
  11322. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11323. list.splice( index, 1 );
  11324. // Handle firing indexes
  11325. if ( index <= firingIndex ) {
  11326. firingIndex--;
  11327. }
  11328. }
  11329. } );
  11330. return this;
  11331. },
  11332. // Check if a given callback is in the list.
  11333. // If no argument is given, return whether or not list has callbacks attached.
  11334. has: function( fn ) {
  11335. return fn ?
  11336. jQuery.inArray( fn, list ) > -1 :
  11337. list.length > 0;
  11338. },
  11339. // Remove all callbacks from the list
  11340. empty: function() {
  11341. if ( list ) {
  11342. list = [];
  11343. }
  11344. return this;
  11345. },
  11346. // Disable .fire and .add
  11347. // Abort any current/pending executions
  11348. // Clear all callbacks and values
  11349. disable: function() {
  11350. locked = queue = [];
  11351. list = memory = "";
  11352. return this;
  11353. },
  11354. disabled: function() {
  11355. return !list;
  11356. },
  11357. // Disable .fire
  11358. // Also disable .add unless we have memory (since it would have no effect)
  11359. // Abort any pending executions
  11360. lock: function() {
  11361. locked = queue = [];
  11362. if ( !memory && !firing ) {
  11363. list = memory = "";
  11364. }
  11365. return this;
  11366. },
  11367. locked: function() {
  11368. return !!locked;
  11369. },
  11370. // Call all callbacks with the given context and arguments
  11371. fireWith: function( context, args ) {
  11372. if ( !locked ) {
  11373. args = args || [];
  11374. args = [ context, args.slice ? args.slice() : args ];
  11375. queue.push( args );
  11376. if ( !firing ) {
  11377. fire();
  11378. }
  11379. }
  11380. return this;
  11381. },
  11382. // Call all the callbacks with the given arguments
  11383. fire: function() {
  11384. self.fireWith( this, arguments );
  11385. return this;
  11386. },
  11387. // To know if the callbacks have already been called at least once
  11388. fired: function() {
  11389. return !!fired;
  11390. }
  11391. };
  11392. return self;
  11393. };
  11394. function Identity( v ) {
  11395. return v;
  11396. }
  11397. function Thrower( ex ) {
  11398. throw ex;
  11399. }
  11400. function adoptValue( value, resolve, reject, noValue ) {
  11401. var method;
  11402. try {
  11403. // Check for promise aspect first to privilege synchronous behavior
  11404. if ( value && isFunction( ( method = value.promise ) ) ) {
  11405. method.call( value ).done( resolve ).fail( reject );
  11406. // Other thenables
  11407. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11408. method.call( value, resolve, reject );
  11409. // Other non-thenables
  11410. } else {
  11411. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11412. // * false: [ value ].slice( 0 ) => resolve( value )
  11413. // * true: [ value ].slice( 1 ) => resolve()
  11414. resolve.apply( undefined, [ value ].slice( noValue ) );
  11415. }
  11416. // For Promises/A+, convert exceptions into rejections
  11417. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11418. // Deferred#then to conditionally suppress rejection.
  11419. } catch ( value ) {
  11420. // Support: Android 4.0 only
  11421. // Strict mode functions invoked without .call/.apply get global-object context
  11422. reject.apply( undefined, [ value ] );
  11423. }
  11424. }
  11425. jQuery.extend( {
  11426. Deferred: function( func ) {
  11427. var tuples = [
  11428. // action, add listener, callbacks,
  11429. // ... .then handlers, argument index, [final state]
  11430. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11431. jQuery.Callbacks( "memory" ), 2 ],
  11432. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11433. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11434. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11435. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11436. ],
  11437. state = "pending",
  11438. promise = {
  11439. state: function() {
  11440. return state;
  11441. },
  11442. always: function() {
  11443. deferred.done( arguments ).fail( arguments );
  11444. return this;
  11445. },
  11446. "catch": function( fn ) {
  11447. return promise.then( null, fn );
  11448. },
  11449. // Keep pipe for back-compat
  11450. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11451. var fns = arguments;
  11452. return jQuery.Deferred( function( newDefer ) {
  11453. jQuery.each( tuples, function( i, tuple ) {
  11454. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11455. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11456. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11457. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11458. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11459. deferred[ tuple[ 1 ] ]( function() {
  11460. var returned = fn && fn.apply( this, arguments );
  11461. if ( returned && isFunction( returned.promise ) ) {
  11462. returned.promise()
  11463. .progress( newDefer.notify )
  11464. .done( newDefer.resolve )
  11465. .fail( newDefer.reject );
  11466. } else {
  11467. newDefer[ tuple[ 0 ] + "With" ](
  11468. this,
  11469. fn ? [ returned ] : arguments
  11470. );
  11471. }
  11472. } );
  11473. } );
  11474. fns = null;
  11475. } ).promise();
  11476. },
  11477. then: function( onFulfilled, onRejected, onProgress ) {
  11478. var maxDepth = 0;
  11479. function resolve( depth, deferred, handler, special ) {
  11480. return function() {
  11481. var that = this,
  11482. args = arguments,
  11483. mightThrow = function() {
  11484. var returned, then;
  11485. // Support: Promises/A+ section 2.3.3.3.3
  11486. // https://promisesaplus.com/#point-59
  11487. // Ignore double-resolution attempts
  11488. if ( depth < maxDepth ) {
  11489. return;
  11490. }
  11491. returned = handler.apply( that, args );
  11492. // Support: Promises/A+ section 2.3.1
  11493. // https://promisesaplus.com/#point-48
  11494. if ( returned === deferred.promise() ) {
  11495. throw new TypeError( "Thenable self-resolution" );
  11496. }
  11497. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11498. // https://promisesaplus.com/#point-54
  11499. // https://promisesaplus.com/#point-75
  11500. // Retrieve `then` only once
  11501. then = returned &&
  11502. // Support: Promises/A+ section 2.3.4
  11503. // https://promisesaplus.com/#point-64
  11504. // Only check objects and functions for thenability
  11505. ( typeof returned === "object" ||
  11506. typeof returned === "function" ) &&
  11507. returned.then;
  11508. // Handle a returned thenable
  11509. if ( isFunction( then ) ) {
  11510. // Special processors (notify) just wait for resolution
  11511. if ( special ) {
  11512. then.call(
  11513. returned,
  11514. resolve( maxDepth, deferred, Identity, special ),
  11515. resolve( maxDepth, deferred, Thrower, special )
  11516. );
  11517. // Normal processors (resolve) also hook into progress
  11518. } else {
  11519. // ...and disregard older resolution values
  11520. maxDepth++;
  11521. then.call(
  11522. returned,
  11523. resolve( maxDepth, deferred, Identity, special ),
  11524. resolve( maxDepth, deferred, Thrower, special ),
  11525. resolve( maxDepth, deferred, Identity,
  11526. deferred.notifyWith )
  11527. );
  11528. }
  11529. // Handle all other returned values
  11530. } else {
  11531. // Only substitute handlers pass on context
  11532. // and multiple values (non-spec behavior)
  11533. if ( handler !== Identity ) {
  11534. that = undefined;
  11535. args = [ returned ];
  11536. }
  11537. // Process the value(s)
  11538. // Default process is resolve
  11539. ( special || deferred.resolveWith )( that, args );
  11540. }
  11541. },
  11542. // Only normal processors (resolve) catch and reject exceptions
  11543. process = special ?
  11544. mightThrow :
  11545. function() {
  11546. try {
  11547. mightThrow();
  11548. } catch ( e ) {
  11549. if ( jQuery.Deferred.exceptionHook ) {
  11550. jQuery.Deferred.exceptionHook( e,
  11551. process.stackTrace );
  11552. }
  11553. // Support: Promises/A+ section 2.3.3.3.4.1
  11554. // https://promisesaplus.com/#point-61
  11555. // Ignore post-resolution exceptions
  11556. if ( depth + 1 >= maxDepth ) {
  11557. // Only substitute handlers pass on context
  11558. // and multiple values (non-spec behavior)
  11559. if ( handler !== Thrower ) {
  11560. that = undefined;
  11561. args = [ e ];
  11562. }
  11563. deferred.rejectWith( that, args );
  11564. }
  11565. }
  11566. };
  11567. // Support: Promises/A+ section 2.3.3.3.1
  11568. // https://promisesaplus.com/#point-57
  11569. // Re-resolve promises immediately to dodge false rejection from
  11570. // subsequent errors
  11571. if ( depth ) {
  11572. process();
  11573. } else {
  11574. // Call an optional hook to record the stack, in case of exception
  11575. // since it's otherwise lost when execution goes async
  11576. if ( jQuery.Deferred.getStackHook ) {
  11577. process.stackTrace = jQuery.Deferred.getStackHook();
  11578. }
  11579. window.setTimeout( process );
  11580. }
  11581. };
  11582. }
  11583. return jQuery.Deferred( function( newDefer ) {
  11584. // progress_handlers.add( ... )
  11585. tuples[ 0 ][ 3 ].add(
  11586. resolve(
  11587. 0,
  11588. newDefer,
  11589. isFunction( onProgress ) ?
  11590. onProgress :
  11591. Identity,
  11592. newDefer.notifyWith
  11593. )
  11594. );
  11595. // fulfilled_handlers.add( ... )
  11596. tuples[ 1 ][ 3 ].add(
  11597. resolve(
  11598. 0,
  11599. newDefer,
  11600. isFunction( onFulfilled ) ?
  11601. onFulfilled :
  11602. Identity
  11603. )
  11604. );
  11605. // rejected_handlers.add( ... )
  11606. tuples[ 2 ][ 3 ].add(
  11607. resolve(
  11608. 0,
  11609. newDefer,
  11610. isFunction( onRejected ) ?
  11611. onRejected :
  11612. Thrower
  11613. )
  11614. );
  11615. } ).promise();
  11616. },
  11617. // Get a promise for this deferred
  11618. // If obj is provided, the promise aspect is added to the object
  11619. promise: function( obj ) {
  11620. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11621. }
  11622. },
  11623. deferred = {};
  11624. // Add list-specific methods
  11625. jQuery.each( tuples, function( i, tuple ) {
  11626. var list = tuple[ 2 ],
  11627. stateString = tuple[ 5 ];
  11628. // promise.progress = list.add
  11629. // promise.done = list.add
  11630. // promise.fail = list.add
  11631. promise[ tuple[ 1 ] ] = list.add;
  11632. // Handle state
  11633. if ( stateString ) {
  11634. list.add(
  11635. function() {
  11636. // state = "resolved" (i.e., fulfilled)
  11637. // state = "rejected"
  11638. state = stateString;
  11639. },
  11640. // rejected_callbacks.disable
  11641. // fulfilled_callbacks.disable
  11642. tuples[ 3 - i ][ 2 ].disable,
  11643. // rejected_handlers.disable
  11644. // fulfilled_handlers.disable
  11645. tuples[ 3 - i ][ 3 ].disable,
  11646. // progress_callbacks.lock
  11647. tuples[ 0 ][ 2 ].lock,
  11648. // progress_handlers.lock
  11649. tuples[ 0 ][ 3 ].lock
  11650. );
  11651. }
  11652. // progress_handlers.fire
  11653. // fulfilled_handlers.fire
  11654. // rejected_handlers.fire
  11655. list.add( tuple[ 3 ].fire );
  11656. // deferred.notify = function() { deferred.notifyWith(...) }
  11657. // deferred.resolve = function() { deferred.resolveWith(...) }
  11658. // deferred.reject = function() { deferred.rejectWith(...) }
  11659. deferred[ tuple[ 0 ] ] = function() {
  11660. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11661. return this;
  11662. };
  11663. // deferred.notifyWith = list.fireWith
  11664. // deferred.resolveWith = list.fireWith
  11665. // deferred.rejectWith = list.fireWith
  11666. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11667. } );
  11668. // Make the deferred a promise
  11669. promise.promise( deferred );
  11670. // Call given func if any
  11671. if ( func ) {
  11672. func.call( deferred, deferred );
  11673. }
  11674. // All done!
  11675. return deferred;
  11676. },
  11677. // Deferred helper
  11678. when: function( singleValue ) {
  11679. var
  11680. // count of uncompleted subordinates
  11681. remaining = arguments.length,
  11682. // count of unprocessed arguments
  11683. i = remaining,
  11684. // subordinate fulfillment data
  11685. resolveContexts = Array( i ),
  11686. resolveValues = slice.call( arguments ),
  11687. // the master Deferred
  11688. master = jQuery.Deferred(),
  11689. // subordinate callback factory
  11690. updateFunc = function( i ) {
  11691. return function( value ) {
  11692. resolveContexts[ i ] = this;
  11693. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11694. if ( !( --remaining ) ) {
  11695. master.resolveWith( resolveContexts, resolveValues );
  11696. }
  11697. };
  11698. };
  11699. // Single- and empty arguments are adopted like Promise.resolve
  11700. if ( remaining <= 1 ) {
  11701. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11702. !remaining );
  11703. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11704. if ( master.state() === "pending" ||
  11705. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11706. return master.then();
  11707. }
  11708. }
  11709. // Multiple arguments are aggregated like Promise.all array elements
  11710. while ( i-- ) {
  11711. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11712. }
  11713. return master.promise();
  11714. }
  11715. } );
  11716. // These usually indicate a programmer mistake during development,
  11717. // warn about them ASAP rather than swallowing them by default.
  11718. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11719. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11720. // Support: IE 8 - 9 only
  11721. // Console exists when dev tools are open, which can happen at any time
  11722. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11723. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11724. }
  11725. };
  11726. jQuery.readyException = function( error ) {
  11727. window.setTimeout( function() {
  11728. throw error;
  11729. } );
  11730. };
  11731. // The deferred used on DOM ready
  11732. var readyList = jQuery.Deferred();
  11733. jQuery.fn.ready = function( fn ) {
  11734. readyList
  11735. .then( fn )
  11736. // Wrap jQuery.readyException in a function so that the lookup
  11737. // happens at the time of error handling instead of callback
  11738. // registration.
  11739. .catch( function( error ) {
  11740. jQuery.readyException( error );
  11741. } );
  11742. return this;
  11743. };
  11744. jQuery.extend( {
  11745. // Is the DOM ready to be used? Set to true once it occurs.
  11746. isReady: false,
  11747. // A counter to track how many items to wait for before
  11748. // the ready event fires. See #6781
  11749. readyWait: 1,
  11750. // Handle when the DOM is ready
  11751. ready: function( wait ) {
  11752. // Abort if there are pending holds or we're already ready
  11753. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11754. return;
  11755. }
  11756. // Remember that the DOM is ready
  11757. jQuery.isReady = true;
  11758. // If a normal DOM Ready event fired, decrement, and wait if need be
  11759. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11760. return;
  11761. }
  11762. // If there are functions bound, to execute
  11763. readyList.resolveWith( document, [ jQuery ] );
  11764. }
  11765. } );
  11766. jQuery.ready.then = readyList.then;
  11767. // The ready event handler and self cleanup method
  11768. function completed() {
  11769. document.removeEventListener( "DOMContentLoaded", completed );
  11770. window.removeEventListener( "load", completed );
  11771. jQuery.ready();
  11772. }
  11773. // Catch cases where $(document).ready() is called
  11774. // after the browser event has already occurred.
  11775. // Support: IE <=9 - 10 only
  11776. // Older IE sometimes signals "interactive" too soon
  11777. if ( document.readyState === "complete" ||
  11778. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11779. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11780. window.setTimeout( jQuery.ready );
  11781. } else {
  11782. // Use the handy event callback
  11783. document.addEventListener( "DOMContentLoaded", completed );
  11784. // A fallback to window.onload, that will always work
  11785. window.addEventListener( "load", completed );
  11786. }
  11787. // Multifunctional method to get and set values of a collection
  11788. // The value/s can optionally be executed if it's a function
  11789. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11790. var i = 0,
  11791. len = elems.length,
  11792. bulk = key == null;
  11793. // Sets many values
  11794. if ( toType( key ) === "object" ) {
  11795. chainable = true;
  11796. for ( i in key ) {
  11797. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11798. }
  11799. // Sets one value
  11800. } else if ( value !== undefined ) {
  11801. chainable = true;
  11802. if ( !isFunction( value ) ) {
  11803. raw = true;
  11804. }
  11805. if ( bulk ) {
  11806. // Bulk operations run against the entire set
  11807. if ( raw ) {
  11808. fn.call( elems, value );
  11809. fn = null;
  11810. // ...except when executing function values
  11811. } else {
  11812. bulk = fn;
  11813. fn = function( elem, key, value ) {
  11814. return bulk.call( jQuery( elem ), value );
  11815. };
  11816. }
  11817. }
  11818. if ( fn ) {
  11819. for ( ; i < len; i++ ) {
  11820. fn(
  11821. elems[ i ], key, raw ?
  11822. value :
  11823. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11824. );
  11825. }
  11826. }
  11827. }
  11828. if ( chainable ) {
  11829. return elems;
  11830. }
  11831. // Gets
  11832. if ( bulk ) {
  11833. return fn.call( elems );
  11834. }
  11835. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11836. };
  11837. // Matches dashed string for camelizing
  11838. var rmsPrefix = /^-ms-/,
  11839. rdashAlpha = /-([a-z])/g;
  11840. // Used by camelCase as callback to replace()
  11841. function fcamelCase( all, letter ) {
  11842. return letter.toUpperCase();
  11843. }
  11844. // Convert dashed to camelCase; used by the css and data modules
  11845. // Support: IE <=9 - 11, Edge 12 - 15
  11846. // Microsoft forgot to hump their vendor prefix (#9572)
  11847. function camelCase( string ) {
  11848. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11849. }
  11850. var acceptData = function( owner ) {
  11851. // Accepts only:
  11852. // - Node
  11853. // - Node.ELEMENT_NODE
  11854. // - Node.DOCUMENT_NODE
  11855. // - Object
  11856. // - Any
  11857. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11858. };
  11859. function Data() {
  11860. this.expando = jQuery.expando + Data.uid++;
  11861. }
  11862. Data.uid = 1;
  11863. Data.prototype = {
  11864. cache: function( owner ) {
  11865. // Check if the owner object already has a cache
  11866. var value = owner[ this.expando ];
  11867. // If not, create one
  11868. if ( !value ) {
  11869. value = {};
  11870. // We can accept data for non-element nodes in modern browsers,
  11871. // but we should not, see #8335.
  11872. // Always return an empty object.
  11873. if ( acceptData( owner ) ) {
  11874. // If it is a node unlikely to be stringify-ed or looped over
  11875. // use plain assignment
  11876. if ( owner.nodeType ) {
  11877. owner[ this.expando ] = value;
  11878. // Otherwise secure it in a non-enumerable property
  11879. // configurable must be true to allow the property to be
  11880. // deleted when data is removed
  11881. } else {
  11882. Object.defineProperty( owner, this.expando, {
  11883. value: value,
  11884. configurable: true
  11885. } );
  11886. }
  11887. }
  11888. }
  11889. return value;
  11890. },
  11891. set: function( owner, data, value ) {
  11892. var prop,
  11893. cache = this.cache( owner );
  11894. // Handle: [ owner, key, value ] args
  11895. // Always use camelCase key (gh-2257)
  11896. if ( typeof data === "string" ) {
  11897. cache[ camelCase( data ) ] = value;
  11898. // Handle: [ owner, { properties } ] args
  11899. } else {
  11900. // Copy the properties one-by-one to the cache object
  11901. for ( prop in data ) {
  11902. cache[ camelCase( prop ) ] = data[ prop ];
  11903. }
  11904. }
  11905. return cache;
  11906. },
  11907. get: function( owner, key ) {
  11908. return key === undefined ?
  11909. this.cache( owner ) :
  11910. // Always use camelCase key (gh-2257)
  11911. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11912. },
  11913. access: function( owner, key, value ) {
  11914. // In cases where either:
  11915. //
  11916. // 1. No key was specified
  11917. // 2. A string key was specified, but no value provided
  11918. //
  11919. // Take the "read" path and allow the get method to determine
  11920. // which value to return, respectively either:
  11921. //
  11922. // 1. The entire cache object
  11923. // 2. The data stored at the key
  11924. //
  11925. if ( key === undefined ||
  11926. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11927. return this.get( owner, key );
  11928. }
  11929. // When the key is not a string, or both a key and value
  11930. // are specified, set or extend (existing objects) with either:
  11931. //
  11932. // 1. An object of properties
  11933. // 2. A key and value
  11934. //
  11935. this.set( owner, key, value );
  11936. // Since the "set" path can have two possible entry points
  11937. // return the expected data based on which path was taken[*]
  11938. return value !== undefined ? value : key;
  11939. },
  11940. remove: function( owner, key ) {
  11941. var i,
  11942. cache = owner[ this.expando ];
  11943. if ( cache === undefined ) {
  11944. return;
  11945. }
  11946. if ( key !== undefined ) {
  11947. // Support array or space separated string of keys
  11948. if ( Array.isArray( key ) ) {
  11949. // If key is an array of keys...
  11950. // We always set camelCase keys, so remove that.
  11951. key = key.map( camelCase );
  11952. } else {
  11953. key = camelCase( key );
  11954. // If a key with the spaces exists, use it.
  11955. // Otherwise, create an array by matching non-whitespace
  11956. key = key in cache ?
  11957. [ key ] :
  11958. ( key.match( rnothtmlwhite ) || [] );
  11959. }
  11960. i = key.length;
  11961. while ( i-- ) {
  11962. delete cache[ key[ i ] ];
  11963. }
  11964. }
  11965. // Remove the expando if there's no more data
  11966. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11967. // Support: Chrome <=35 - 45
  11968. // Webkit & Blink performance suffers when deleting properties
  11969. // from DOM nodes, so set to undefined instead
  11970. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11971. if ( owner.nodeType ) {
  11972. owner[ this.expando ] = undefined;
  11973. } else {
  11974. delete owner[ this.expando ];
  11975. }
  11976. }
  11977. },
  11978. hasData: function( owner ) {
  11979. var cache = owner[ this.expando ];
  11980. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11981. }
  11982. };
  11983. var dataPriv = new Data();
  11984. var dataUser = new Data();
  11985. // Implementation Summary
  11986. //
  11987. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11988. // 2. Improve the module's maintainability by reducing the storage
  11989. // paths to a single mechanism.
  11990. // 3. Use the same single mechanism to support "private" and "user" data.
  11991. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11992. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11993. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11994. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11995. rmultiDash = /[A-Z]/g;
  11996. function getData( data ) {
  11997. if ( data === "true" ) {
  11998. return true;
  11999. }
  12000. if ( data === "false" ) {
  12001. return false;
  12002. }
  12003. if ( data === "null" ) {
  12004. return null;
  12005. }
  12006. // Only convert to a number if it doesn't change the string
  12007. if ( data === +data + "" ) {
  12008. return +data;
  12009. }
  12010. if ( rbrace.test( data ) ) {
  12011. return JSON.parse( data );
  12012. }
  12013. return data;
  12014. }
  12015. function dataAttr( elem, key, data ) {
  12016. var name;
  12017. // If nothing was found internally, try to fetch any
  12018. // data from the HTML5 data-* attribute
  12019. if ( data === undefined && elem.nodeType === 1 ) {
  12020. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12021. data = elem.getAttribute( name );
  12022. if ( typeof data === "string" ) {
  12023. try {
  12024. data = getData( data );
  12025. } catch ( e ) {}
  12026. // Make sure we set the data so it isn't changed later
  12027. dataUser.set( elem, key, data );
  12028. } else {
  12029. data = undefined;
  12030. }
  12031. }
  12032. return data;
  12033. }
  12034. jQuery.extend( {
  12035. hasData: function( elem ) {
  12036. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12037. },
  12038. data: function( elem, name, data ) {
  12039. return dataUser.access( elem, name, data );
  12040. },
  12041. removeData: function( elem, name ) {
  12042. dataUser.remove( elem, name );
  12043. },
  12044. // TODO: Now that all calls to _data and _removeData have been replaced
  12045. // with direct calls to dataPriv methods, these can be deprecated.
  12046. _data: function( elem, name, data ) {
  12047. return dataPriv.access( elem, name, data );
  12048. },
  12049. _removeData: function( elem, name ) {
  12050. dataPriv.remove( elem, name );
  12051. }
  12052. } );
  12053. jQuery.fn.extend( {
  12054. data: function( key, value ) {
  12055. var i, name, data,
  12056. elem = this[ 0 ],
  12057. attrs = elem && elem.attributes;
  12058. // Gets all values
  12059. if ( key === undefined ) {
  12060. if ( this.length ) {
  12061. data = dataUser.get( elem );
  12062. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12063. i = attrs.length;
  12064. while ( i-- ) {
  12065. // Support: IE 11 only
  12066. // The attrs elements can be null (#14894)
  12067. if ( attrs[ i ] ) {
  12068. name = attrs[ i ].name;
  12069. if ( name.indexOf( "data-" ) === 0 ) {
  12070. name = camelCase( name.slice( 5 ) );
  12071. dataAttr( elem, name, data[ name ] );
  12072. }
  12073. }
  12074. }
  12075. dataPriv.set( elem, "hasDataAttrs", true );
  12076. }
  12077. }
  12078. return data;
  12079. }
  12080. // Sets multiple values
  12081. if ( typeof key === "object" ) {
  12082. return this.each( function() {
  12083. dataUser.set( this, key );
  12084. } );
  12085. }
  12086. return access( this, function( value ) {
  12087. var data;
  12088. // The calling jQuery object (element matches) is not empty
  12089. // (and therefore has an element appears at this[ 0 ]) and the
  12090. // `value` parameter was not undefined. An empty jQuery object
  12091. // will result in `undefined` for elem = this[ 0 ] which will
  12092. // throw an exception if an attempt to read a data cache is made.
  12093. if ( elem && value === undefined ) {
  12094. // Attempt to get data from the cache
  12095. // The key will always be camelCased in Data
  12096. data = dataUser.get( elem, key );
  12097. if ( data !== undefined ) {
  12098. return data;
  12099. }
  12100. // Attempt to "discover" the data in
  12101. // HTML5 custom data-* attrs
  12102. data = dataAttr( elem, key );
  12103. if ( data !== undefined ) {
  12104. return data;
  12105. }
  12106. // We tried really hard, but the data doesn't exist.
  12107. return;
  12108. }
  12109. // Set the data...
  12110. this.each( function() {
  12111. // We always store the camelCased key
  12112. dataUser.set( this, key, value );
  12113. } );
  12114. }, null, value, arguments.length > 1, null, true );
  12115. },
  12116. removeData: function( key ) {
  12117. return this.each( function() {
  12118. dataUser.remove( this, key );
  12119. } );
  12120. }
  12121. } );
  12122. jQuery.extend( {
  12123. queue: function( elem, type, data ) {
  12124. var queue;
  12125. if ( elem ) {
  12126. type = ( type || "fx" ) + "queue";
  12127. queue = dataPriv.get( elem, type );
  12128. // Speed up dequeue by getting out quickly if this is just a lookup
  12129. if ( data ) {
  12130. if ( !queue || Array.isArray( data ) ) {
  12131. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12132. } else {
  12133. queue.push( data );
  12134. }
  12135. }
  12136. return queue || [];
  12137. }
  12138. },
  12139. dequeue: function( elem, type ) {
  12140. type = type || "fx";
  12141. var queue = jQuery.queue( elem, type ),
  12142. startLength = queue.length,
  12143. fn = queue.shift(),
  12144. hooks = jQuery._queueHooks( elem, type ),
  12145. next = function() {
  12146. jQuery.dequeue( elem, type );
  12147. };
  12148. // If the fx queue is dequeued, always remove the progress sentinel
  12149. if ( fn === "inprogress" ) {
  12150. fn = queue.shift();
  12151. startLength--;
  12152. }
  12153. if ( fn ) {
  12154. // Add a progress sentinel to prevent the fx queue from being
  12155. // automatically dequeued
  12156. if ( type === "fx" ) {
  12157. queue.unshift( "inprogress" );
  12158. }
  12159. // Clear up the last queue stop function
  12160. delete hooks.stop;
  12161. fn.call( elem, next, hooks );
  12162. }
  12163. if ( !startLength && hooks ) {
  12164. hooks.empty.fire();
  12165. }
  12166. },
  12167. // Not public - generate a queueHooks object, or return the current one
  12168. _queueHooks: function( elem, type ) {
  12169. var key = type + "queueHooks";
  12170. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12171. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12172. dataPriv.remove( elem, [ type + "queue", key ] );
  12173. } )
  12174. } );
  12175. }
  12176. } );
  12177. jQuery.fn.extend( {
  12178. queue: function( type, data ) {
  12179. var setter = 2;
  12180. if ( typeof type !== "string" ) {
  12181. data = type;
  12182. type = "fx";
  12183. setter--;
  12184. }
  12185. if ( arguments.length < setter ) {
  12186. return jQuery.queue( this[ 0 ], type );
  12187. }
  12188. return data === undefined ?
  12189. this :
  12190. this.each( function() {
  12191. var queue = jQuery.queue( this, type, data );
  12192. // Ensure a hooks for this queue
  12193. jQuery._queueHooks( this, type );
  12194. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12195. jQuery.dequeue( this, type );
  12196. }
  12197. } );
  12198. },
  12199. dequeue: function( type ) {
  12200. return this.each( function() {
  12201. jQuery.dequeue( this, type );
  12202. } );
  12203. },
  12204. clearQueue: function( type ) {
  12205. return this.queue( type || "fx", [] );
  12206. },
  12207. // Get a promise resolved when queues of a certain type
  12208. // are emptied (fx is the type by default)
  12209. promise: function( type, obj ) {
  12210. var tmp,
  12211. count = 1,
  12212. defer = jQuery.Deferred(),
  12213. elements = this,
  12214. i = this.length,
  12215. resolve = function() {
  12216. if ( !( --count ) ) {
  12217. defer.resolveWith( elements, [ elements ] );
  12218. }
  12219. };
  12220. if ( typeof type !== "string" ) {
  12221. obj = type;
  12222. type = undefined;
  12223. }
  12224. type = type || "fx";
  12225. while ( i-- ) {
  12226. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12227. if ( tmp && tmp.empty ) {
  12228. count++;
  12229. tmp.empty.add( resolve );
  12230. }
  12231. }
  12232. resolve();
  12233. return defer.promise( obj );
  12234. }
  12235. } );
  12236. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12237. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12238. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12239. var documentElement = document.documentElement;
  12240. var isAttached = function( elem ) {
  12241. return jQuery.contains( elem.ownerDocument, elem );
  12242. },
  12243. composed = { composed: true };
  12244. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12245. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12246. // Support: iOS 10.0-10.2 only
  12247. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12248. // leading to errors. We need to check for `getRootNode`.
  12249. if ( documentElement.getRootNode ) {
  12250. isAttached = function( elem ) {
  12251. return jQuery.contains( elem.ownerDocument, elem ) ||
  12252. elem.getRootNode( composed ) === elem.ownerDocument;
  12253. };
  12254. }
  12255. var isHiddenWithinTree = function( elem, el ) {
  12256. // isHiddenWithinTree might be called from jQuery#filter function;
  12257. // in that case, element will be second argument
  12258. elem = el || elem;
  12259. // Inline style trumps all
  12260. return elem.style.display === "none" ||
  12261. elem.style.display === "" &&
  12262. // Otherwise, check computed style
  12263. // Support: Firefox <=43 - 45
  12264. // Disconnected elements can have computed display: none, so first confirm that elem is
  12265. // in the document.
  12266. isAttached( elem ) &&
  12267. jQuery.css( elem, "display" ) === "none";
  12268. };
  12269. var swap = function( elem, options, callback, args ) {
  12270. var ret, name,
  12271. old = {};
  12272. // Remember the old values, and insert the new ones
  12273. for ( name in options ) {
  12274. old[ name ] = elem.style[ name ];
  12275. elem.style[ name ] = options[ name ];
  12276. }
  12277. ret = callback.apply( elem, args || [] );
  12278. // Revert the old values
  12279. for ( name in options ) {
  12280. elem.style[ name ] = old[ name ];
  12281. }
  12282. return ret;
  12283. };
  12284. function adjustCSS( elem, prop, valueParts, tween ) {
  12285. var adjusted, scale,
  12286. maxIterations = 20,
  12287. currentValue = tween ?
  12288. function() {
  12289. return tween.cur();
  12290. } :
  12291. function() {
  12292. return jQuery.css( elem, prop, "" );
  12293. },
  12294. initial = currentValue(),
  12295. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12296. // Starting value computation is required for potential unit mismatches
  12297. initialInUnit = elem.nodeType &&
  12298. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12299. rcssNum.exec( jQuery.css( elem, prop ) );
  12300. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12301. // Support: Firefox <=54
  12302. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12303. initial = initial / 2;
  12304. // Trust units reported by jQuery.css
  12305. unit = unit || initialInUnit[ 3 ];
  12306. // Iteratively approximate from a nonzero starting point
  12307. initialInUnit = +initial || 1;
  12308. while ( maxIterations-- ) {
  12309. // Evaluate and update our best guess (doubling guesses that zero out).
  12310. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12311. jQuery.style( elem, prop, initialInUnit + unit );
  12312. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12313. maxIterations = 0;
  12314. }
  12315. initialInUnit = initialInUnit / scale;
  12316. }
  12317. initialInUnit = initialInUnit * 2;
  12318. jQuery.style( elem, prop, initialInUnit + unit );
  12319. // Make sure we update the tween properties later on
  12320. valueParts = valueParts || [];
  12321. }
  12322. if ( valueParts ) {
  12323. initialInUnit = +initialInUnit || +initial || 0;
  12324. // Apply relative offset (+=/-=) if specified
  12325. adjusted = valueParts[ 1 ] ?
  12326. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12327. +valueParts[ 2 ];
  12328. if ( tween ) {
  12329. tween.unit = unit;
  12330. tween.start = initialInUnit;
  12331. tween.end = adjusted;
  12332. }
  12333. }
  12334. return adjusted;
  12335. }
  12336. var defaultDisplayMap = {};
  12337. function getDefaultDisplay( elem ) {
  12338. var temp,
  12339. doc = elem.ownerDocument,
  12340. nodeName = elem.nodeName,
  12341. display = defaultDisplayMap[ nodeName ];
  12342. if ( display ) {
  12343. return display;
  12344. }
  12345. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12346. display = jQuery.css( temp, "display" );
  12347. temp.parentNode.removeChild( temp );
  12348. if ( display === "none" ) {
  12349. display = "block";
  12350. }
  12351. defaultDisplayMap[ nodeName ] = display;
  12352. return display;
  12353. }
  12354. function showHide( elements, show ) {
  12355. var display, elem,
  12356. values = [],
  12357. index = 0,
  12358. length = elements.length;
  12359. // Determine new display value for elements that need to change
  12360. for ( ; index < length; index++ ) {
  12361. elem = elements[ index ];
  12362. if ( !elem.style ) {
  12363. continue;
  12364. }
  12365. display = elem.style.display;
  12366. if ( show ) {
  12367. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12368. // check is required in this first loop unless we have a nonempty display value (either
  12369. // inline or about-to-be-restored)
  12370. if ( display === "none" ) {
  12371. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12372. if ( !values[ index ] ) {
  12373. elem.style.display = "";
  12374. }
  12375. }
  12376. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12377. values[ index ] = getDefaultDisplay( elem );
  12378. }
  12379. } else {
  12380. if ( display !== "none" ) {
  12381. values[ index ] = "none";
  12382. // Remember what we're overwriting
  12383. dataPriv.set( elem, "display", display );
  12384. }
  12385. }
  12386. }
  12387. // Set the display of the elements in a second loop to avoid constant reflow
  12388. for ( index = 0; index < length; index++ ) {
  12389. if ( values[ index ] != null ) {
  12390. elements[ index ].style.display = values[ index ];
  12391. }
  12392. }
  12393. return elements;
  12394. }
  12395. jQuery.fn.extend( {
  12396. show: function() {
  12397. return showHide( this, true );
  12398. },
  12399. hide: function() {
  12400. return showHide( this );
  12401. },
  12402. toggle: function( state ) {
  12403. if ( typeof state === "boolean" ) {
  12404. return state ? this.show() : this.hide();
  12405. }
  12406. return this.each( function() {
  12407. if ( isHiddenWithinTree( this ) ) {
  12408. jQuery( this ).show();
  12409. } else {
  12410. jQuery( this ).hide();
  12411. }
  12412. } );
  12413. }
  12414. } );
  12415. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12416. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12417. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12418. // We have to close these tags to support XHTML (#13200)
  12419. var wrapMap = {
  12420. // Support: IE <=9 only
  12421. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12422. // XHTML parsers do not magically insert elements in the
  12423. // same way that tag soup parsers do. So we cannot shorten
  12424. // this by omitting <tbody> or other required elements.
  12425. thead: [ 1, "<table>", "</table>" ],
  12426. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12427. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12428. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12429. _default: [ 0, "", "" ]
  12430. };
  12431. // Support: IE <=9 only
  12432. wrapMap.optgroup = wrapMap.option;
  12433. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12434. wrapMap.th = wrapMap.td;
  12435. function getAll( context, tag ) {
  12436. // Support: IE <=9 - 11 only
  12437. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12438. var ret;
  12439. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12440. ret = context.getElementsByTagName( tag || "*" );
  12441. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12442. ret = context.querySelectorAll( tag || "*" );
  12443. } else {
  12444. ret = [];
  12445. }
  12446. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12447. return jQuery.merge( [ context ], ret );
  12448. }
  12449. return ret;
  12450. }
  12451. // Mark scripts as having already been evaluated
  12452. function setGlobalEval( elems, refElements ) {
  12453. var i = 0,
  12454. l = elems.length;
  12455. for ( ; i < l; i++ ) {
  12456. dataPriv.set(
  12457. elems[ i ],
  12458. "globalEval",
  12459. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12460. );
  12461. }
  12462. }
  12463. var rhtml = /<|&#?\w+;/;
  12464. function buildFragment( elems, context, scripts, selection, ignored ) {
  12465. var elem, tmp, tag, wrap, attached, j,
  12466. fragment = context.createDocumentFragment(),
  12467. nodes = [],
  12468. i = 0,
  12469. l = elems.length;
  12470. for ( ; i < l; i++ ) {
  12471. elem = elems[ i ];
  12472. if ( elem || elem === 0 ) {
  12473. // Add nodes directly
  12474. if ( toType( elem ) === "object" ) {
  12475. // Support: Android <=4.0 only, PhantomJS 1 only
  12476. // push.apply(_, arraylike) throws on ancient WebKit
  12477. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12478. // Convert non-html into a text node
  12479. } else if ( !rhtml.test( elem ) ) {
  12480. nodes.push( context.createTextNode( elem ) );
  12481. // Convert html into DOM nodes
  12482. } else {
  12483. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12484. // Deserialize a standard representation
  12485. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12486. wrap = wrapMap[ tag ] || wrapMap._default;
  12487. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12488. // Descend through wrappers to the right content
  12489. j = wrap[ 0 ];
  12490. while ( j-- ) {
  12491. tmp = tmp.lastChild;
  12492. }
  12493. // Support: Android <=4.0 only, PhantomJS 1 only
  12494. // push.apply(_, arraylike) throws on ancient WebKit
  12495. jQuery.merge( nodes, tmp.childNodes );
  12496. // Remember the top-level container
  12497. tmp = fragment.firstChild;
  12498. // Ensure the created nodes are orphaned (#12392)
  12499. tmp.textContent = "";
  12500. }
  12501. }
  12502. }
  12503. // Remove wrapper from fragment
  12504. fragment.textContent = "";
  12505. i = 0;
  12506. while ( ( elem = nodes[ i++ ] ) ) {
  12507. // Skip elements already in the context collection (trac-4087)
  12508. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12509. if ( ignored ) {
  12510. ignored.push( elem );
  12511. }
  12512. continue;
  12513. }
  12514. attached = isAttached( elem );
  12515. // Append to fragment
  12516. tmp = getAll( fragment.appendChild( elem ), "script" );
  12517. // Preserve script evaluation history
  12518. if ( attached ) {
  12519. setGlobalEval( tmp );
  12520. }
  12521. // Capture executables
  12522. if ( scripts ) {
  12523. j = 0;
  12524. while ( ( elem = tmp[ j++ ] ) ) {
  12525. if ( rscriptType.test( elem.type || "" ) ) {
  12526. scripts.push( elem );
  12527. }
  12528. }
  12529. }
  12530. }
  12531. return fragment;
  12532. }
  12533. ( function() {
  12534. var fragment = document.createDocumentFragment(),
  12535. div = fragment.appendChild( document.createElement( "div" ) ),
  12536. input = document.createElement( "input" );
  12537. // Support: Android 4.0 - 4.3 only
  12538. // Check state lost if the name is set (#11217)
  12539. // Support: Windows Web Apps (WWA)
  12540. // `name` and `type` must use .setAttribute for WWA (#14901)
  12541. input.setAttribute( "type", "radio" );
  12542. input.setAttribute( "checked", "checked" );
  12543. input.setAttribute( "name", "t" );
  12544. div.appendChild( input );
  12545. // Support: Android <=4.1 only
  12546. // Older WebKit doesn't clone checked state correctly in fragments
  12547. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12548. // Support: IE <=11 only
  12549. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12550. div.innerHTML = "<textarea>x</textarea>";
  12551. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12552. } )();
  12553. var
  12554. rkeyEvent = /^key/,
  12555. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12556. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12557. function returnTrue() {
  12558. return true;
  12559. }
  12560. function returnFalse() {
  12561. return false;
  12562. }
  12563. // Support: IE <=9 - 11+
  12564. // focus() and blur() are asynchronous, except when they are no-op.
  12565. // So expect focus to be synchronous when the element is already active,
  12566. // and blur to be synchronous when the element is not already active.
  12567. // (focus and blur are always synchronous in other supported browsers,
  12568. // this just defines when we can count on it).
  12569. function expectSync( elem, type ) {
  12570. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12571. }
  12572. // Support: IE <=9 only
  12573. // Accessing document.activeElement can throw unexpectedly
  12574. // https://bugs.jquery.com/ticket/13393
  12575. function safeActiveElement() {
  12576. try {
  12577. return document.activeElement;
  12578. } catch ( err ) { }
  12579. }
  12580. function on( elem, types, selector, data, fn, one ) {
  12581. var origFn, type;
  12582. // Types can be a map of types/handlers
  12583. if ( typeof types === "object" ) {
  12584. // ( types-Object, selector, data )
  12585. if ( typeof selector !== "string" ) {
  12586. // ( types-Object, data )
  12587. data = data || selector;
  12588. selector = undefined;
  12589. }
  12590. for ( type in types ) {
  12591. on( elem, type, selector, data, types[ type ], one );
  12592. }
  12593. return elem;
  12594. }
  12595. if ( data == null && fn == null ) {
  12596. // ( types, fn )
  12597. fn = selector;
  12598. data = selector = undefined;
  12599. } else if ( fn == null ) {
  12600. if ( typeof selector === "string" ) {
  12601. // ( types, selector, fn )
  12602. fn = data;
  12603. data = undefined;
  12604. } else {
  12605. // ( types, data, fn )
  12606. fn = data;
  12607. data = selector;
  12608. selector = undefined;
  12609. }
  12610. }
  12611. if ( fn === false ) {
  12612. fn = returnFalse;
  12613. } else if ( !fn ) {
  12614. return elem;
  12615. }
  12616. if ( one === 1 ) {
  12617. origFn = fn;
  12618. fn = function( event ) {
  12619. // Can use an empty set, since event contains the info
  12620. jQuery().off( event );
  12621. return origFn.apply( this, arguments );
  12622. };
  12623. // Use same guid so caller can remove using origFn
  12624. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12625. }
  12626. return elem.each( function() {
  12627. jQuery.event.add( this, types, fn, data, selector );
  12628. } );
  12629. }
  12630. /*
  12631. * Helper functions for managing events -- not part of the public interface.
  12632. * Props to Dean Edwards' addEvent library for many of the ideas.
  12633. */
  12634. jQuery.event = {
  12635. global: {},
  12636. add: function( elem, types, handler, data, selector ) {
  12637. var handleObjIn, eventHandle, tmp,
  12638. events, t, handleObj,
  12639. special, handlers, type, namespaces, origType,
  12640. elemData = dataPriv.get( elem );
  12641. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12642. if ( !elemData ) {
  12643. return;
  12644. }
  12645. // Caller can pass in an object of custom data in lieu of the handler
  12646. if ( handler.handler ) {
  12647. handleObjIn = handler;
  12648. handler = handleObjIn.handler;
  12649. selector = handleObjIn.selector;
  12650. }
  12651. // Ensure that invalid selectors throw exceptions at attach time
  12652. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12653. if ( selector ) {
  12654. jQuery.find.matchesSelector( documentElement, selector );
  12655. }
  12656. // Make sure that the handler has a unique ID, used to find/remove it later
  12657. if ( !handler.guid ) {
  12658. handler.guid = jQuery.guid++;
  12659. }
  12660. // Init the element's event structure and main handler, if this is the first
  12661. if ( !( events = elemData.events ) ) {
  12662. events = elemData.events = {};
  12663. }
  12664. if ( !( eventHandle = elemData.handle ) ) {
  12665. eventHandle = elemData.handle = function( e ) {
  12666. // Discard the second event of a jQuery.event.trigger() and
  12667. // when an event is called after a page has unloaded
  12668. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12669. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12670. };
  12671. }
  12672. // Handle multiple events separated by a space
  12673. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12674. t = types.length;
  12675. while ( t-- ) {
  12676. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12677. type = origType = tmp[ 1 ];
  12678. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12679. // There *must* be a type, no attaching namespace-only handlers
  12680. if ( !type ) {
  12681. continue;
  12682. }
  12683. // If event changes its type, use the special event handlers for the changed type
  12684. special = jQuery.event.special[ type ] || {};
  12685. // If selector defined, determine special event api type, otherwise given type
  12686. type = ( selector ? special.delegateType : special.bindType ) || type;
  12687. // Update special based on newly reset type
  12688. special = jQuery.event.special[ type ] || {};
  12689. // handleObj is passed to all event handlers
  12690. handleObj = jQuery.extend( {
  12691. type: type,
  12692. origType: origType,
  12693. data: data,
  12694. handler: handler,
  12695. guid: handler.guid,
  12696. selector: selector,
  12697. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12698. namespace: namespaces.join( "." )
  12699. }, handleObjIn );
  12700. // Init the event handler queue if we're the first
  12701. if ( !( handlers = events[ type ] ) ) {
  12702. handlers = events[ type ] = [];
  12703. handlers.delegateCount = 0;
  12704. // Only use addEventListener if the special events handler returns false
  12705. if ( !special.setup ||
  12706. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12707. if ( elem.addEventListener ) {
  12708. elem.addEventListener( type, eventHandle );
  12709. }
  12710. }
  12711. }
  12712. if ( special.add ) {
  12713. special.add.call( elem, handleObj );
  12714. if ( !handleObj.handler.guid ) {
  12715. handleObj.handler.guid = handler.guid;
  12716. }
  12717. }
  12718. // Add to the element's handler list, delegates in front
  12719. if ( selector ) {
  12720. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12721. } else {
  12722. handlers.push( handleObj );
  12723. }
  12724. // Keep track of which events have ever been used, for event optimization
  12725. jQuery.event.global[ type ] = true;
  12726. }
  12727. },
  12728. // Detach an event or set of events from an element
  12729. remove: function( elem, types, handler, selector, mappedTypes ) {
  12730. var j, origCount, tmp,
  12731. events, t, handleObj,
  12732. special, handlers, type, namespaces, origType,
  12733. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12734. if ( !elemData || !( events = elemData.events ) ) {
  12735. return;
  12736. }
  12737. // Once for each type.namespace in types; type may be omitted
  12738. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12739. t = types.length;
  12740. while ( t-- ) {
  12741. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12742. type = origType = tmp[ 1 ];
  12743. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12744. // Unbind all events (on this namespace, if provided) for the element
  12745. if ( !type ) {
  12746. for ( type in events ) {
  12747. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12748. }
  12749. continue;
  12750. }
  12751. special = jQuery.event.special[ type ] || {};
  12752. type = ( selector ? special.delegateType : special.bindType ) || type;
  12753. handlers = events[ type ] || [];
  12754. tmp = tmp[ 2 ] &&
  12755. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12756. // Remove matching events
  12757. origCount = j = handlers.length;
  12758. while ( j-- ) {
  12759. handleObj = handlers[ j ];
  12760. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12761. ( !handler || handler.guid === handleObj.guid ) &&
  12762. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12763. ( !selector || selector === handleObj.selector ||
  12764. selector === "**" && handleObj.selector ) ) {
  12765. handlers.splice( j, 1 );
  12766. if ( handleObj.selector ) {
  12767. handlers.delegateCount--;
  12768. }
  12769. if ( special.remove ) {
  12770. special.remove.call( elem, handleObj );
  12771. }
  12772. }
  12773. }
  12774. // Remove generic event handler if we removed something and no more handlers exist
  12775. // (avoids potential for endless recursion during removal of special event handlers)
  12776. if ( origCount && !handlers.length ) {
  12777. if ( !special.teardown ||
  12778. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12779. jQuery.removeEvent( elem, type, elemData.handle );
  12780. }
  12781. delete events[ type ];
  12782. }
  12783. }
  12784. // Remove data and the expando if it's no longer used
  12785. if ( jQuery.isEmptyObject( events ) ) {
  12786. dataPriv.remove( elem, "handle events" );
  12787. }
  12788. },
  12789. dispatch: function( nativeEvent ) {
  12790. // Make a writable jQuery.Event from the native event object
  12791. var event = jQuery.event.fix( nativeEvent );
  12792. var i, j, ret, matched, handleObj, handlerQueue,
  12793. args = new Array( arguments.length ),
  12794. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12795. special = jQuery.event.special[ event.type ] || {};
  12796. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12797. args[ 0 ] = event;
  12798. for ( i = 1; i < arguments.length; i++ ) {
  12799. args[ i ] = arguments[ i ];
  12800. }
  12801. event.delegateTarget = this;
  12802. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12803. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12804. return;
  12805. }
  12806. // Determine handlers
  12807. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12808. // Run delegates first; they may want to stop propagation beneath us
  12809. i = 0;
  12810. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12811. event.currentTarget = matched.elem;
  12812. j = 0;
  12813. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12814. !event.isImmediatePropagationStopped() ) {
  12815. // If the event is namespaced, then each handler is only invoked if it is
  12816. // specially universal or its namespaces are a superset of the event's.
  12817. if ( !event.rnamespace || handleObj.namespace === false ||
  12818. event.rnamespace.test( handleObj.namespace ) ) {
  12819. event.handleObj = handleObj;
  12820. event.data = handleObj.data;
  12821. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12822. handleObj.handler ).apply( matched.elem, args );
  12823. if ( ret !== undefined ) {
  12824. if ( ( event.result = ret ) === false ) {
  12825. event.preventDefault();
  12826. event.stopPropagation();
  12827. }
  12828. }
  12829. }
  12830. }
  12831. }
  12832. // Call the postDispatch hook for the mapped type
  12833. if ( special.postDispatch ) {
  12834. special.postDispatch.call( this, event );
  12835. }
  12836. return event.result;
  12837. },
  12838. handlers: function( event, handlers ) {
  12839. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12840. handlerQueue = [],
  12841. delegateCount = handlers.delegateCount,
  12842. cur = event.target;
  12843. // Find delegate handlers
  12844. if ( delegateCount &&
  12845. // Support: IE <=9
  12846. // Black-hole SVG <use> instance trees (trac-13180)
  12847. cur.nodeType &&
  12848. // Support: Firefox <=42
  12849. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12850. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12851. // Support: IE 11 only
  12852. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12853. !( event.type === "click" && event.button >= 1 ) ) {
  12854. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12855. // Don't check non-elements (#13208)
  12856. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12857. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12858. matchedHandlers = [];
  12859. matchedSelectors = {};
  12860. for ( i = 0; i < delegateCount; i++ ) {
  12861. handleObj = handlers[ i ];
  12862. // Don't conflict with Object.prototype properties (#13203)
  12863. sel = handleObj.selector + " ";
  12864. if ( matchedSelectors[ sel ] === undefined ) {
  12865. matchedSelectors[ sel ] = handleObj.needsContext ?
  12866. jQuery( sel, this ).index( cur ) > -1 :
  12867. jQuery.find( sel, this, null, [ cur ] ).length;
  12868. }
  12869. if ( matchedSelectors[ sel ] ) {
  12870. matchedHandlers.push( handleObj );
  12871. }
  12872. }
  12873. if ( matchedHandlers.length ) {
  12874. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12875. }
  12876. }
  12877. }
  12878. }
  12879. // Add the remaining (directly-bound) handlers
  12880. cur = this;
  12881. if ( delegateCount < handlers.length ) {
  12882. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12883. }
  12884. return handlerQueue;
  12885. },
  12886. addProp: function( name, hook ) {
  12887. Object.defineProperty( jQuery.Event.prototype, name, {
  12888. enumerable: true,
  12889. configurable: true,
  12890. get: isFunction( hook ) ?
  12891. function() {
  12892. if ( this.originalEvent ) {
  12893. return hook( this.originalEvent );
  12894. }
  12895. } :
  12896. function() {
  12897. if ( this.originalEvent ) {
  12898. return this.originalEvent[ name ];
  12899. }
  12900. },
  12901. set: function( value ) {
  12902. Object.defineProperty( this, name, {
  12903. enumerable: true,
  12904. configurable: true,
  12905. writable: true,
  12906. value: value
  12907. } );
  12908. }
  12909. } );
  12910. },
  12911. fix: function( originalEvent ) {
  12912. return originalEvent[ jQuery.expando ] ?
  12913. originalEvent :
  12914. new jQuery.Event( originalEvent );
  12915. },
  12916. special: {
  12917. load: {
  12918. // Prevent triggered image.load events from bubbling to window.load
  12919. noBubble: true
  12920. },
  12921. click: {
  12922. // Utilize native event to ensure correct state for checkable inputs
  12923. setup: function( data ) {
  12924. // For mutual compressibility with _default, replace `this` access with a local var.
  12925. // `|| data` is dead code meant only to preserve the variable through minification.
  12926. var el = this || data;
  12927. // Claim the first handler
  12928. if ( rcheckableType.test( el.type ) &&
  12929. el.click && nodeName( el, "input" ) ) {
  12930. // dataPriv.set( el, "click", ... )
  12931. leverageNative( el, "click", returnTrue );
  12932. }
  12933. // Return false to allow normal processing in the caller
  12934. return false;
  12935. },
  12936. trigger: function( data ) {
  12937. // For mutual compressibility with _default, replace `this` access with a local var.
  12938. // `|| data` is dead code meant only to preserve the variable through minification.
  12939. var el = this || data;
  12940. // Force setup before triggering a click
  12941. if ( rcheckableType.test( el.type ) &&
  12942. el.click && nodeName( el, "input" ) ) {
  12943. leverageNative( el, "click" );
  12944. }
  12945. // Return non-false to allow normal event-path propagation
  12946. return true;
  12947. },
  12948. // For cross-browser consistency, suppress native .click() on links
  12949. // Also prevent it if we're currently inside a leveraged native-event stack
  12950. _default: function( event ) {
  12951. var target = event.target;
  12952. return rcheckableType.test( target.type ) &&
  12953. target.click && nodeName( target, "input" ) &&
  12954. dataPriv.get( target, "click" ) ||
  12955. nodeName( target, "a" );
  12956. }
  12957. },
  12958. beforeunload: {
  12959. postDispatch: function( event ) {
  12960. // Support: Firefox 20+
  12961. // Firefox doesn't alert if the returnValue field is not set.
  12962. if ( event.result !== undefined && event.originalEvent ) {
  12963. event.originalEvent.returnValue = event.result;
  12964. }
  12965. }
  12966. }
  12967. }
  12968. };
  12969. // Ensure the presence of an event listener that handles manually-triggered
  12970. // synthetic events by interrupting progress until reinvoked in response to
  12971. // *native* events that it fires directly, ensuring that state changes have
  12972. // already occurred before other listeners are invoked.
  12973. function leverageNative( el, type, expectSync ) {
  12974. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12975. if ( !expectSync ) {
  12976. if ( dataPriv.get( el, type ) === undefined ) {
  12977. jQuery.event.add( el, type, returnTrue );
  12978. }
  12979. return;
  12980. }
  12981. // Register the controller as a special universal handler for all event namespaces
  12982. dataPriv.set( el, type, false );
  12983. jQuery.event.add( el, type, {
  12984. namespace: false,
  12985. handler: function( event ) {
  12986. var notAsync, result,
  12987. saved = dataPriv.get( this, type );
  12988. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12989. // Interrupt processing of the outer synthetic .trigger()ed event
  12990. // Saved data should be false in such cases, but might be a leftover capture object
  12991. // from an async native handler (gh-4350)
  12992. if ( !saved.length ) {
  12993. // Store arguments for use when handling the inner native event
  12994. // There will always be at least one argument (an event object), so this array
  12995. // will not be confused with a leftover capture object.
  12996. saved = slice.call( arguments );
  12997. dataPriv.set( this, type, saved );
  12998. // Trigger the native event and capture its result
  12999. // Support: IE <=9 - 11+
  13000. // focus() and blur() are asynchronous
  13001. notAsync = expectSync( this, type );
  13002. this[ type ]();
  13003. result = dataPriv.get( this, type );
  13004. if ( saved !== result || notAsync ) {
  13005. dataPriv.set( this, type, false );
  13006. } else {
  13007. result = {};
  13008. }
  13009. if ( saved !== result ) {
  13010. // Cancel the outer synthetic event
  13011. event.stopImmediatePropagation();
  13012. event.preventDefault();
  13013. return result.value;
  13014. }
  13015. // If this is an inner synthetic event for an event with a bubbling surrogate
  13016. // (focus or blur), assume that the surrogate already propagated from triggering the
  13017. // native event and prevent that from happening again here.
  13018. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13019. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13020. // less bad than duplication.
  13021. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13022. event.stopPropagation();
  13023. }
  13024. // If this is a native event triggered above, everything is now in order
  13025. // Fire an inner synthetic event with the original arguments
  13026. } else if ( saved.length ) {
  13027. // ...and capture the result
  13028. dataPriv.set( this, type, {
  13029. value: jQuery.event.trigger(
  13030. // Support: IE <=9 - 11+
  13031. // Extend with the prototype to reset the above stopImmediatePropagation()
  13032. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13033. saved.slice( 1 ),
  13034. this
  13035. )
  13036. } );
  13037. // Abort handling of the native event
  13038. event.stopImmediatePropagation();
  13039. }
  13040. }
  13041. } );
  13042. }
  13043. jQuery.removeEvent = function( elem, type, handle ) {
  13044. // This "if" is needed for plain objects
  13045. if ( elem.removeEventListener ) {
  13046. elem.removeEventListener( type, handle );
  13047. }
  13048. };
  13049. jQuery.Event = function( src, props ) {
  13050. // Allow instantiation without the 'new' keyword
  13051. if ( !( this instanceof jQuery.Event ) ) {
  13052. return new jQuery.Event( src, props );
  13053. }
  13054. // Event object
  13055. if ( src && src.type ) {
  13056. this.originalEvent = src;
  13057. this.type = src.type;
  13058. // Events bubbling up the document may have been marked as prevented
  13059. // by a handler lower down the tree; reflect the correct value.
  13060. this.isDefaultPrevented = src.defaultPrevented ||
  13061. src.defaultPrevented === undefined &&
  13062. // Support: Android <=2.3 only
  13063. src.returnValue === false ?
  13064. returnTrue :
  13065. returnFalse;
  13066. // Create target properties
  13067. // Support: Safari <=6 - 7 only
  13068. // Target should not be a text node (#504, #13143)
  13069. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13070. src.target.parentNode :
  13071. src.target;
  13072. this.currentTarget = src.currentTarget;
  13073. this.relatedTarget = src.relatedTarget;
  13074. // Event type
  13075. } else {
  13076. this.type = src;
  13077. }
  13078. // Put explicitly provided properties onto the event object
  13079. if ( props ) {
  13080. jQuery.extend( this, props );
  13081. }
  13082. // Create a timestamp if incoming event doesn't have one
  13083. this.timeStamp = src && src.timeStamp || Date.now();
  13084. // Mark it as fixed
  13085. this[ jQuery.expando ] = true;
  13086. };
  13087. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13088. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13089. jQuery.Event.prototype = {
  13090. constructor: jQuery.Event,
  13091. isDefaultPrevented: returnFalse,
  13092. isPropagationStopped: returnFalse,
  13093. isImmediatePropagationStopped: returnFalse,
  13094. isSimulated: false,
  13095. preventDefault: function() {
  13096. var e = this.originalEvent;
  13097. this.isDefaultPrevented = returnTrue;
  13098. if ( e && !this.isSimulated ) {
  13099. e.preventDefault();
  13100. }
  13101. },
  13102. stopPropagation: function() {
  13103. var e = this.originalEvent;
  13104. this.isPropagationStopped = returnTrue;
  13105. if ( e && !this.isSimulated ) {
  13106. e.stopPropagation();
  13107. }
  13108. },
  13109. stopImmediatePropagation: function() {
  13110. var e = this.originalEvent;
  13111. this.isImmediatePropagationStopped = returnTrue;
  13112. if ( e && !this.isSimulated ) {
  13113. e.stopImmediatePropagation();
  13114. }
  13115. this.stopPropagation();
  13116. }
  13117. };
  13118. // Includes all common event props including KeyEvent and MouseEvent specific props
  13119. jQuery.each( {
  13120. altKey: true,
  13121. bubbles: true,
  13122. cancelable: true,
  13123. changedTouches: true,
  13124. ctrlKey: true,
  13125. detail: true,
  13126. eventPhase: true,
  13127. metaKey: true,
  13128. pageX: true,
  13129. pageY: true,
  13130. shiftKey: true,
  13131. view: true,
  13132. "char": true,
  13133. code: true,
  13134. charCode: true,
  13135. key: true,
  13136. keyCode: true,
  13137. button: true,
  13138. buttons: true,
  13139. clientX: true,
  13140. clientY: true,
  13141. offsetX: true,
  13142. offsetY: true,
  13143. pointerId: true,
  13144. pointerType: true,
  13145. screenX: true,
  13146. screenY: true,
  13147. targetTouches: true,
  13148. toElement: true,
  13149. touches: true,
  13150. which: function( event ) {
  13151. var button = event.button;
  13152. // Add which for key events
  13153. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13154. return event.charCode != null ? event.charCode : event.keyCode;
  13155. }
  13156. // Add which for click: 1 === left; 2 === middle; 3 === right
  13157. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13158. if ( button & 1 ) {
  13159. return 1;
  13160. }
  13161. if ( button & 2 ) {
  13162. return 3;
  13163. }
  13164. if ( button & 4 ) {
  13165. return 2;
  13166. }
  13167. return 0;
  13168. }
  13169. return event.which;
  13170. }
  13171. }, jQuery.event.addProp );
  13172. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13173. jQuery.event.special[ type ] = {
  13174. // Utilize native event if possible so blur/focus sequence is correct
  13175. setup: function() {
  13176. // Claim the first handler
  13177. // dataPriv.set( this, "focus", ... )
  13178. // dataPriv.set( this, "blur", ... )
  13179. leverageNative( this, type, expectSync );
  13180. // Return false to allow normal processing in the caller
  13181. return false;
  13182. },
  13183. trigger: function() {
  13184. // Force setup before trigger
  13185. leverageNative( this, type );
  13186. // Return non-false to allow normal event-path propagation
  13187. return true;
  13188. },
  13189. delegateType: delegateType
  13190. };
  13191. } );
  13192. // Create mouseenter/leave events using mouseover/out and event-time checks
  13193. // so that event delegation works in jQuery.
  13194. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13195. //
  13196. // Support: Safari 7 only
  13197. // Safari sends mouseenter too often; see:
  13198. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13199. // for the description of the bug (it existed in older Chrome versions as well).
  13200. jQuery.each( {
  13201. mouseenter: "mouseover",
  13202. mouseleave: "mouseout",
  13203. pointerenter: "pointerover",
  13204. pointerleave: "pointerout"
  13205. }, function( orig, fix ) {
  13206. jQuery.event.special[ orig ] = {
  13207. delegateType: fix,
  13208. bindType: fix,
  13209. handle: function( event ) {
  13210. var ret,
  13211. target = this,
  13212. related = event.relatedTarget,
  13213. handleObj = event.handleObj;
  13214. // For mouseenter/leave call the handler if related is outside the target.
  13215. // NB: No relatedTarget if the mouse left/entered the browser window
  13216. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13217. event.type = handleObj.origType;
  13218. ret = handleObj.handler.apply( this, arguments );
  13219. event.type = fix;
  13220. }
  13221. return ret;
  13222. }
  13223. };
  13224. } );
  13225. jQuery.fn.extend( {
  13226. on: function( types, selector, data, fn ) {
  13227. return on( this, types, selector, data, fn );
  13228. },
  13229. one: function( types, selector, data, fn ) {
  13230. return on( this, types, selector, data, fn, 1 );
  13231. },
  13232. off: function( types, selector, fn ) {
  13233. var handleObj, type;
  13234. if ( types && types.preventDefault && types.handleObj ) {
  13235. // ( event ) dispatched jQuery.Event
  13236. handleObj = types.handleObj;
  13237. jQuery( types.delegateTarget ).off(
  13238. handleObj.namespace ?
  13239. handleObj.origType + "." + handleObj.namespace :
  13240. handleObj.origType,
  13241. handleObj.selector,
  13242. handleObj.handler
  13243. );
  13244. return this;
  13245. }
  13246. if ( typeof types === "object" ) {
  13247. // ( types-object [, selector] )
  13248. for ( type in types ) {
  13249. this.off( type, selector, types[ type ] );
  13250. }
  13251. return this;
  13252. }
  13253. if ( selector === false || typeof selector === "function" ) {
  13254. // ( types [, fn] )
  13255. fn = selector;
  13256. selector = undefined;
  13257. }
  13258. if ( fn === false ) {
  13259. fn = returnFalse;
  13260. }
  13261. return this.each( function() {
  13262. jQuery.event.remove( this, types, fn, selector );
  13263. } );
  13264. }
  13265. } );
  13266. var
  13267. /* eslint-disable max-len */
  13268. // See https://github.com/eslint/eslint/issues/3229
  13269. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13270. /* eslint-enable */
  13271. // Support: IE <=10 - 11, Edge 12 - 13 only
  13272. // In IE/Edge using regex groups here causes severe slowdowns.
  13273. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13274. rnoInnerhtml = /<script|<style|<link/i,
  13275. // checked="checked" or checked
  13276. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13277. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13278. // Prefer a tbody over its parent table for containing new rows
  13279. function manipulationTarget( elem, content ) {
  13280. if ( nodeName( elem, "table" ) &&
  13281. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13282. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13283. }
  13284. return elem;
  13285. }
  13286. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13287. function disableScript( elem ) {
  13288. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13289. return elem;
  13290. }
  13291. function restoreScript( elem ) {
  13292. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13293. elem.type = elem.type.slice( 5 );
  13294. } else {
  13295. elem.removeAttribute( "type" );
  13296. }
  13297. return elem;
  13298. }
  13299. function cloneCopyEvent( src, dest ) {
  13300. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13301. if ( dest.nodeType !== 1 ) {
  13302. return;
  13303. }
  13304. // 1. Copy private data: events, handlers, etc.
  13305. if ( dataPriv.hasData( src ) ) {
  13306. pdataOld = dataPriv.access( src );
  13307. pdataCur = dataPriv.set( dest, pdataOld );
  13308. events = pdataOld.events;
  13309. if ( events ) {
  13310. delete pdataCur.handle;
  13311. pdataCur.events = {};
  13312. for ( type in events ) {
  13313. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13314. jQuery.event.add( dest, type, events[ type ][ i ] );
  13315. }
  13316. }
  13317. }
  13318. }
  13319. // 2. Copy user data
  13320. if ( dataUser.hasData( src ) ) {
  13321. udataOld = dataUser.access( src );
  13322. udataCur = jQuery.extend( {}, udataOld );
  13323. dataUser.set( dest, udataCur );
  13324. }
  13325. }
  13326. // Fix IE bugs, see support tests
  13327. function fixInput( src, dest ) {
  13328. var nodeName = dest.nodeName.toLowerCase();
  13329. // Fails to persist the checked state of a cloned checkbox or radio button.
  13330. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13331. dest.checked = src.checked;
  13332. // Fails to return the selected option to the default selected state when cloning options
  13333. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13334. dest.defaultValue = src.defaultValue;
  13335. }
  13336. }
  13337. function domManip( collection, args, callback, ignored ) {
  13338. // Flatten any nested arrays
  13339. args = concat.apply( [], args );
  13340. var fragment, first, scripts, hasScripts, node, doc,
  13341. i = 0,
  13342. l = collection.length,
  13343. iNoClone = l - 1,
  13344. value = args[ 0 ],
  13345. valueIsFunction = isFunction( value );
  13346. // We can't cloneNode fragments that contain checked, in WebKit
  13347. if ( valueIsFunction ||
  13348. ( l > 1 && typeof value === "string" &&
  13349. !support.checkClone && rchecked.test( value ) ) ) {
  13350. return collection.each( function( index ) {
  13351. var self = collection.eq( index );
  13352. if ( valueIsFunction ) {
  13353. args[ 0 ] = value.call( this, index, self.html() );
  13354. }
  13355. domManip( self, args, callback, ignored );
  13356. } );
  13357. }
  13358. if ( l ) {
  13359. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13360. first = fragment.firstChild;
  13361. if ( fragment.childNodes.length === 1 ) {
  13362. fragment = first;
  13363. }
  13364. // Require either new content or an interest in ignored elements to invoke the callback
  13365. if ( first || ignored ) {
  13366. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13367. hasScripts = scripts.length;
  13368. // Use the original fragment for the last item
  13369. // instead of the first because it can end up
  13370. // being emptied incorrectly in certain situations (#8070).
  13371. for ( ; i < l; i++ ) {
  13372. node = fragment;
  13373. if ( i !== iNoClone ) {
  13374. node = jQuery.clone( node, true, true );
  13375. // Keep references to cloned scripts for later restoration
  13376. if ( hasScripts ) {
  13377. // Support: Android <=4.0 only, PhantomJS 1 only
  13378. // push.apply(_, arraylike) throws on ancient WebKit
  13379. jQuery.merge( scripts, getAll( node, "script" ) );
  13380. }
  13381. }
  13382. callback.call( collection[ i ], node, i );
  13383. }
  13384. if ( hasScripts ) {
  13385. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13386. // Reenable scripts
  13387. jQuery.map( scripts, restoreScript );
  13388. // Evaluate executable scripts on first document insertion
  13389. for ( i = 0; i < hasScripts; i++ ) {
  13390. node = scripts[ i ];
  13391. if ( rscriptType.test( node.type || "" ) &&
  13392. !dataPriv.access( node, "globalEval" ) &&
  13393. jQuery.contains( doc, node ) ) {
  13394. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13395. // Optional AJAX dependency, but won't run scripts if not present
  13396. if ( jQuery._evalUrl && !node.noModule ) {
  13397. jQuery._evalUrl( node.src, {
  13398. nonce: node.nonce || node.getAttribute( "nonce" )
  13399. } );
  13400. }
  13401. } else {
  13402. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13403. }
  13404. }
  13405. }
  13406. }
  13407. }
  13408. }
  13409. return collection;
  13410. }
  13411. function remove( elem, selector, keepData ) {
  13412. var node,
  13413. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13414. i = 0;
  13415. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13416. if ( !keepData && node.nodeType === 1 ) {
  13417. jQuery.cleanData( getAll( node ) );
  13418. }
  13419. if ( node.parentNode ) {
  13420. if ( keepData && isAttached( node ) ) {
  13421. setGlobalEval( getAll( node, "script" ) );
  13422. }
  13423. node.parentNode.removeChild( node );
  13424. }
  13425. }
  13426. return elem;
  13427. }
  13428. jQuery.extend( {
  13429. htmlPrefilter: function( html ) {
  13430. return html.replace( rxhtmlTag, "<$1></$2>" );
  13431. },
  13432. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13433. var i, l, srcElements, destElements,
  13434. clone = elem.cloneNode( true ),
  13435. inPage = isAttached( elem );
  13436. // Fix IE cloning issues
  13437. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13438. !jQuery.isXMLDoc( elem ) ) {
  13439. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13440. destElements = getAll( clone );
  13441. srcElements = getAll( elem );
  13442. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13443. fixInput( srcElements[ i ], destElements[ i ] );
  13444. }
  13445. }
  13446. // Copy the events from the original to the clone
  13447. if ( dataAndEvents ) {
  13448. if ( deepDataAndEvents ) {
  13449. srcElements = srcElements || getAll( elem );
  13450. destElements = destElements || getAll( clone );
  13451. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13452. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13453. }
  13454. } else {
  13455. cloneCopyEvent( elem, clone );
  13456. }
  13457. }
  13458. // Preserve script evaluation history
  13459. destElements = getAll( clone, "script" );
  13460. if ( destElements.length > 0 ) {
  13461. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13462. }
  13463. // Return the cloned set
  13464. return clone;
  13465. },
  13466. cleanData: function( elems ) {
  13467. var data, elem, type,
  13468. special = jQuery.event.special,
  13469. i = 0;
  13470. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13471. if ( acceptData( elem ) ) {
  13472. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13473. if ( data.events ) {
  13474. for ( type in data.events ) {
  13475. if ( special[ type ] ) {
  13476. jQuery.event.remove( elem, type );
  13477. // This is a shortcut to avoid jQuery.event.remove's overhead
  13478. } else {
  13479. jQuery.removeEvent( elem, type, data.handle );
  13480. }
  13481. }
  13482. }
  13483. // Support: Chrome <=35 - 45+
  13484. // Assign undefined instead of using delete, see Data#remove
  13485. elem[ dataPriv.expando ] = undefined;
  13486. }
  13487. if ( elem[ dataUser.expando ] ) {
  13488. // Support: Chrome <=35 - 45+
  13489. // Assign undefined instead of using delete, see Data#remove
  13490. elem[ dataUser.expando ] = undefined;
  13491. }
  13492. }
  13493. }
  13494. }
  13495. } );
  13496. jQuery.fn.extend( {
  13497. detach: function( selector ) {
  13498. return remove( this, selector, true );
  13499. },
  13500. remove: function( selector ) {
  13501. return remove( this, selector );
  13502. },
  13503. text: function( value ) {
  13504. return access( this, function( value ) {
  13505. return value === undefined ?
  13506. jQuery.text( this ) :
  13507. this.empty().each( function() {
  13508. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13509. this.textContent = value;
  13510. }
  13511. } );
  13512. }, null, value, arguments.length );
  13513. },
  13514. append: function() {
  13515. return domManip( this, arguments, function( elem ) {
  13516. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13517. var target = manipulationTarget( this, elem );
  13518. target.appendChild( elem );
  13519. }
  13520. } );
  13521. },
  13522. prepend: function() {
  13523. return domManip( this, arguments, function( elem ) {
  13524. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13525. var target = manipulationTarget( this, elem );
  13526. target.insertBefore( elem, target.firstChild );
  13527. }
  13528. } );
  13529. },
  13530. before: function() {
  13531. return domManip( this, arguments, function( elem ) {
  13532. if ( this.parentNode ) {
  13533. this.parentNode.insertBefore( elem, this );
  13534. }
  13535. } );
  13536. },
  13537. after: function() {
  13538. return domManip( this, arguments, function( elem ) {
  13539. if ( this.parentNode ) {
  13540. this.parentNode.insertBefore( elem, this.nextSibling );
  13541. }
  13542. } );
  13543. },
  13544. empty: function() {
  13545. var elem,
  13546. i = 0;
  13547. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13548. if ( elem.nodeType === 1 ) {
  13549. // Prevent memory leaks
  13550. jQuery.cleanData( getAll( elem, false ) );
  13551. // Remove any remaining nodes
  13552. elem.textContent = "";
  13553. }
  13554. }
  13555. return this;
  13556. },
  13557. clone: function( dataAndEvents, deepDataAndEvents ) {
  13558. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13559. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13560. return this.map( function() {
  13561. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13562. } );
  13563. },
  13564. html: function( value ) {
  13565. return access( this, function( value ) {
  13566. var elem = this[ 0 ] || {},
  13567. i = 0,
  13568. l = this.length;
  13569. if ( value === undefined && elem.nodeType === 1 ) {
  13570. return elem.innerHTML;
  13571. }
  13572. // See if we can take a shortcut and just use innerHTML
  13573. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13574. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13575. value = jQuery.htmlPrefilter( value );
  13576. try {
  13577. for ( ; i < l; i++ ) {
  13578. elem = this[ i ] || {};
  13579. // Remove element nodes and prevent memory leaks
  13580. if ( elem.nodeType === 1 ) {
  13581. jQuery.cleanData( getAll( elem, false ) );
  13582. elem.innerHTML = value;
  13583. }
  13584. }
  13585. elem = 0;
  13586. // If using innerHTML throws an exception, use the fallback method
  13587. } catch ( e ) {}
  13588. }
  13589. if ( elem ) {
  13590. this.empty().append( value );
  13591. }
  13592. }, null, value, arguments.length );
  13593. },
  13594. replaceWith: function() {
  13595. var ignored = [];
  13596. // Make the changes, replacing each non-ignored context element with the new content
  13597. return domManip( this, arguments, function( elem ) {
  13598. var parent = this.parentNode;
  13599. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13600. jQuery.cleanData( getAll( this ) );
  13601. if ( parent ) {
  13602. parent.replaceChild( elem, this );
  13603. }
  13604. }
  13605. // Force callback invocation
  13606. }, ignored );
  13607. }
  13608. } );
  13609. jQuery.each( {
  13610. appendTo: "append",
  13611. prependTo: "prepend",
  13612. insertBefore: "before",
  13613. insertAfter: "after",
  13614. replaceAll: "replaceWith"
  13615. }, function( name, original ) {
  13616. jQuery.fn[ name ] = function( selector ) {
  13617. var elems,
  13618. ret = [],
  13619. insert = jQuery( selector ),
  13620. last = insert.length - 1,
  13621. i = 0;
  13622. for ( ; i <= last; i++ ) {
  13623. elems = i === last ? this : this.clone( true );
  13624. jQuery( insert[ i ] )[ original ]( elems );
  13625. // Support: Android <=4.0 only, PhantomJS 1 only
  13626. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13627. push.apply( ret, elems.get() );
  13628. }
  13629. return this.pushStack( ret );
  13630. };
  13631. } );
  13632. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13633. var getStyles = function( elem ) {
  13634. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13635. // IE throws on elements created in popups
  13636. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13637. var view = elem.ownerDocument.defaultView;
  13638. if ( !view || !view.opener ) {
  13639. view = window;
  13640. }
  13641. return view.getComputedStyle( elem );
  13642. };
  13643. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13644. ( function() {
  13645. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13646. // so they're executed at the same time to save the second computation.
  13647. function computeStyleTests() {
  13648. // This is a singleton, we need to execute it only once
  13649. if ( !div ) {
  13650. return;
  13651. }
  13652. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13653. "margin-top:1px;padding:0;border:0";
  13654. div.style.cssText =
  13655. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13656. "margin:auto;border:1px;padding:1px;" +
  13657. "width:60%;top:1%";
  13658. documentElement.appendChild( container ).appendChild( div );
  13659. var divStyle = window.getComputedStyle( div );
  13660. pixelPositionVal = divStyle.top !== "1%";
  13661. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13662. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13663. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13664. // Some styles come back with percentage values, even though they shouldn't
  13665. div.style.right = "60%";
  13666. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13667. // Support: IE 9 - 11 only
  13668. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13669. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13670. // Support: IE 9 only
  13671. // Detect overflow:scroll screwiness (gh-3699)
  13672. // Support: Chrome <=64
  13673. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13674. div.style.position = "absolute";
  13675. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13676. documentElement.removeChild( container );
  13677. // Nullify the div so it wouldn't be stored in the memory and
  13678. // it will also be a sign that checks already performed
  13679. div = null;
  13680. }
  13681. function roundPixelMeasures( measure ) {
  13682. return Math.round( parseFloat( measure ) );
  13683. }
  13684. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13685. reliableMarginLeftVal,
  13686. container = document.createElement( "div" ),
  13687. div = document.createElement( "div" );
  13688. // Finish early in limited (non-browser) environments
  13689. if ( !div.style ) {
  13690. return;
  13691. }
  13692. // Support: IE <=9 - 11 only
  13693. // Style of cloned element affects source element cloned (#8908)
  13694. div.style.backgroundClip = "content-box";
  13695. div.cloneNode( true ).style.backgroundClip = "";
  13696. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13697. jQuery.extend( support, {
  13698. boxSizingReliable: function() {
  13699. computeStyleTests();
  13700. return boxSizingReliableVal;
  13701. },
  13702. pixelBoxStyles: function() {
  13703. computeStyleTests();
  13704. return pixelBoxStylesVal;
  13705. },
  13706. pixelPosition: function() {
  13707. computeStyleTests();
  13708. return pixelPositionVal;
  13709. },
  13710. reliableMarginLeft: function() {
  13711. computeStyleTests();
  13712. return reliableMarginLeftVal;
  13713. },
  13714. scrollboxSize: function() {
  13715. computeStyleTests();
  13716. return scrollboxSizeVal;
  13717. }
  13718. } );
  13719. } )();
  13720. function curCSS( elem, name, computed ) {
  13721. var width, minWidth, maxWidth, ret,
  13722. // Support: Firefox 51+
  13723. // Retrieving style before computed somehow
  13724. // fixes an issue with getting wrong values
  13725. // on detached elements
  13726. style = elem.style;
  13727. computed = computed || getStyles( elem );
  13728. // getPropertyValue is needed for:
  13729. // .css('filter') (IE 9 only, #12537)
  13730. // .css('--customProperty) (#3144)
  13731. if ( computed ) {
  13732. ret = computed.getPropertyValue( name ) || computed[ name ];
  13733. if ( ret === "" && !isAttached( elem ) ) {
  13734. ret = jQuery.style( elem, name );
  13735. }
  13736. // A tribute to the "awesome hack by Dean Edwards"
  13737. // Android Browser returns percentage for some values,
  13738. // but width seems to be reliably pixels.
  13739. // This is against the CSSOM draft spec:
  13740. // https://drafts.csswg.org/cssom/#resolved-values
  13741. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13742. // Remember the original values
  13743. width = style.width;
  13744. minWidth = style.minWidth;
  13745. maxWidth = style.maxWidth;
  13746. // Put in the new values to get a computed value out
  13747. style.minWidth = style.maxWidth = style.width = ret;
  13748. ret = computed.width;
  13749. // Revert the changed values
  13750. style.width = width;
  13751. style.minWidth = minWidth;
  13752. style.maxWidth = maxWidth;
  13753. }
  13754. }
  13755. return ret !== undefined ?
  13756. // Support: IE <=9 - 11 only
  13757. // IE returns zIndex value as an integer.
  13758. ret + "" :
  13759. ret;
  13760. }
  13761. function addGetHookIf( conditionFn, hookFn ) {
  13762. // Define the hook, we'll check on the first run if it's really needed.
  13763. return {
  13764. get: function() {
  13765. if ( conditionFn() ) {
  13766. // Hook not needed (or it's not possible to use it due
  13767. // to missing dependency), remove it.
  13768. delete this.get;
  13769. return;
  13770. }
  13771. // Hook needed; redefine it so that the support test is not executed again.
  13772. return ( this.get = hookFn ).apply( this, arguments );
  13773. }
  13774. };
  13775. }
  13776. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13777. emptyStyle = document.createElement( "div" ).style,
  13778. vendorProps = {};
  13779. // Return a vendor-prefixed property or undefined
  13780. function vendorPropName( name ) {
  13781. // Check for vendor prefixed names
  13782. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13783. i = cssPrefixes.length;
  13784. while ( i-- ) {
  13785. name = cssPrefixes[ i ] + capName;
  13786. if ( name in emptyStyle ) {
  13787. return name;
  13788. }
  13789. }
  13790. }
  13791. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13792. function finalPropName( name ) {
  13793. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13794. if ( final ) {
  13795. return final;
  13796. }
  13797. if ( name in emptyStyle ) {
  13798. return name;
  13799. }
  13800. return vendorProps[ name ] = vendorPropName( name ) || name;
  13801. }
  13802. var
  13803. // Swappable if display is none or starts with table
  13804. // except "table", "table-cell", or "table-caption"
  13805. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13806. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13807. rcustomProp = /^--/,
  13808. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13809. cssNormalTransform = {
  13810. letterSpacing: "0",
  13811. fontWeight: "400"
  13812. };
  13813. function setPositiveNumber( elem, value, subtract ) {
  13814. // Any relative (+/-) values have already been
  13815. // normalized at this point
  13816. var matches = rcssNum.exec( value );
  13817. return matches ?
  13818. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13819. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13820. value;
  13821. }
  13822. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13823. var i = dimension === "width" ? 1 : 0,
  13824. extra = 0,
  13825. delta = 0;
  13826. // Adjustment may not be necessary
  13827. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13828. return 0;
  13829. }
  13830. for ( ; i < 4; i += 2 ) {
  13831. // Both box models exclude margin
  13832. if ( box === "margin" ) {
  13833. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13834. }
  13835. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13836. if ( !isBorderBox ) {
  13837. // Add padding
  13838. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13839. // For "border" or "margin", add border
  13840. if ( box !== "padding" ) {
  13841. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13842. // But still keep track of it otherwise
  13843. } else {
  13844. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13845. }
  13846. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13847. // "padding" or "margin"
  13848. } else {
  13849. // For "content", subtract padding
  13850. if ( box === "content" ) {
  13851. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13852. }
  13853. // For "content" or "padding", subtract border
  13854. if ( box !== "margin" ) {
  13855. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13856. }
  13857. }
  13858. }
  13859. // Account for positive content-box scroll gutter when requested by providing computedVal
  13860. if ( !isBorderBox && computedVal >= 0 ) {
  13861. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13862. // Assuming integer scroll gutter, subtract the rest and round down
  13863. delta += Math.max( 0, Math.ceil(
  13864. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13865. computedVal -
  13866. delta -
  13867. extra -
  13868. 0.5
  13869. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13870. // Use an explicit zero to avoid NaN (gh-3964)
  13871. ) ) || 0;
  13872. }
  13873. return delta;
  13874. }
  13875. function getWidthOrHeight( elem, dimension, extra ) {
  13876. // Start with computed style
  13877. var styles = getStyles( elem ),
  13878. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13879. // Fake content-box until we know it's needed to know the true value.
  13880. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13881. isBorderBox = boxSizingNeeded &&
  13882. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13883. valueIsBorderBox = isBorderBox,
  13884. val = curCSS( elem, dimension, styles ),
  13885. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13886. // Support: Firefox <=54
  13887. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13888. if ( rnumnonpx.test( val ) ) {
  13889. if ( !extra ) {
  13890. return val;
  13891. }
  13892. val = "auto";
  13893. }
  13894. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13895. // This happens for inline elements with no explicit setting (gh-3571)
  13896. // Support: Android <=4.1 - 4.3 only
  13897. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13898. // Support: IE 9-11 only
  13899. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13900. // We use getClientRects() to check for hidden/disconnected.
  13901. // In those cases, the computed value can be trusted to be border-box
  13902. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13903. val === "auto" ||
  13904. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13905. elem.getClientRects().length ) {
  13906. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13907. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13908. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13909. // retrieved value as a content box dimension.
  13910. valueIsBorderBox = offsetProp in elem;
  13911. if ( valueIsBorderBox ) {
  13912. val = elem[ offsetProp ];
  13913. }
  13914. }
  13915. // Normalize "" and auto
  13916. val = parseFloat( val ) || 0;
  13917. // Adjust for the element's box model
  13918. return ( val +
  13919. boxModelAdjustment(
  13920. elem,
  13921. dimension,
  13922. extra || ( isBorderBox ? "border" : "content" ),
  13923. valueIsBorderBox,
  13924. styles,
  13925. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13926. val
  13927. )
  13928. ) + "px";
  13929. }
  13930. jQuery.extend( {
  13931. // Add in style property hooks for overriding the default
  13932. // behavior of getting and setting a style property
  13933. cssHooks: {
  13934. opacity: {
  13935. get: function( elem, computed ) {
  13936. if ( computed ) {
  13937. // We should always get a number back from opacity
  13938. var ret = curCSS( elem, "opacity" );
  13939. return ret === "" ? "1" : ret;
  13940. }
  13941. }
  13942. }
  13943. },
  13944. // Don't automatically add "px" to these possibly-unitless properties
  13945. cssNumber: {
  13946. "animationIterationCount": true,
  13947. "columnCount": true,
  13948. "fillOpacity": true,
  13949. "flexGrow": true,
  13950. "flexShrink": true,
  13951. "fontWeight": true,
  13952. "gridArea": true,
  13953. "gridColumn": true,
  13954. "gridColumnEnd": true,
  13955. "gridColumnStart": true,
  13956. "gridRow": true,
  13957. "gridRowEnd": true,
  13958. "gridRowStart": true,
  13959. "lineHeight": true,
  13960. "opacity": true,
  13961. "order": true,
  13962. "orphans": true,
  13963. "widows": true,
  13964. "zIndex": true,
  13965. "zoom": true
  13966. },
  13967. // Add in properties whose names you wish to fix before
  13968. // setting or getting the value
  13969. cssProps: {},
  13970. // Get and set the style property on a DOM Node
  13971. style: function( elem, name, value, extra ) {
  13972. // Don't set styles on text and comment nodes
  13973. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13974. return;
  13975. }
  13976. // Make sure that we're working with the right name
  13977. var ret, type, hooks,
  13978. origName = camelCase( name ),
  13979. isCustomProp = rcustomProp.test( name ),
  13980. style = elem.style;
  13981. // Make sure that we're working with the right name. We don't
  13982. // want to query the value if it is a CSS custom property
  13983. // since they are user-defined.
  13984. if ( !isCustomProp ) {
  13985. name = finalPropName( origName );
  13986. }
  13987. // Gets hook for the prefixed version, then unprefixed version
  13988. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13989. // Check if we're setting a value
  13990. if ( value !== undefined ) {
  13991. type = typeof value;
  13992. // Convert "+=" or "-=" to relative numbers (#7345)
  13993. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13994. value = adjustCSS( elem, name, ret );
  13995. // Fixes bug #9237
  13996. type = "number";
  13997. }
  13998. // Make sure that null and NaN values aren't set (#7116)
  13999. if ( value == null || value !== value ) {
  14000. return;
  14001. }
  14002. // If a number was passed in, add the unit (except for certain CSS properties)
  14003. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14004. // "px" to a few hardcoded values.
  14005. if ( type === "number" && !isCustomProp ) {
  14006. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14007. }
  14008. // background-* props affect original clone's values
  14009. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14010. style[ name ] = "inherit";
  14011. }
  14012. // If a hook was provided, use that value, otherwise just set the specified value
  14013. if ( !hooks || !( "set" in hooks ) ||
  14014. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14015. if ( isCustomProp ) {
  14016. style.setProperty( name, value );
  14017. } else {
  14018. style[ name ] = value;
  14019. }
  14020. }
  14021. } else {
  14022. // If a hook was provided get the non-computed value from there
  14023. if ( hooks && "get" in hooks &&
  14024. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14025. return ret;
  14026. }
  14027. // Otherwise just get the value from the style object
  14028. return style[ name ];
  14029. }
  14030. },
  14031. css: function( elem, name, extra, styles ) {
  14032. var val, num, hooks,
  14033. origName = camelCase( name ),
  14034. isCustomProp = rcustomProp.test( name );
  14035. // Make sure that we're working with the right name. We don't
  14036. // want to modify the value if it is a CSS custom property
  14037. // since they are user-defined.
  14038. if ( !isCustomProp ) {
  14039. name = finalPropName( origName );
  14040. }
  14041. // Try prefixed name followed by the unprefixed name
  14042. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14043. // If a hook was provided get the computed value from there
  14044. if ( hooks && "get" in hooks ) {
  14045. val = hooks.get( elem, true, extra );
  14046. }
  14047. // Otherwise, if a way to get the computed value exists, use that
  14048. if ( val === undefined ) {
  14049. val = curCSS( elem, name, styles );
  14050. }
  14051. // Convert "normal" to computed value
  14052. if ( val === "normal" && name in cssNormalTransform ) {
  14053. val = cssNormalTransform[ name ];
  14054. }
  14055. // Make numeric if forced or a qualifier was provided and val looks numeric
  14056. if ( extra === "" || extra ) {
  14057. num = parseFloat( val );
  14058. return extra === true || isFinite( num ) ? num || 0 : val;
  14059. }
  14060. return val;
  14061. }
  14062. } );
  14063. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14064. jQuery.cssHooks[ dimension ] = {
  14065. get: function( elem, computed, extra ) {
  14066. if ( computed ) {
  14067. // Certain elements can have dimension info if we invisibly show them
  14068. // but it must have a current display style that would benefit
  14069. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14070. // Support: Safari 8+
  14071. // Table columns in Safari have non-zero offsetWidth & zero
  14072. // getBoundingClientRect().width unless display is changed.
  14073. // Support: IE <=11 only
  14074. // Running getBoundingClientRect on a disconnected node
  14075. // in IE throws an error.
  14076. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14077. swap( elem, cssShow, function() {
  14078. return getWidthOrHeight( elem, dimension, extra );
  14079. } ) :
  14080. getWidthOrHeight( elem, dimension, extra );
  14081. }
  14082. },
  14083. set: function( elem, value, extra ) {
  14084. var matches,
  14085. styles = getStyles( elem ),
  14086. // Only read styles.position if the test has a chance to fail
  14087. // to avoid forcing a reflow.
  14088. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14089. styles.position === "absolute",
  14090. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14091. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14092. isBorderBox = boxSizingNeeded &&
  14093. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14094. subtract = extra ?
  14095. boxModelAdjustment(
  14096. elem,
  14097. dimension,
  14098. extra,
  14099. isBorderBox,
  14100. styles
  14101. ) :
  14102. 0;
  14103. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14104. // faking a content-box to get border and padding (gh-3699)
  14105. if ( isBorderBox && scrollboxSizeBuggy ) {
  14106. subtract -= Math.ceil(
  14107. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14108. parseFloat( styles[ dimension ] ) -
  14109. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14110. 0.5
  14111. );
  14112. }
  14113. // Convert to pixels if value adjustment is needed
  14114. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14115. ( matches[ 3 ] || "px" ) !== "px" ) {
  14116. elem.style[ dimension ] = value;
  14117. value = jQuery.css( elem, dimension );
  14118. }
  14119. return setPositiveNumber( elem, value, subtract );
  14120. }
  14121. };
  14122. } );
  14123. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14124. function( elem, computed ) {
  14125. if ( computed ) {
  14126. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14127. elem.getBoundingClientRect().left -
  14128. swap( elem, { marginLeft: 0 }, function() {
  14129. return elem.getBoundingClientRect().left;
  14130. } )
  14131. ) + "px";
  14132. }
  14133. }
  14134. );
  14135. // These hooks are used by animate to expand properties
  14136. jQuery.each( {
  14137. margin: "",
  14138. padding: "",
  14139. border: "Width"
  14140. }, function( prefix, suffix ) {
  14141. jQuery.cssHooks[ prefix + suffix ] = {
  14142. expand: function( value ) {
  14143. var i = 0,
  14144. expanded = {},
  14145. // Assumes a single number if not a string
  14146. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14147. for ( ; i < 4; i++ ) {
  14148. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14149. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14150. }
  14151. return expanded;
  14152. }
  14153. };
  14154. if ( prefix !== "margin" ) {
  14155. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14156. }
  14157. } );
  14158. jQuery.fn.extend( {
  14159. css: function( name, value ) {
  14160. return access( this, function( elem, name, value ) {
  14161. var styles, len,
  14162. map = {},
  14163. i = 0;
  14164. if ( Array.isArray( name ) ) {
  14165. styles = getStyles( elem );
  14166. len = name.length;
  14167. for ( ; i < len; i++ ) {
  14168. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14169. }
  14170. return map;
  14171. }
  14172. return value !== undefined ?
  14173. jQuery.style( elem, name, value ) :
  14174. jQuery.css( elem, name );
  14175. }, name, value, arguments.length > 1 );
  14176. }
  14177. } );
  14178. function Tween( elem, options, prop, end, easing ) {
  14179. return new Tween.prototype.init( elem, options, prop, end, easing );
  14180. }
  14181. jQuery.Tween = Tween;
  14182. Tween.prototype = {
  14183. constructor: Tween,
  14184. init: function( elem, options, prop, end, easing, unit ) {
  14185. this.elem = elem;
  14186. this.prop = prop;
  14187. this.easing = easing || jQuery.easing._default;
  14188. this.options = options;
  14189. this.start = this.now = this.cur();
  14190. this.end = end;
  14191. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14192. },
  14193. cur: function() {
  14194. var hooks = Tween.propHooks[ this.prop ];
  14195. return hooks && hooks.get ?
  14196. hooks.get( this ) :
  14197. Tween.propHooks._default.get( this );
  14198. },
  14199. run: function( percent ) {
  14200. var eased,
  14201. hooks = Tween.propHooks[ this.prop ];
  14202. if ( this.options.duration ) {
  14203. this.pos = eased = jQuery.easing[ this.easing ](
  14204. percent, this.options.duration * percent, 0, 1, this.options.duration
  14205. );
  14206. } else {
  14207. this.pos = eased = percent;
  14208. }
  14209. this.now = ( this.end - this.start ) * eased + this.start;
  14210. if ( this.options.step ) {
  14211. this.options.step.call( this.elem, this.now, this );
  14212. }
  14213. if ( hooks && hooks.set ) {
  14214. hooks.set( this );
  14215. } else {
  14216. Tween.propHooks._default.set( this );
  14217. }
  14218. return this;
  14219. }
  14220. };
  14221. Tween.prototype.init.prototype = Tween.prototype;
  14222. Tween.propHooks = {
  14223. _default: {
  14224. get: function( tween ) {
  14225. var result;
  14226. // Use a property on the element directly when it is not a DOM element,
  14227. // or when there is no matching style property that exists.
  14228. if ( tween.elem.nodeType !== 1 ||
  14229. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14230. return tween.elem[ tween.prop ];
  14231. }
  14232. // Passing an empty string as a 3rd parameter to .css will automatically
  14233. // attempt a parseFloat and fallback to a string if the parse fails.
  14234. // Simple values such as "10px" are parsed to Float;
  14235. // complex values such as "rotate(1rad)" are returned as-is.
  14236. result = jQuery.css( tween.elem, tween.prop, "" );
  14237. // Empty strings, null, undefined and "auto" are converted to 0.
  14238. return !result || result === "auto" ? 0 : result;
  14239. },
  14240. set: function( tween ) {
  14241. // Use step hook for back compat.
  14242. // Use cssHook if its there.
  14243. // Use .style if available and use plain properties where available.
  14244. if ( jQuery.fx.step[ tween.prop ] ) {
  14245. jQuery.fx.step[ tween.prop ]( tween );
  14246. } else if ( tween.elem.nodeType === 1 && (
  14247. jQuery.cssHooks[ tween.prop ] ||
  14248. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14249. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14250. } else {
  14251. tween.elem[ tween.prop ] = tween.now;
  14252. }
  14253. }
  14254. }
  14255. };
  14256. // Support: IE <=9 only
  14257. // Panic based approach to setting things on disconnected nodes
  14258. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14259. set: function( tween ) {
  14260. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14261. tween.elem[ tween.prop ] = tween.now;
  14262. }
  14263. }
  14264. };
  14265. jQuery.easing = {
  14266. linear: function( p ) {
  14267. return p;
  14268. },
  14269. swing: function( p ) {
  14270. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14271. },
  14272. _default: "swing"
  14273. };
  14274. jQuery.fx = Tween.prototype.init;
  14275. // Back compat <1.8 extension point
  14276. jQuery.fx.step = {};
  14277. var
  14278. fxNow, inProgress,
  14279. rfxtypes = /^(?:toggle|show|hide)$/,
  14280. rrun = /queueHooks$/;
  14281. function schedule() {
  14282. if ( inProgress ) {
  14283. if ( document.hidden === false && window.requestAnimationFrame ) {
  14284. window.requestAnimationFrame( schedule );
  14285. } else {
  14286. window.setTimeout( schedule, jQuery.fx.interval );
  14287. }
  14288. jQuery.fx.tick();
  14289. }
  14290. }
  14291. // Animations created synchronously will run synchronously
  14292. function createFxNow() {
  14293. window.setTimeout( function() {
  14294. fxNow = undefined;
  14295. } );
  14296. return ( fxNow = Date.now() );
  14297. }
  14298. // Generate parameters to create a standard animation
  14299. function genFx( type, includeWidth ) {
  14300. var which,
  14301. i = 0,
  14302. attrs = { height: type };
  14303. // If we include width, step value is 1 to do all cssExpand values,
  14304. // otherwise step value is 2 to skip over Left and Right
  14305. includeWidth = includeWidth ? 1 : 0;
  14306. for ( ; i < 4; i += 2 - includeWidth ) {
  14307. which = cssExpand[ i ];
  14308. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14309. }
  14310. if ( includeWidth ) {
  14311. attrs.opacity = attrs.width = type;
  14312. }
  14313. return attrs;
  14314. }
  14315. function createTween( value, prop, animation ) {
  14316. var tween,
  14317. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14318. index = 0,
  14319. length = collection.length;
  14320. for ( ; index < length; index++ ) {
  14321. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14322. // We're done with this property
  14323. return tween;
  14324. }
  14325. }
  14326. }
  14327. function defaultPrefilter( elem, props, opts ) {
  14328. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14329. isBox = "width" in props || "height" in props,
  14330. anim = this,
  14331. orig = {},
  14332. style = elem.style,
  14333. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14334. dataShow = dataPriv.get( elem, "fxshow" );
  14335. // Queue-skipping animations hijack the fx hooks
  14336. if ( !opts.queue ) {
  14337. hooks = jQuery._queueHooks( elem, "fx" );
  14338. if ( hooks.unqueued == null ) {
  14339. hooks.unqueued = 0;
  14340. oldfire = hooks.empty.fire;
  14341. hooks.empty.fire = function() {
  14342. if ( !hooks.unqueued ) {
  14343. oldfire();
  14344. }
  14345. };
  14346. }
  14347. hooks.unqueued++;
  14348. anim.always( function() {
  14349. // Ensure the complete handler is called before this completes
  14350. anim.always( function() {
  14351. hooks.unqueued--;
  14352. if ( !jQuery.queue( elem, "fx" ).length ) {
  14353. hooks.empty.fire();
  14354. }
  14355. } );
  14356. } );
  14357. }
  14358. // Detect show/hide animations
  14359. for ( prop in props ) {
  14360. value = props[ prop ];
  14361. if ( rfxtypes.test( value ) ) {
  14362. delete props[ prop ];
  14363. toggle = toggle || value === "toggle";
  14364. if ( value === ( hidden ? "hide" : "show" ) ) {
  14365. // Pretend to be hidden if this is a "show" and
  14366. // there is still data from a stopped show/hide
  14367. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14368. hidden = true;
  14369. // Ignore all other no-op show/hide data
  14370. } else {
  14371. continue;
  14372. }
  14373. }
  14374. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14375. }
  14376. }
  14377. // Bail out if this is a no-op like .hide().hide()
  14378. propTween = !jQuery.isEmptyObject( props );
  14379. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14380. return;
  14381. }
  14382. // Restrict "overflow" and "display" styles during box animations
  14383. if ( isBox && elem.nodeType === 1 ) {
  14384. // Support: IE <=9 - 11, Edge 12 - 15
  14385. // Record all 3 overflow attributes because IE does not infer the shorthand
  14386. // from identically-valued overflowX and overflowY and Edge just mirrors
  14387. // the overflowX value there.
  14388. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14389. // Identify a display type, preferring old show/hide data over the CSS cascade
  14390. restoreDisplay = dataShow && dataShow.display;
  14391. if ( restoreDisplay == null ) {
  14392. restoreDisplay = dataPriv.get( elem, "display" );
  14393. }
  14394. display = jQuery.css( elem, "display" );
  14395. if ( display === "none" ) {
  14396. if ( restoreDisplay ) {
  14397. display = restoreDisplay;
  14398. } else {
  14399. // Get nonempty value(s) by temporarily forcing visibility
  14400. showHide( [ elem ], true );
  14401. restoreDisplay = elem.style.display || restoreDisplay;
  14402. display = jQuery.css( elem, "display" );
  14403. showHide( [ elem ] );
  14404. }
  14405. }
  14406. // Animate inline elements as inline-block
  14407. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14408. if ( jQuery.css( elem, "float" ) === "none" ) {
  14409. // Restore the original display value at the end of pure show/hide animations
  14410. if ( !propTween ) {
  14411. anim.done( function() {
  14412. style.display = restoreDisplay;
  14413. } );
  14414. if ( restoreDisplay == null ) {
  14415. display = style.display;
  14416. restoreDisplay = display === "none" ? "" : display;
  14417. }
  14418. }
  14419. style.display = "inline-block";
  14420. }
  14421. }
  14422. }
  14423. if ( opts.overflow ) {
  14424. style.overflow = "hidden";
  14425. anim.always( function() {
  14426. style.overflow = opts.overflow[ 0 ];
  14427. style.overflowX = opts.overflow[ 1 ];
  14428. style.overflowY = opts.overflow[ 2 ];
  14429. } );
  14430. }
  14431. // Implement show/hide animations
  14432. propTween = false;
  14433. for ( prop in orig ) {
  14434. // General show/hide setup for this element animation
  14435. if ( !propTween ) {
  14436. if ( dataShow ) {
  14437. if ( "hidden" in dataShow ) {
  14438. hidden = dataShow.hidden;
  14439. }
  14440. } else {
  14441. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14442. }
  14443. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14444. if ( toggle ) {
  14445. dataShow.hidden = !hidden;
  14446. }
  14447. // Show elements before animating them
  14448. if ( hidden ) {
  14449. showHide( [ elem ], true );
  14450. }
  14451. /* eslint-disable no-loop-func */
  14452. anim.done( function() {
  14453. /* eslint-enable no-loop-func */
  14454. // The final step of a "hide" animation is actually hiding the element
  14455. if ( !hidden ) {
  14456. showHide( [ elem ] );
  14457. }
  14458. dataPriv.remove( elem, "fxshow" );
  14459. for ( prop in orig ) {
  14460. jQuery.style( elem, prop, orig[ prop ] );
  14461. }
  14462. } );
  14463. }
  14464. // Per-property setup
  14465. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14466. if ( !( prop in dataShow ) ) {
  14467. dataShow[ prop ] = propTween.start;
  14468. if ( hidden ) {
  14469. propTween.end = propTween.start;
  14470. propTween.start = 0;
  14471. }
  14472. }
  14473. }
  14474. }
  14475. function propFilter( props, specialEasing ) {
  14476. var index, name, easing, value, hooks;
  14477. // camelCase, specialEasing and expand cssHook pass
  14478. for ( index in props ) {
  14479. name = camelCase( index );
  14480. easing = specialEasing[ name ];
  14481. value = props[ index ];
  14482. if ( Array.isArray( value ) ) {
  14483. easing = value[ 1 ];
  14484. value = props[ index ] = value[ 0 ];
  14485. }
  14486. if ( index !== name ) {
  14487. props[ name ] = value;
  14488. delete props[ index ];
  14489. }
  14490. hooks = jQuery.cssHooks[ name ];
  14491. if ( hooks && "expand" in hooks ) {
  14492. value = hooks.expand( value );
  14493. delete props[ name ];
  14494. // Not quite $.extend, this won't overwrite existing keys.
  14495. // Reusing 'index' because we have the correct "name"
  14496. for ( index in value ) {
  14497. if ( !( index in props ) ) {
  14498. props[ index ] = value[ index ];
  14499. specialEasing[ index ] = easing;
  14500. }
  14501. }
  14502. } else {
  14503. specialEasing[ name ] = easing;
  14504. }
  14505. }
  14506. }
  14507. function Animation( elem, properties, options ) {
  14508. var result,
  14509. stopped,
  14510. index = 0,
  14511. length = Animation.prefilters.length,
  14512. deferred = jQuery.Deferred().always( function() {
  14513. // Don't match elem in the :animated selector
  14514. delete tick.elem;
  14515. } ),
  14516. tick = function() {
  14517. if ( stopped ) {
  14518. return false;
  14519. }
  14520. var currentTime = fxNow || createFxNow(),
  14521. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14522. // Support: Android 2.3 only
  14523. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14524. temp = remaining / animation.duration || 0,
  14525. percent = 1 - temp,
  14526. index = 0,
  14527. length = animation.tweens.length;
  14528. for ( ; index < length; index++ ) {
  14529. animation.tweens[ index ].run( percent );
  14530. }
  14531. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14532. // If there's more to do, yield
  14533. if ( percent < 1 && length ) {
  14534. return remaining;
  14535. }
  14536. // If this was an empty animation, synthesize a final progress notification
  14537. if ( !length ) {
  14538. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14539. }
  14540. // Resolve the animation and report its conclusion
  14541. deferred.resolveWith( elem, [ animation ] );
  14542. return false;
  14543. },
  14544. animation = deferred.promise( {
  14545. elem: elem,
  14546. props: jQuery.extend( {}, properties ),
  14547. opts: jQuery.extend( true, {
  14548. specialEasing: {},
  14549. easing: jQuery.easing._default
  14550. }, options ),
  14551. originalProperties: properties,
  14552. originalOptions: options,
  14553. startTime: fxNow || createFxNow(),
  14554. duration: options.duration,
  14555. tweens: [],
  14556. createTween: function( prop, end ) {
  14557. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14558. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14559. animation.tweens.push( tween );
  14560. return tween;
  14561. },
  14562. stop: function( gotoEnd ) {
  14563. var index = 0,
  14564. // If we are going to the end, we want to run all the tweens
  14565. // otherwise we skip this part
  14566. length = gotoEnd ? animation.tweens.length : 0;
  14567. if ( stopped ) {
  14568. return this;
  14569. }
  14570. stopped = true;
  14571. for ( ; index < length; index++ ) {
  14572. animation.tweens[ index ].run( 1 );
  14573. }
  14574. // Resolve when we played the last frame; otherwise, reject
  14575. if ( gotoEnd ) {
  14576. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14577. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14578. } else {
  14579. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14580. }
  14581. return this;
  14582. }
  14583. } ),
  14584. props = animation.props;
  14585. propFilter( props, animation.opts.specialEasing );
  14586. for ( ; index < length; index++ ) {
  14587. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14588. if ( result ) {
  14589. if ( isFunction( result.stop ) ) {
  14590. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14591. result.stop.bind( result );
  14592. }
  14593. return result;
  14594. }
  14595. }
  14596. jQuery.map( props, createTween, animation );
  14597. if ( isFunction( animation.opts.start ) ) {
  14598. animation.opts.start.call( elem, animation );
  14599. }
  14600. // Attach callbacks from options
  14601. animation
  14602. .progress( animation.opts.progress )
  14603. .done( animation.opts.done, animation.opts.complete )
  14604. .fail( animation.opts.fail )
  14605. .always( animation.opts.always );
  14606. jQuery.fx.timer(
  14607. jQuery.extend( tick, {
  14608. elem: elem,
  14609. anim: animation,
  14610. queue: animation.opts.queue
  14611. } )
  14612. );
  14613. return animation;
  14614. }
  14615. jQuery.Animation = jQuery.extend( Animation, {
  14616. tweeners: {
  14617. "*": [ function( prop, value ) {
  14618. var tween = this.createTween( prop, value );
  14619. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14620. return tween;
  14621. } ]
  14622. },
  14623. tweener: function( props, callback ) {
  14624. if ( isFunction( props ) ) {
  14625. callback = props;
  14626. props = [ "*" ];
  14627. } else {
  14628. props = props.match( rnothtmlwhite );
  14629. }
  14630. var prop,
  14631. index = 0,
  14632. length = props.length;
  14633. for ( ; index < length; index++ ) {
  14634. prop = props[ index ];
  14635. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14636. Animation.tweeners[ prop ].unshift( callback );
  14637. }
  14638. },
  14639. prefilters: [ defaultPrefilter ],
  14640. prefilter: function( callback, prepend ) {
  14641. if ( prepend ) {
  14642. Animation.prefilters.unshift( callback );
  14643. } else {
  14644. Animation.prefilters.push( callback );
  14645. }
  14646. }
  14647. } );
  14648. jQuery.speed = function( speed, easing, fn ) {
  14649. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14650. complete: fn || !fn && easing ||
  14651. isFunction( speed ) && speed,
  14652. duration: speed,
  14653. easing: fn && easing || easing && !isFunction( easing ) && easing
  14654. };
  14655. // Go to the end state if fx are off
  14656. if ( jQuery.fx.off ) {
  14657. opt.duration = 0;
  14658. } else {
  14659. if ( typeof opt.duration !== "number" ) {
  14660. if ( opt.duration in jQuery.fx.speeds ) {
  14661. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14662. } else {
  14663. opt.duration = jQuery.fx.speeds._default;
  14664. }
  14665. }
  14666. }
  14667. // Normalize opt.queue - true/undefined/null -> "fx"
  14668. if ( opt.queue == null || opt.queue === true ) {
  14669. opt.queue = "fx";
  14670. }
  14671. // Queueing
  14672. opt.old = opt.complete;
  14673. opt.complete = function() {
  14674. if ( isFunction( opt.old ) ) {
  14675. opt.old.call( this );
  14676. }
  14677. if ( opt.queue ) {
  14678. jQuery.dequeue( this, opt.queue );
  14679. }
  14680. };
  14681. return opt;
  14682. };
  14683. jQuery.fn.extend( {
  14684. fadeTo: function( speed, to, easing, callback ) {
  14685. // Show any hidden elements after setting opacity to 0
  14686. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14687. // Animate to the value specified
  14688. .end().animate( { opacity: to }, speed, easing, callback );
  14689. },
  14690. animate: function( prop, speed, easing, callback ) {
  14691. var empty = jQuery.isEmptyObject( prop ),
  14692. optall = jQuery.speed( speed, easing, callback ),
  14693. doAnimation = function() {
  14694. // Operate on a copy of prop so per-property easing won't be lost
  14695. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14696. // Empty animations, or finishing resolves immediately
  14697. if ( empty || dataPriv.get( this, "finish" ) ) {
  14698. anim.stop( true );
  14699. }
  14700. };
  14701. doAnimation.finish = doAnimation;
  14702. return empty || optall.queue === false ?
  14703. this.each( doAnimation ) :
  14704. this.queue( optall.queue, doAnimation );
  14705. },
  14706. stop: function( type, clearQueue, gotoEnd ) {
  14707. var stopQueue = function( hooks ) {
  14708. var stop = hooks.stop;
  14709. delete hooks.stop;
  14710. stop( gotoEnd );
  14711. };
  14712. if ( typeof type !== "string" ) {
  14713. gotoEnd = clearQueue;
  14714. clearQueue = type;
  14715. type = undefined;
  14716. }
  14717. if ( clearQueue && type !== false ) {
  14718. this.queue( type || "fx", [] );
  14719. }
  14720. return this.each( function() {
  14721. var dequeue = true,
  14722. index = type != null && type + "queueHooks",
  14723. timers = jQuery.timers,
  14724. data = dataPriv.get( this );
  14725. if ( index ) {
  14726. if ( data[ index ] && data[ index ].stop ) {
  14727. stopQueue( data[ index ] );
  14728. }
  14729. } else {
  14730. for ( index in data ) {
  14731. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14732. stopQueue( data[ index ] );
  14733. }
  14734. }
  14735. }
  14736. for ( index = timers.length; index--; ) {
  14737. if ( timers[ index ].elem === this &&
  14738. ( type == null || timers[ index ].queue === type ) ) {
  14739. timers[ index ].anim.stop( gotoEnd );
  14740. dequeue = false;
  14741. timers.splice( index, 1 );
  14742. }
  14743. }
  14744. // Start the next in the queue if the last step wasn't forced.
  14745. // Timers currently will call their complete callbacks, which
  14746. // will dequeue but only if they were gotoEnd.
  14747. if ( dequeue || !gotoEnd ) {
  14748. jQuery.dequeue( this, type );
  14749. }
  14750. } );
  14751. },
  14752. finish: function( type ) {
  14753. if ( type !== false ) {
  14754. type = type || "fx";
  14755. }
  14756. return this.each( function() {
  14757. var index,
  14758. data = dataPriv.get( this ),
  14759. queue = data[ type + "queue" ],
  14760. hooks = data[ type + "queueHooks" ],
  14761. timers = jQuery.timers,
  14762. length = queue ? queue.length : 0;
  14763. // Enable finishing flag on private data
  14764. data.finish = true;
  14765. // Empty the queue first
  14766. jQuery.queue( this, type, [] );
  14767. if ( hooks && hooks.stop ) {
  14768. hooks.stop.call( this, true );
  14769. }
  14770. // Look for any active animations, and finish them
  14771. for ( index = timers.length; index--; ) {
  14772. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14773. timers[ index ].anim.stop( true );
  14774. timers.splice( index, 1 );
  14775. }
  14776. }
  14777. // Look for any animations in the old queue and finish them
  14778. for ( index = 0; index < length; index++ ) {
  14779. if ( queue[ index ] && queue[ index ].finish ) {
  14780. queue[ index ].finish.call( this );
  14781. }
  14782. }
  14783. // Turn off finishing flag
  14784. delete data.finish;
  14785. } );
  14786. }
  14787. } );
  14788. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14789. var cssFn = jQuery.fn[ name ];
  14790. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14791. return speed == null || typeof speed === "boolean" ?
  14792. cssFn.apply( this, arguments ) :
  14793. this.animate( genFx( name, true ), speed, easing, callback );
  14794. };
  14795. } );
  14796. // Generate shortcuts for custom animations
  14797. jQuery.each( {
  14798. slideDown: genFx( "show" ),
  14799. slideUp: genFx( "hide" ),
  14800. slideToggle: genFx( "toggle" ),
  14801. fadeIn: { opacity: "show" },
  14802. fadeOut: { opacity: "hide" },
  14803. fadeToggle: { opacity: "toggle" }
  14804. }, function( name, props ) {
  14805. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14806. return this.animate( props, speed, easing, callback );
  14807. };
  14808. } );
  14809. jQuery.timers = [];
  14810. jQuery.fx.tick = function() {
  14811. var timer,
  14812. i = 0,
  14813. timers = jQuery.timers;
  14814. fxNow = Date.now();
  14815. for ( ; i < timers.length; i++ ) {
  14816. timer = timers[ i ];
  14817. // Run the timer and safely remove it when done (allowing for external removal)
  14818. if ( !timer() && timers[ i ] === timer ) {
  14819. timers.splice( i--, 1 );
  14820. }
  14821. }
  14822. if ( !timers.length ) {
  14823. jQuery.fx.stop();
  14824. }
  14825. fxNow = undefined;
  14826. };
  14827. jQuery.fx.timer = function( timer ) {
  14828. jQuery.timers.push( timer );
  14829. jQuery.fx.start();
  14830. };
  14831. jQuery.fx.interval = 13;
  14832. jQuery.fx.start = function() {
  14833. if ( inProgress ) {
  14834. return;
  14835. }
  14836. inProgress = true;
  14837. schedule();
  14838. };
  14839. jQuery.fx.stop = function() {
  14840. inProgress = null;
  14841. };
  14842. jQuery.fx.speeds = {
  14843. slow: 600,
  14844. fast: 200,
  14845. // Default speed
  14846. _default: 400
  14847. };
  14848. // Based off of the plugin by Clint Helfers, with permission.
  14849. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14850. jQuery.fn.delay = function( time, type ) {
  14851. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14852. type = type || "fx";
  14853. return this.queue( type, function( next, hooks ) {
  14854. var timeout = window.setTimeout( next, time );
  14855. hooks.stop = function() {
  14856. window.clearTimeout( timeout );
  14857. };
  14858. } );
  14859. };
  14860. ( function() {
  14861. var input = document.createElement( "input" ),
  14862. select = document.createElement( "select" ),
  14863. opt = select.appendChild( document.createElement( "option" ) );
  14864. input.type = "checkbox";
  14865. // Support: Android <=4.3 only
  14866. // Default value for a checkbox should be "on"
  14867. support.checkOn = input.value !== "";
  14868. // Support: IE <=11 only
  14869. // Must access selectedIndex to make default options select
  14870. support.optSelected = opt.selected;
  14871. // Support: IE <=11 only
  14872. // An input loses its value after becoming a radio
  14873. input = document.createElement( "input" );
  14874. input.value = "t";
  14875. input.type = "radio";
  14876. support.radioValue = input.value === "t";
  14877. } )();
  14878. var boolHook,
  14879. attrHandle = jQuery.expr.attrHandle;
  14880. jQuery.fn.extend( {
  14881. attr: function( name, value ) {
  14882. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14883. },
  14884. removeAttr: function( name ) {
  14885. return this.each( function() {
  14886. jQuery.removeAttr( this, name );
  14887. } );
  14888. }
  14889. } );
  14890. jQuery.extend( {
  14891. attr: function( elem, name, value ) {
  14892. var ret, hooks,
  14893. nType = elem.nodeType;
  14894. // Don't get/set attributes on text, comment and attribute nodes
  14895. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14896. return;
  14897. }
  14898. // Fallback to prop when attributes are not supported
  14899. if ( typeof elem.getAttribute === "undefined" ) {
  14900. return jQuery.prop( elem, name, value );
  14901. }
  14902. // Attribute hooks are determined by the lowercase version
  14903. // Grab necessary hook if one is defined
  14904. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14905. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14906. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14907. }
  14908. if ( value !== undefined ) {
  14909. if ( value === null ) {
  14910. jQuery.removeAttr( elem, name );
  14911. return;
  14912. }
  14913. if ( hooks && "set" in hooks &&
  14914. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14915. return ret;
  14916. }
  14917. elem.setAttribute( name, value + "" );
  14918. return value;
  14919. }
  14920. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14921. return ret;
  14922. }
  14923. ret = jQuery.find.attr( elem, name );
  14924. // Non-existent attributes return null, we normalize to undefined
  14925. return ret == null ? undefined : ret;
  14926. },
  14927. attrHooks: {
  14928. type: {
  14929. set: function( elem, value ) {
  14930. if ( !support.radioValue && value === "radio" &&
  14931. nodeName( elem, "input" ) ) {
  14932. var val = elem.value;
  14933. elem.setAttribute( "type", value );
  14934. if ( val ) {
  14935. elem.value = val;
  14936. }
  14937. return value;
  14938. }
  14939. }
  14940. }
  14941. },
  14942. removeAttr: function( elem, value ) {
  14943. var name,
  14944. i = 0,
  14945. // Attribute names can contain non-HTML whitespace characters
  14946. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14947. attrNames = value && value.match( rnothtmlwhite );
  14948. if ( attrNames && elem.nodeType === 1 ) {
  14949. while ( ( name = attrNames[ i++ ] ) ) {
  14950. elem.removeAttribute( name );
  14951. }
  14952. }
  14953. }
  14954. } );
  14955. // Hooks for boolean attributes
  14956. boolHook = {
  14957. set: function( elem, value, name ) {
  14958. if ( value === false ) {
  14959. // Remove boolean attributes when set to false
  14960. jQuery.removeAttr( elem, name );
  14961. } else {
  14962. elem.setAttribute( name, name );
  14963. }
  14964. return name;
  14965. }
  14966. };
  14967. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14968. var getter = attrHandle[ name ] || jQuery.find.attr;
  14969. attrHandle[ name ] = function( elem, name, isXML ) {
  14970. var ret, handle,
  14971. lowercaseName = name.toLowerCase();
  14972. if ( !isXML ) {
  14973. // Avoid an infinite loop by temporarily removing this function from the getter
  14974. handle = attrHandle[ lowercaseName ];
  14975. attrHandle[ lowercaseName ] = ret;
  14976. ret = getter( elem, name, isXML ) != null ?
  14977. lowercaseName :
  14978. null;
  14979. attrHandle[ lowercaseName ] = handle;
  14980. }
  14981. return ret;
  14982. };
  14983. } );
  14984. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14985. rclickable = /^(?:a|area)$/i;
  14986. jQuery.fn.extend( {
  14987. prop: function( name, value ) {
  14988. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14989. },
  14990. removeProp: function( name ) {
  14991. return this.each( function() {
  14992. delete this[ jQuery.propFix[ name ] || name ];
  14993. } );
  14994. }
  14995. } );
  14996. jQuery.extend( {
  14997. prop: function( elem, name, value ) {
  14998. var ret, hooks,
  14999. nType = elem.nodeType;
  15000. // Don't get/set properties on text, comment and attribute nodes
  15001. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15002. return;
  15003. }
  15004. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15005. // Fix name and attach hooks
  15006. name = jQuery.propFix[ name ] || name;
  15007. hooks = jQuery.propHooks[ name ];
  15008. }
  15009. if ( value !== undefined ) {
  15010. if ( hooks && "set" in hooks &&
  15011. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15012. return ret;
  15013. }
  15014. return ( elem[ name ] = value );
  15015. }
  15016. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15017. return ret;
  15018. }
  15019. return elem[ name ];
  15020. },
  15021. propHooks: {
  15022. tabIndex: {
  15023. get: function( elem ) {
  15024. // Support: IE <=9 - 11 only
  15025. // elem.tabIndex doesn't always return the
  15026. // correct value when it hasn't been explicitly set
  15027. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15028. // Use proper attribute retrieval(#12072)
  15029. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15030. if ( tabindex ) {
  15031. return parseInt( tabindex, 10 );
  15032. }
  15033. if (
  15034. rfocusable.test( elem.nodeName ) ||
  15035. rclickable.test( elem.nodeName ) &&
  15036. elem.href
  15037. ) {
  15038. return 0;
  15039. }
  15040. return -1;
  15041. }
  15042. }
  15043. },
  15044. propFix: {
  15045. "for": "htmlFor",
  15046. "class": "className"
  15047. }
  15048. } );
  15049. // Support: IE <=11 only
  15050. // Accessing the selectedIndex property
  15051. // forces the browser to respect setting selected
  15052. // on the option
  15053. // The getter ensures a default option is selected
  15054. // when in an optgroup
  15055. // eslint rule "no-unused-expressions" is disabled for this code
  15056. // since it considers such accessions noop
  15057. if ( !support.optSelected ) {
  15058. jQuery.propHooks.selected = {
  15059. get: function( elem ) {
  15060. /* eslint no-unused-expressions: "off" */
  15061. var parent = elem.parentNode;
  15062. if ( parent && parent.parentNode ) {
  15063. parent.parentNode.selectedIndex;
  15064. }
  15065. return null;
  15066. },
  15067. set: function( elem ) {
  15068. /* eslint no-unused-expressions: "off" */
  15069. var parent = elem.parentNode;
  15070. if ( parent ) {
  15071. parent.selectedIndex;
  15072. if ( parent.parentNode ) {
  15073. parent.parentNode.selectedIndex;
  15074. }
  15075. }
  15076. }
  15077. };
  15078. }
  15079. jQuery.each( [
  15080. "tabIndex",
  15081. "readOnly",
  15082. "maxLength",
  15083. "cellSpacing",
  15084. "cellPadding",
  15085. "rowSpan",
  15086. "colSpan",
  15087. "useMap",
  15088. "frameBorder",
  15089. "contentEditable"
  15090. ], function() {
  15091. jQuery.propFix[ this.toLowerCase() ] = this;
  15092. } );
  15093. // Strip and collapse whitespace according to HTML spec
  15094. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15095. function stripAndCollapse( value ) {
  15096. var tokens = value.match( rnothtmlwhite ) || [];
  15097. return tokens.join( " " );
  15098. }
  15099. function getClass( elem ) {
  15100. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15101. }
  15102. function classesToArray( value ) {
  15103. if ( Array.isArray( value ) ) {
  15104. return value;
  15105. }
  15106. if ( typeof value === "string" ) {
  15107. return value.match( rnothtmlwhite ) || [];
  15108. }
  15109. return [];
  15110. }
  15111. jQuery.fn.extend( {
  15112. addClass: function( value ) {
  15113. var classes, elem, cur, curValue, clazz, j, finalValue,
  15114. i = 0;
  15115. if ( isFunction( value ) ) {
  15116. return this.each( function( j ) {
  15117. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15118. } );
  15119. }
  15120. classes = classesToArray( value );
  15121. if ( classes.length ) {
  15122. while ( ( elem = this[ i++ ] ) ) {
  15123. curValue = getClass( elem );
  15124. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15125. if ( cur ) {
  15126. j = 0;
  15127. while ( ( clazz = classes[ j++ ] ) ) {
  15128. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15129. cur += clazz + " ";
  15130. }
  15131. }
  15132. // Only assign if different to avoid unneeded rendering.
  15133. finalValue = stripAndCollapse( cur );
  15134. if ( curValue !== finalValue ) {
  15135. elem.setAttribute( "class", finalValue );
  15136. }
  15137. }
  15138. }
  15139. }
  15140. return this;
  15141. },
  15142. removeClass: function( value ) {
  15143. var classes, elem, cur, curValue, clazz, j, finalValue,
  15144. i = 0;
  15145. if ( isFunction( value ) ) {
  15146. return this.each( function( j ) {
  15147. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15148. } );
  15149. }
  15150. if ( !arguments.length ) {
  15151. return this.attr( "class", "" );
  15152. }
  15153. classes = classesToArray( value );
  15154. if ( classes.length ) {
  15155. while ( ( elem = this[ i++ ] ) ) {
  15156. curValue = getClass( elem );
  15157. // This expression is here for better compressibility (see addClass)
  15158. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15159. if ( cur ) {
  15160. j = 0;
  15161. while ( ( clazz = classes[ j++ ] ) ) {
  15162. // Remove *all* instances
  15163. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15164. cur = cur.replace( " " + clazz + " ", " " );
  15165. }
  15166. }
  15167. // Only assign if different to avoid unneeded rendering.
  15168. finalValue = stripAndCollapse( cur );
  15169. if ( curValue !== finalValue ) {
  15170. elem.setAttribute( "class", finalValue );
  15171. }
  15172. }
  15173. }
  15174. }
  15175. return this;
  15176. },
  15177. toggleClass: function( value, stateVal ) {
  15178. var type = typeof value,
  15179. isValidValue = type === "string" || Array.isArray( value );
  15180. if ( typeof stateVal === "boolean" && isValidValue ) {
  15181. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15182. }
  15183. if ( isFunction( value ) ) {
  15184. return this.each( function( i ) {
  15185. jQuery( this ).toggleClass(
  15186. value.call( this, i, getClass( this ), stateVal ),
  15187. stateVal
  15188. );
  15189. } );
  15190. }
  15191. return this.each( function() {
  15192. var className, i, self, classNames;
  15193. if ( isValidValue ) {
  15194. // Toggle individual class names
  15195. i = 0;
  15196. self = jQuery( this );
  15197. classNames = classesToArray( value );
  15198. while ( ( className = classNames[ i++ ] ) ) {
  15199. // Check each className given, space separated list
  15200. if ( self.hasClass( className ) ) {
  15201. self.removeClass( className );
  15202. } else {
  15203. self.addClass( className );
  15204. }
  15205. }
  15206. // Toggle whole class name
  15207. } else if ( value === undefined || type === "boolean" ) {
  15208. className = getClass( this );
  15209. if ( className ) {
  15210. // Store className if set
  15211. dataPriv.set( this, "__className__", className );
  15212. }
  15213. // If the element has a class name or if we're passed `false`,
  15214. // then remove the whole classname (if there was one, the above saved it).
  15215. // Otherwise bring back whatever was previously saved (if anything),
  15216. // falling back to the empty string if nothing was stored.
  15217. if ( this.setAttribute ) {
  15218. this.setAttribute( "class",
  15219. className || value === false ?
  15220. "" :
  15221. dataPriv.get( this, "__className__" ) || ""
  15222. );
  15223. }
  15224. }
  15225. } );
  15226. },
  15227. hasClass: function( selector ) {
  15228. var className, elem,
  15229. i = 0;
  15230. className = " " + selector + " ";
  15231. while ( ( elem = this[ i++ ] ) ) {
  15232. if ( elem.nodeType === 1 &&
  15233. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15234. return true;
  15235. }
  15236. }
  15237. return false;
  15238. }
  15239. } );
  15240. var rreturn = /\r/g;
  15241. jQuery.fn.extend( {
  15242. val: function( value ) {
  15243. var hooks, ret, valueIsFunction,
  15244. elem = this[ 0 ];
  15245. if ( !arguments.length ) {
  15246. if ( elem ) {
  15247. hooks = jQuery.valHooks[ elem.type ] ||
  15248. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15249. if ( hooks &&
  15250. "get" in hooks &&
  15251. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15252. ) {
  15253. return ret;
  15254. }
  15255. ret = elem.value;
  15256. // Handle most common string cases
  15257. if ( typeof ret === "string" ) {
  15258. return ret.replace( rreturn, "" );
  15259. }
  15260. // Handle cases where value is null/undef or number
  15261. return ret == null ? "" : ret;
  15262. }
  15263. return;
  15264. }
  15265. valueIsFunction = isFunction( value );
  15266. return this.each( function( i ) {
  15267. var val;
  15268. if ( this.nodeType !== 1 ) {
  15269. return;
  15270. }
  15271. if ( valueIsFunction ) {
  15272. val = value.call( this, i, jQuery( this ).val() );
  15273. } else {
  15274. val = value;
  15275. }
  15276. // Treat null/undefined as ""; convert numbers to string
  15277. if ( val == null ) {
  15278. val = "";
  15279. } else if ( typeof val === "number" ) {
  15280. val += "";
  15281. } else if ( Array.isArray( val ) ) {
  15282. val = jQuery.map( val, function( value ) {
  15283. return value == null ? "" : value + "";
  15284. } );
  15285. }
  15286. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15287. // If set returns undefined, fall back to normal setting
  15288. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15289. this.value = val;
  15290. }
  15291. } );
  15292. }
  15293. } );
  15294. jQuery.extend( {
  15295. valHooks: {
  15296. option: {
  15297. get: function( elem ) {
  15298. var val = jQuery.find.attr( elem, "value" );
  15299. return val != null ?
  15300. val :
  15301. // Support: IE <=10 - 11 only
  15302. // option.text throws exceptions (#14686, #14858)
  15303. // Strip and collapse whitespace
  15304. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15305. stripAndCollapse( jQuery.text( elem ) );
  15306. }
  15307. },
  15308. select: {
  15309. get: function( elem ) {
  15310. var value, option, i,
  15311. options = elem.options,
  15312. index = elem.selectedIndex,
  15313. one = elem.type === "select-one",
  15314. values = one ? null : [],
  15315. max = one ? index + 1 : options.length;
  15316. if ( index < 0 ) {
  15317. i = max;
  15318. } else {
  15319. i = one ? index : 0;
  15320. }
  15321. // Loop through all the selected options
  15322. for ( ; i < max; i++ ) {
  15323. option = options[ i ];
  15324. // Support: IE <=9 only
  15325. // IE8-9 doesn't update selected after form reset (#2551)
  15326. if ( ( option.selected || i === index ) &&
  15327. // Don't return options that are disabled or in a disabled optgroup
  15328. !option.disabled &&
  15329. ( !option.parentNode.disabled ||
  15330. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15331. // Get the specific value for the option
  15332. value = jQuery( option ).val();
  15333. // We don't need an array for one selects
  15334. if ( one ) {
  15335. return value;
  15336. }
  15337. // Multi-Selects return an array
  15338. values.push( value );
  15339. }
  15340. }
  15341. return values;
  15342. },
  15343. set: function( elem, value ) {
  15344. var optionSet, option,
  15345. options = elem.options,
  15346. values = jQuery.makeArray( value ),
  15347. i = options.length;
  15348. while ( i-- ) {
  15349. option = options[ i ];
  15350. /* eslint-disable no-cond-assign */
  15351. if ( option.selected =
  15352. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15353. ) {
  15354. optionSet = true;
  15355. }
  15356. /* eslint-enable no-cond-assign */
  15357. }
  15358. // Force browsers to behave consistently when non-matching value is set
  15359. if ( !optionSet ) {
  15360. elem.selectedIndex = -1;
  15361. }
  15362. return values;
  15363. }
  15364. }
  15365. }
  15366. } );
  15367. // Radios and checkboxes getter/setter
  15368. jQuery.each( [ "radio", "checkbox" ], function() {
  15369. jQuery.valHooks[ this ] = {
  15370. set: function( elem, value ) {
  15371. if ( Array.isArray( value ) ) {
  15372. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15373. }
  15374. }
  15375. };
  15376. if ( !support.checkOn ) {
  15377. jQuery.valHooks[ this ].get = function( elem ) {
  15378. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15379. };
  15380. }
  15381. } );
  15382. // Return jQuery for attributes-only inclusion
  15383. support.focusin = "onfocusin" in window;
  15384. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15385. stopPropagationCallback = function( e ) {
  15386. e.stopPropagation();
  15387. };
  15388. jQuery.extend( jQuery.event, {
  15389. trigger: function( event, data, elem, onlyHandlers ) {
  15390. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15391. eventPath = [ elem || document ],
  15392. type = hasOwn.call( event, "type" ) ? event.type : event,
  15393. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15394. cur = lastElement = tmp = elem = elem || document;
  15395. // Don't do events on text and comment nodes
  15396. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15397. return;
  15398. }
  15399. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15400. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15401. return;
  15402. }
  15403. if ( type.indexOf( "." ) > -1 ) {
  15404. // Namespaced trigger; create a regexp to match event type in handle()
  15405. namespaces = type.split( "." );
  15406. type = namespaces.shift();
  15407. namespaces.sort();
  15408. }
  15409. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15410. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15411. event = event[ jQuery.expando ] ?
  15412. event :
  15413. new jQuery.Event( type, typeof event === "object" && event );
  15414. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15415. event.isTrigger = onlyHandlers ? 2 : 3;
  15416. event.namespace = namespaces.join( "." );
  15417. event.rnamespace = event.namespace ?
  15418. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15419. null;
  15420. // Clean up the event in case it is being reused
  15421. event.result = undefined;
  15422. if ( !event.target ) {
  15423. event.target = elem;
  15424. }
  15425. // Clone any incoming data and prepend the event, creating the handler arg list
  15426. data = data == null ?
  15427. [ event ] :
  15428. jQuery.makeArray( data, [ event ] );
  15429. // Allow special events to draw outside the lines
  15430. special = jQuery.event.special[ type ] || {};
  15431. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15432. return;
  15433. }
  15434. // Determine event propagation path in advance, per W3C events spec (#9951)
  15435. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15436. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15437. bubbleType = special.delegateType || type;
  15438. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15439. cur = cur.parentNode;
  15440. }
  15441. for ( ; cur; cur = cur.parentNode ) {
  15442. eventPath.push( cur );
  15443. tmp = cur;
  15444. }
  15445. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15446. if ( tmp === ( elem.ownerDocument || document ) ) {
  15447. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15448. }
  15449. }
  15450. // Fire handlers on the event path
  15451. i = 0;
  15452. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15453. lastElement = cur;
  15454. event.type = i > 1 ?
  15455. bubbleType :
  15456. special.bindType || type;
  15457. // jQuery handler
  15458. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15459. dataPriv.get( cur, "handle" );
  15460. if ( handle ) {
  15461. handle.apply( cur, data );
  15462. }
  15463. // Native handler
  15464. handle = ontype && cur[ ontype ];
  15465. if ( handle && handle.apply && acceptData( cur ) ) {
  15466. event.result = handle.apply( cur, data );
  15467. if ( event.result === false ) {
  15468. event.preventDefault();
  15469. }
  15470. }
  15471. }
  15472. event.type = type;
  15473. // If nobody prevented the default action, do it now
  15474. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15475. if ( ( !special._default ||
  15476. special._default.apply( eventPath.pop(), data ) === false ) &&
  15477. acceptData( elem ) ) {
  15478. // Call a native DOM method on the target with the same name as the event.
  15479. // Don't do default actions on window, that's where global variables be (#6170)
  15480. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15481. // Don't re-trigger an onFOO event when we call its FOO() method
  15482. tmp = elem[ ontype ];
  15483. if ( tmp ) {
  15484. elem[ ontype ] = null;
  15485. }
  15486. // Prevent re-triggering of the same event, since we already bubbled it above
  15487. jQuery.event.triggered = type;
  15488. if ( event.isPropagationStopped() ) {
  15489. lastElement.addEventListener( type, stopPropagationCallback );
  15490. }
  15491. elem[ type ]();
  15492. if ( event.isPropagationStopped() ) {
  15493. lastElement.removeEventListener( type, stopPropagationCallback );
  15494. }
  15495. jQuery.event.triggered = undefined;
  15496. if ( tmp ) {
  15497. elem[ ontype ] = tmp;
  15498. }
  15499. }
  15500. }
  15501. }
  15502. return event.result;
  15503. },
  15504. // Piggyback on a donor event to simulate a different one
  15505. // Used only for `focus(in | out)` events
  15506. simulate: function( type, elem, event ) {
  15507. var e = jQuery.extend(
  15508. new jQuery.Event(),
  15509. event,
  15510. {
  15511. type: type,
  15512. isSimulated: true
  15513. }
  15514. );
  15515. jQuery.event.trigger( e, null, elem );
  15516. }
  15517. } );
  15518. jQuery.fn.extend( {
  15519. trigger: function( type, data ) {
  15520. return this.each( function() {
  15521. jQuery.event.trigger( type, data, this );
  15522. } );
  15523. },
  15524. triggerHandler: function( type, data ) {
  15525. var elem = this[ 0 ];
  15526. if ( elem ) {
  15527. return jQuery.event.trigger( type, data, elem, true );
  15528. }
  15529. }
  15530. } );
  15531. // Support: Firefox <=44
  15532. // Firefox doesn't have focus(in | out) events
  15533. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15534. //
  15535. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15536. // focus(in | out) events fire after focus & blur events,
  15537. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15538. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15539. if ( !support.focusin ) {
  15540. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15541. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15542. var handler = function( event ) {
  15543. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15544. };
  15545. jQuery.event.special[ fix ] = {
  15546. setup: function() {
  15547. var doc = this.ownerDocument || this,
  15548. attaches = dataPriv.access( doc, fix );
  15549. if ( !attaches ) {
  15550. doc.addEventListener( orig, handler, true );
  15551. }
  15552. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15553. },
  15554. teardown: function() {
  15555. var doc = this.ownerDocument || this,
  15556. attaches = dataPriv.access( doc, fix ) - 1;
  15557. if ( !attaches ) {
  15558. doc.removeEventListener( orig, handler, true );
  15559. dataPriv.remove( doc, fix );
  15560. } else {
  15561. dataPriv.access( doc, fix, attaches );
  15562. }
  15563. }
  15564. };
  15565. } );
  15566. }
  15567. var location = window.location;
  15568. var nonce = Date.now();
  15569. var rquery = ( /\?/ );
  15570. // Cross-browser xml parsing
  15571. jQuery.parseXML = function( data ) {
  15572. var xml;
  15573. if ( !data || typeof data !== "string" ) {
  15574. return null;
  15575. }
  15576. // Support: IE 9 - 11 only
  15577. // IE throws on parseFromString with invalid input.
  15578. try {
  15579. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15580. } catch ( e ) {
  15581. xml = undefined;
  15582. }
  15583. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15584. jQuery.error( "Invalid XML: " + data );
  15585. }
  15586. return xml;
  15587. };
  15588. var
  15589. rbracket = /\[\]$/,
  15590. rCRLF = /\r?\n/g,
  15591. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15592. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15593. function buildParams( prefix, obj, traditional, add ) {
  15594. var name;
  15595. if ( Array.isArray( obj ) ) {
  15596. // Serialize array item.
  15597. jQuery.each( obj, function( i, v ) {
  15598. if ( traditional || rbracket.test( prefix ) ) {
  15599. // Treat each array item as a scalar.
  15600. add( prefix, v );
  15601. } else {
  15602. // Item is non-scalar (array or object), encode its numeric index.
  15603. buildParams(
  15604. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15605. v,
  15606. traditional,
  15607. add
  15608. );
  15609. }
  15610. } );
  15611. } else if ( !traditional && toType( obj ) === "object" ) {
  15612. // Serialize object item.
  15613. for ( name in obj ) {
  15614. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15615. }
  15616. } else {
  15617. // Serialize scalar item.
  15618. add( prefix, obj );
  15619. }
  15620. }
  15621. // Serialize an array of form elements or a set of
  15622. // key/values into a query string
  15623. jQuery.param = function( a, traditional ) {
  15624. var prefix,
  15625. s = [],
  15626. add = function( key, valueOrFunction ) {
  15627. // If value is a function, invoke it and use its return value
  15628. var value = isFunction( valueOrFunction ) ?
  15629. valueOrFunction() :
  15630. valueOrFunction;
  15631. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15632. encodeURIComponent( value == null ? "" : value );
  15633. };
  15634. if ( a == null ) {
  15635. return "";
  15636. }
  15637. // If an array was passed in, assume that it is an array of form elements.
  15638. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15639. // Serialize the form elements
  15640. jQuery.each( a, function() {
  15641. add( this.name, this.value );
  15642. } );
  15643. } else {
  15644. // If traditional, encode the "old" way (the way 1.3.2 or older
  15645. // did it), otherwise encode params recursively.
  15646. for ( prefix in a ) {
  15647. buildParams( prefix, a[ prefix ], traditional, add );
  15648. }
  15649. }
  15650. // Return the resulting serialization
  15651. return s.join( "&" );
  15652. };
  15653. jQuery.fn.extend( {
  15654. serialize: function() {
  15655. return jQuery.param( this.serializeArray() );
  15656. },
  15657. serializeArray: function() {
  15658. return this.map( function() {
  15659. // Can add propHook for "elements" to filter or add form elements
  15660. var elements = jQuery.prop( this, "elements" );
  15661. return elements ? jQuery.makeArray( elements ) : this;
  15662. } )
  15663. .filter( function() {
  15664. var type = this.type;
  15665. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15666. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15667. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15668. ( this.checked || !rcheckableType.test( type ) );
  15669. } )
  15670. .map( function( i, elem ) {
  15671. var val = jQuery( this ).val();
  15672. if ( val == null ) {
  15673. return null;
  15674. }
  15675. if ( Array.isArray( val ) ) {
  15676. return jQuery.map( val, function( val ) {
  15677. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15678. } );
  15679. }
  15680. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15681. } ).get();
  15682. }
  15683. } );
  15684. var
  15685. r20 = /%20/g,
  15686. rhash = /#.*$/,
  15687. rantiCache = /([?&])_=[^&]*/,
  15688. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15689. // #7653, #8125, #8152: local protocol detection
  15690. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15691. rnoContent = /^(?:GET|HEAD)$/,
  15692. rprotocol = /^\/\//,
  15693. /* Prefilters
  15694. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15695. * 2) These are called:
  15696. * - BEFORE asking for a transport
  15697. * - AFTER param serialization (s.data is a string if s.processData is true)
  15698. * 3) key is the dataType
  15699. * 4) the catchall symbol "*" can be used
  15700. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15701. */
  15702. prefilters = {},
  15703. /* Transports bindings
  15704. * 1) key is the dataType
  15705. * 2) the catchall symbol "*" can be used
  15706. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15707. */
  15708. transports = {},
  15709. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15710. allTypes = "*/".concat( "*" ),
  15711. // Anchor tag for parsing the document origin
  15712. originAnchor = document.createElement( "a" );
  15713. originAnchor.href = location.href;
  15714. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15715. function addToPrefiltersOrTransports( structure ) {
  15716. // dataTypeExpression is optional and defaults to "*"
  15717. return function( dataTypeExpression, func ) {
  15718. if ( typeof dataTypeExpression !== "string" ) {
  15719. func = dataTypeExpression;
  15720. dataTypeExpression = "*";
  15721. }
  15722. var dataType,
  15723. i = 0,
  15724. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15725. if ( isFunction( func ) ) {
  15726. // For each dataType in the dataTypeExpression
  15727. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15728. // Prepend if requested
  15729. if ( dataType[ 0 ] === "+" ) {
  15730. dataType = dataType.slice( 1 ) || "*";
  15731. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15732. // Otherwise append
  15733. } else {
  15734. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15735. }
  15736. }
  15737. }
  15738. };
  15739. }
  15740. // Base inspection function for prefilters and transports
  15741. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15742. var inspected = {},
  15743. seekingTransport = ( structure === transports );
  15744. function inspect( dataType ) {
  15745. var selected;
  15746. inspected[ dataType ] = true;
  15747. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15748. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15749. if ( typeof dataTypeOrTransport === "string" &&
  15750. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15751. options.dataTypes.unshift( dataTypeOrTransport );
  15752. inspect( dataTypeOrTransport );
  15753. return false;
  15754. } else if ( seekingTransport ) {
  15755. return !( selected = dataTypeOrTransport );
  15756. }
  15757. } );
  15758. return selected;
  15759. }
  15760. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15761. }
  15762. // A special extend for ajax options
  15763. // that takes "flat" options (not to be deep extended)
  15764. // Fixes #9887
  15765. function ajaxExtend( target, src ) {
  15766. var key, deep,
  15767. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15768. for ( key in src ) {
  15769. if ( src[ key ] !== undefined ) {
  15770. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15771. }
  15772. }
  15773. if ( deep ) {
  15774. jQuery.extend( true, target, deep );
  15775. }
  15776. return target;
  15777. }
  15778. /* Handles responses to an ajax request:
  15779. * - finds the right dataType (mediates between content-type and expected dataType)
  15780. * - returns the corresponding response
  15781. */
  15782. function ajaxHandleResponses( s, jqXHR, responses ) {
  15783. var ct, type, finalDataType, firstDataType,
  15784. contents = s.contents,
  15785. dataTypes = s.dataTypes;
  15786. // Remove auto dataType and get content-type in the process
  15787. while ( dataTypes[ 0 ] === "*" ) {
  15788. dataTypes.shift();
  15789. if ( ct === undefined ) {
  15790. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15791. }
  15792. }
  15793. // Check if we're dealing with a known content-type
  15794. if ( ct ) {
  15795. for ( type in contents ) {
  15796. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15797. dataTypes.unshift( type );
  15798. break;
  15799. }
  15800. }
  15801. }
  15802. // Check to see if we have a response for the expected dataType
  15803. if ( dataTypes[ 0 ] in responses ) {
  15804. finalDataType = dataTypes[ 0 ];
  15805. } else {
  15806. // Try convertible dataTypes
  15807. for ( type in responses ) {
  15808. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15809. finalDataType = type;
  15810. break;
  15811. }
  15812. if ( !firstDataType ) {
  15813. firstDataType = type;
  15814. }
  15815. }
  15816. // Or just use first one
  15817. finalDataType = finalDataType || firstDataType;
  15818. }
  15819. // If we found a dataType
  15820. // We add the dataType to the list if needed
  15821. // and return the corresponding response
  15822. if ( finalDataType ) {
  15823. if ( finalDataType !== dataTypes[ 0 ] ) {
  15824. dataTypes.unshift( finalDataType );
  15825. }
  15826. return responses[ finalDataType ];
  15827. }
  15828. }
  15829. /* Chain conversions given the request and the original response
  15830. * Also sets the responseXXX fields on the jqXHR instance
  15831. */
  15832. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15833. var conv2, current, conv, tmp, prev,
  15834. converters = {},
  15835. // Work with a copy of dataTypes in case we need to modify it for conversion
  15836. dataTypes = s.dataTypes.slice();
  15837. // Create converters map with lowercased keys
  15838. if ( dataTypes[ 1 ] ) {
  15839. for ( conv in s.converters ) {
  15840. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15841. }
  15842. }
  15843. current = dataTypes.shift();
  15844. // Convert to each sequential dataType
  15845. while ( current ) {
  15846. if ( s.responseFields[ current ] ) {
  15847. jqXHR[ s.responseFields[ current ] ] = response;
  15848. }
  15849. // Apply the dataFilter if provided
  15850. if ( !prev && isSuccess && s.dataFilter ) {
  15851. response = s.dataFilter( response, s.dataType );
  15852. }
  15853. prev = current;
  15854. current = dataTypes.shift();
  15855. if ( current ) {
  15856. // There's only work to do if current dataType is non-auto
  15857. if ( current === "*" ) {
  15858. current = prev;
  15859. // Convert response if prev dataType is non-auto and differs from current
  15860. } else if ( prev !== "*" && prev !== current ) {
  15861. // Seek a direct converter
  15862. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15863. // If none found, seek a pair
  15864. if ( !conv ) {
  15865. for ( conv2 in converters ) {
  15866. // If conv2 outputs current
  15867. tmp = conv2.split( " " );
  15868. if ( tmp[ 1 ] === current ) {
  15869. // If prev can be converted to accepted input
  15870. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15871. converters[ "* " + tmp[ 0 ] ];
  15872. if ( conv ) {
  15873. // Condense equivalence converters
  15874. if ( conv === true ) {
  15875. conv = converters[ conv2 ];
  15876. // Otherwise, insert the intermediate dataType
  15877. } else if ( converters[ conv2 ] !== true ) {
  15878. current = tmp[ 0 ];
  15879. dataTypes.unshift( tmp[ 1 ] );
  15880. }
  15881. break;
  15882. }
  15883. }
  15884. }
  15885. }
  15886. // Apply converter (if not an equivalence)
  15887. if ( conv !== true ) {
  15888. // Unless errors are allowed to bubble, catch and return them
  15889. if ( conv && s.throws ) {
  15890. response = conv( response );
  15891. } else {
  15892. try {
  15893. response = conv( response );
  15894. } catch ( e ) {
  15895. return {
  15896. state: "parsererror",
  15897. error: conv ? e : "No conversion from " + prev + " to " + current
  15898. };
  15899. }
  15900. }
  15901. }
  15902. }
  15903. }
  15904. }
  15905. return { state: "success", data: response };
  15906. }
  15907. jQuery.extend( {
  15908. // Counter for holding the number of active queries
  15909. active: 0,
  15910. // Last-Modified header cache for next request
  15911. lastModified: {},
  15912. etag: {},
  15913. ajaxSettings: {
  15914. url: location.href,
  15915. type: "GET",
  15916. isLocal: rlocalProtocol.test( location.protocol ),
  15917. global: true,
  15918. processData: true,
  15919. async: true,
  15920. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15921. /*
  15922. timeout: 0,
  15923. data: null,
  15924. dataType: null,
  15925. username: null,
  15926. password: null,
  15927. cache: null,
  15928. throws: false,
  15929. traditional: false,
  15930. headers: {},
  15931. */
  15932. accepts: {
  15933. "*": allTypes,
  15934. text: "text/plain",
  15935. html: "text/html",
  15936. xml: "application/xml, text/xml",
  15937. json: "application/json, text/javascript"
  15938. },
  15939. contents: {
  15940. xml: /\bxml\b/,
  15941. html: /\bhtml/,
  15942. json: /\bjson\b/
  15943. },
  15944. responseFields: {
  15945. xml: "responseXML",
  15946. text: "responseText",
  15947. json: "responseJSON"
  15948. },
  15949. // Data converters
  15950. // Keys separate source (or catchall "*") and destination types with a single space
  15951. converters: {
  15952. // Convert anything to text
  15953. "* text": String,
  15954. // Text to html (true = no transformation)
  15955. "text html": true,
  15956. // Evaluate text as a json expression
  15957. "text json": JSON.parse,
  15958. // Parse text as xml
  15959. "text xml": jQuery.parseXML
  15960. },
  15961. // For options that shouldn't be deep extended:
  15962. // you can add your own custom options here if
  15963. // and when you create one that shouldn't be
  15964. // deep extended (see ajaxExtend)
  15965. flatOptions: {
  15966. url: true,
  15967. context: true
  15968. }
  15969. },
  15970. // Creates a full fledged settings object into target
  15971. // with both ajaxSettings and settings fields.
  15972. // If target is omitted, writes into ajaxSettings.
  15973. ajaxSetup: function( target, settings ) {
  15974. return settings ?
  15975. // Building a settings object
  15976. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15977. // Extending ajaxSettings
  15978. ajaxExtend( jQuery.ajaxSettings, target );
  15979. },
  15980. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15981. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15982. // Main method
  15983. ajax: function( url, options ) {
  15984. // If url is an object, simulate pre-1.5 signature
  15985. if ( typeof url === "object" ) {
  15986. options = url;
  15987. url = undefined;
  15988. }
  15989. // Force options to be an object
  15990. options = options || {};
  15991. var transport,
  15992. // URL without anti-cache param
  15993. cacheURL,
  15994. // Response headers
  15995. responseHeadersString,
  15996. responseHeaders,
  15997. // timeout handle
  15998. timeoutTimer,
  15999. // Url cleanup var
  16000. urlAnchor,
  16001. // Request state (becomes false upon send and true upon completion)
  16002. completed,
  16003. // To know if global events are to be dispatched
  16004. fireGlobals,
  16005. // Loop variable
  16006. i,
  16007. // uncached part of the url
  16008. uncached,
  16009. // Create the final options object
  16010. s = jQuery.ajaxSetup( {}, options ),
  16011. // Callbacks context
  16012. callbackContext = s.context || s,
  16013. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16014. globalEventContext = s.context &&
  16015. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16016. jQuery( callbackContext ) :
  16017. jQuery.event,
  16018. // Deferreds
  16019. deferred = jQuery.Deferred(),
  16020. completeDeferred = jQuery.Callbacks( "once memory" ),
  16021. // Status-dependent callbacks
  16022. statusCode = s.statusCode || {},
  16023. // Headers (they are sent all at once)
  16024. requestHeaders = {},
  16025. requestHeadersNames = {},
  16026. // Default abort message
  16027. strAbort = "canceled",
  16028. // Fake xhr
  16029. jqXHR = {
  16030. readyState: 0,
  16031. // Builds headers hashtable if needed
  16032. getResponseHeader: function( key ) {
  16033. var match;
  16034. if ( completed ) {
  16035. if ( !responseHeaders ) {
  16036. responseHeaders = {};
  16037. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16038. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16039. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16040. .concat( match[ 2 ] );
  16041. }
  16042. }
  16043. match = responseHeaders[ key.toLowerCase() + " " ];
  16044. }
  16045. return match == null ? null : match.join( ", " );
  16046. },
  16047. // Raw string
  16048. getAllResponseHeaders: function() {
  16049. return completed ? responseHeadersString : null;
  16050. },
  16051. // Caches the header
  16052. setRequestHeader: function( name, value ) {
  16053. if ( completed == null ) {
  16054. name = requestHeadersNames[ name.toLowerCase() ] =
  16055. requestHeadersNames[ name.toLowerCase() ] || name;
  16056. requestHeaders[ name ] = value;
  16057. }
  16058. return this;
  16059. },
  16060. // Overrides response content-type header
  16061. overrideMimeType: function( type ) {
  16062. if ( completed == null ) {
  16063. s.mimeType = type;
  16064. }
  16065. return this;
  16066. },
  16067. // Status-dependent callbacks
  16068. statusCode: function( map ) {
  16069. var code;
  16070. if ( map ) {
  16071. if ( completed ) {
  16072. // Execute the appropriate callbacks
  16073. jqXHR.always( map[ jqXHR.status ] );
  16074. } else {
  16075. // Lazy-add the new callbacks in a way that preserves old ones
  16076. for ( code in map ) {
  16077. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16078. }
  16079. }
  16080. }
  16081. return this;
  16082. },
  16083. // Cancel the request
  16084. abort: function( statusText ) {
  16085. var finalText = statusText || strAbort;
  16086. if ( transport ) {
  16087. transport.abort( finalText );
  16088. }
  16089. done( 0, finalText );
  16090. return this;
  16091. }
  16092. };
  16093. // Attach deferreds
  16094. deferred.promise( jqXHR );
  16095. // Add protocol if not provided (prefilters might expect it)
  16096. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16097. // We also use the url parameter if available
  16098. s.url = ( ( url || s.url || location.href ) + "" )
  16099. .replace( rprotocol, location.protocol + "//" );
  16100. // Alias method option to type as per ticket #12004
  16101. s.type = options.method || options.type || s.method || s.type;
  16102. // Extract dataTypes list
  16103. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16104. // A cross-domain request is in order when the origin doesn't match the current origin.
  16105. if ( s.crossDomain == null ) {
  16106. urlAnchor = document.createElement( "a" );
  16107. // Support: IE <=8 - 11, Edge 12 - 15
  16108. // IE throws exception on accessing the href property if url is malformed,
  16109. // e.g. http://example.com:80x/
  16110. try {
  16111. urlAnchor.href = s.url;
  16112. // Support: IE <=8 - 11 only
  16113. // Anchor's host property isn't correctly set when s.url is relative
  16114. urlAnchor.href = urlAnchor.href;
  16115. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16116. urlAnchor.protocol + "//" + urlAnchor.host;
  16117. } catch ( e ) {
  16118. // If there is an error parsing the URL, assume it is crossDomain,
  16119. // it can be rejected by the transport if it is invalid
  16120. s.crossDomain = true;
  16121. }
  16122. }
  16123. // Convert data if not already a string
  16124. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16125. s.data = jQuery.param( s.data, s.traditional );
  16126. }
  16127. // Apply prefilters
  16128. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16129. // If request was aborted inside a prefilter, stop there
  16130. if ( completed ) {
  16131. return jqXHR;
  16132. }
  16133. // We can fire global events as of now if asked to
  16134. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16135. fireGlobals = jQuery.event && s.global;
  16136. // Watch for a new set of requests
  16137. if ( fireGlobals && jQuery.active++ === 0 ) {
  16138. jQuery.event.trigger( "ajaxStart" );
  16139. }
  16140. // Uppercase the type
  16141. s.type = s.type.toUpperCase();
  16142. // Determine if request has content
  16143. s.hasContent = !rnoContent.test( s.type );
  16144. // Save the URL in case we're toying with the If-Modified-Since
  16145. // and/or If-None-Match header later on
  16146. // Remove hash to simplify url manipulation
  16147. cacheURL = s.url.replace( rhash, "" );
  16148. // More options handling for requests with no content
  16149. if ( !s.hasContent ) {
  16150. // Remember the hash so we can put it back
  16151. uncached = s.url.slice( cacheURL.length );
  16152. // If data is available and should be processed, append data to url
  16153. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16154. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16155. // #9682: remove data so that it's not used in an eventual retry
  16156. delete s.data;
  16157. }
  16158. // Add or update anti-cache param if needed
  16159. if ( s.cache === false ) {
  16160. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16161. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16162. }
  16163. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16164. s.url = cacheURL + uncached;
  16165. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16166. } else if ( s.data && s.processData &&
  16167. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16168. s.data = s.data.replace( r20, "+" );
  16169. }
  16170. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16171. if ( s.ifModified ) {
  16172. if ( jQuery.lastModified[ cacheURL ] ) {
  16173. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16174. }
  16175. if ( jQuery.etag[ cacheURL ] ) {
  16176. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16177. }
  16178. }
  16179. // Set the correct header, if data is being sent
  16180. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16181. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16182. }
  16183. // Set the Accepts header for the server, depending on the dataType
  16184. jqXHR.setRequestHeader(
  16185. "Accept",
  16186. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16187. s.accepts[ s.dataTypes[ 0 ] ] +
  16188. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16189. s.accepts[ "*" ]
  16190. );
  16191. // Check for headers option
  16192. for ( i in s.headers ) {
  16193. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16194. }
  16195. // Allow custom headers/mimetypes and early abort
  16196. if ( s.beforeSend &&
  16197. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16198. // Abort if not done already and return
  16199. return jqXHR.abort();
  16200. }
  16201. // Aborting is no longer a cancellation
  16202. strAbort = "abort";
  16203. // Install callbacks on deferreds
  16204. completeDeferred.add( s.complete );
  16205. jqXHR.done( s.success );
  16206. jqXHR.fail( s.error );
  16207. // Get transport
  16208. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16209. // If no transport, we auto-abort
  16210. if ( !transport ) {
  16211. done( -1, "No Transport" );
  16212. } else {
  16213. jqXHR.readyState = 1;
  16214. // Send global event
  16215. if ( fireGlobals ) {
  16216. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16217. }
  16218. // If request was aborted inside ajaxSend, stop there
  16219. if ( completed ) {
  16220. return jqXHR;
  16221. }
  16222. // Timeout
  16223. if ( s.async && s.timeout > 0 ) {
  16224. timeoutTimer = window.setTimeout( function() {
  16225. jqXHR.abort( "timeout" );
  16226. }, s.timeout );
  16227. }
  16228. try {
  16229. completed = false;
  16230. transport.send( requestHeaders, done );
  16231. } catch ( e ) {
  16232. // Rethrow post-completion exceptions
  16233. if ( completed ) {
  16234. throw e;
  16235. }
  16236. // Propagate others as results
  16237. done( -1, e );
  16238. }
  16239. }
  16240. // Callback for when everything is done
  16241. function done( status, nativeStatusText, responses, headers ) {
  16242. var isSuccess, success, error, response, modified,
  16243. statusText = nativeStatusText;
  16244. // Ignore repeat invocations
  16245. if ( completed ) {
  16246. return;
  16247. }
  16248. completed = true;
  16249. // Clear timeout if it exists
  16250. if ( timeoutTimer ) {
  16251. window.clearTimeout( timeoutTimer );
  16252. }
  16253. // Dereference transport for early garbage collection
  16254. // (no matter how long the jqXHR object will be used)
  16255. transport = undefined;
  16256. // Cache response headers
  16257. responseHeadersString = headers || "";
  16258. // Set readyState
  16259. jqXHR.readyState = status > 0 ? 4 : 0;
  16260. // Determine if successful
  16261. isSuccess = status >= 200 && status < 300 || status === 304;
  16262. // Get response data
  16263. if ( responses ) {
  16264. response = ajaxHandleResponses( s, jqXHR, responses );
  16265. }
  16266. // Convert no matter what (that way responseXXX fields are always set)
  16267. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16268. // If successful, handle type chaining
  16269. if ( isSuccess ) {
  16270. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16271. if ( s.ifModified ) {
  16272. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16273. if ( modified ) {
  16274. jQuery.lastModified[ cacheURL ] = modified;
  16275. }
  16276. modified = jqXHR.getResponseHeader( "etag" );
  16277. if ( modified ) {
  16278. jQuery.etag[ cacheURL ] = modified;
  16279. }
  16280. }
  16281. // if no content
  16282. if ( status === 204 || s.type === "HEAD" ) {
  16283. statusText = "nocontent";
  16284. // if not modified
  16285. } else if ( status === 304 ) {
  16286. statusText = "notmodified";
  16287. // If we have data, let's convert it
  16288. } else {
  16289. statusText = response.state;
  16290. success = response.data;
  16291. error = response.error;
  16292. isSuccess = !error;
  16293. }
  16294. } else {
  16295. // Extract error from statusText and normalize for non-aborts
  16296. error = statusText;
  16297. if ( status || !statusText ) {
  16298. statusText = "error";
  16299. if ( status < 0 ) {
  16300. status = 0;
  16301. }
  16302. }
  16303. }
  16304. // Set data for the fake xhr object
  16305. jqXHR.status = status;
  16306. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16307. // Success/Error
  16308. if ( isSuccess ) {
  16309. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16310. } else {
  16311. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16312. }
  16313. // Status-dependent callbacks
  16314. jqXHR.statusCode( statusCode );
  16315. statusCode = undefined;
  16316. if ( fireGlobals ) {
  16317. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16318. [ jqXHR, s, isSuccess ? success : error ] );
  16319. }
  16320. // Complete
  16321. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16322. if ( fireGlobals ) {
  16323. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16324. // Handle the global AJAX counter
  16325. if ( !( --jQuery.active ) ) {
  16326. jQuery.event.trigger( "ajaxStop" );
  16327. }
  16328. }
  16329. }
  16330. return jqXHR;
  16331. },
  16332. getJSON: function( url, data, callback ) {
  16333. return jQuery.get( url, data, callback, "json" );
  16334. },
  16335. getScript: function( url, callback ) {
  16336. return jQuery.get( url, undefined, callback, "script" );
  16337. }
  16338. } );
  16339. jQuery.each( [ "get", "post" ], function( i, method ) {
  16340. jQuery[ method ] = function( url, data, callback, type ) {
  16341. // Shift arguments if data argument was omitted
  16342. if ( isFunction( data ) ) {
  16343. type = type || callback;
  16344. callback = data;
  16345. data = undefined;
  16346. }
  16347. // The url can be an options object (which then must have .url)
  16348. return jQuery.ajax( jQuery.extend( {
  16349. url: url,
  16350. type: method,
  16351. dataType: type,
  16352. data: data,
  16353. success: callback
  16354. }, jQuery.isPlainObject( url ) && url ) );
  16355. };
  16356. } );
  16357. jQuery._evalUrl = function( url, options ) {
  16358. return jQuery.ajax( {
  16359. url: url,
  16360. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16361. type: "GET",
  16362. dataType: "script",
  16363. cache: true,
  16364. async: false,
  16365. global: false,
  16366. // Only evaluate the response if it is successful (gh-4126)
  16367. // dataFilter is not invoked for failure responses, so using it instead
  16368. // of the default converter is kludgy but it works.
  16369. converters: {
  16370. "text script": function() {}
  16371. },
  16372. dataFilter: function( response ) {
  16373. jQuery.globalEval( response, options );
  16374. }
  16375. } );
  16376. };
  16377. jQuery.fn.extend( {
  16378. wrapAll: function( html ) {
  16379. var wrap;
  16380. if ( this[ 0 ] ) {
  16381. if ( isFunction( html ) ) {
  16382. html = html.call( this[ 0 ] );
  16383. }
  16384. // The elements to wrap the target around
  16385. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16386. if ( this[ 0 ].parentNode ) {
  16387. wrap.insertBefore( this[ 0 ] );
  16388. }
  16389. wrap.map( function() {
  16390. var elem = this;
  16391. while ( elem.firstElementChild ) {
  16392. elem = elem.firstElementChild;
  16393. }
  16394. return elem;
  16395. } ).append( this );
  16396. }
  16397. return this;
  16398. },
  16399. wrapInner: function( html ) {
  16400. if ( isFunction( html ) ) {
  16401. return this.each( function( i ) {
  16402. jQuery( this ).wrapInner( html.call( this, i ) );
  16403. } );
  16404. }
  16405. return this.each( function() {
  16406. var self = jQuery( this ),
  16407. contents = self.contents();
  16408. if ( contents.length ) {
  16409. contents.wrapAll( html );
  16410. } else {
  16411. self.append( html );
  16412. }
  16413. } );
  16414. },
  16415. wrap: function( html ) {
  16416. var htmlIsFunction = isFunction( html );
  16417. return this.each( function( i ) {
  16418. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16419. } );
  16420. },
  16421. unwrap: function( selector ) {
  16422. this.parent( selector ).not( "body" ).each( function() {
  16423. jQuery( this ).replaceWith( this.childNodes );
  16424. } );
  16425. return this;
  16426. }
  16427. } );
  16428. jQuery.expr.pseudos.hidden = function( elem ) {
  16429. return !jQuery.expr.pseudos.visible( elem );
  16430. };
  16431. jQuery.expr.pseudos.visible = function( elem ) {
  16432. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16433. };
  16434. jQuery.ajaxSettings.xhr = function() {
  16435. try {
  16436. return new window.XMLHttpRequest();
  16437. } catch ( e ) {}
  16438. };
  16439. var xhrSuccessStatus = {
  16440. // File protocol always yields status code 0, assume 200
  16441. 0: 200,
  16442. // Support: IE <=9 only
  16443. // #1450: sometimes IE returns 1223 when it should be 204
  16444. 1223: 204
  16445. },
  16446. xhrSupported = jQuery.ajaxSettings.xhr();
  16447. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16448. support.ajax = xhrSupported = !!xhrSupported;
  16449. jQuery.ajaxTransport( function( options ) {
  16450. var callback, errorCallback;
  16451. // Cross domain only allowed if supported through XMLHttpRequest
  16452. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16453. return {
  16454. send: function( headers, complete ) {
  16455. var i,
  16456. xhr = options.xhr();
  16457. xhr.open(
  16458. options.type,
  16459. options.url,
  16460. options.async,
  16461. options.username,
  16462. options.password
  16463. );
  16464. // Apply custom fields if provided
  16465. if ( options.xhrFields ) {
  16466. for ( i in options.xhrFields ) {
  16467. xhr[ i ] = options.xhrFields[ i ];
  16468. }
  16469. }
  16470. // Override mime type if needed
  16471. if ( options.mimeType && xhr.overrideMimeType ) {
  16472. xhr.overrideMimeType( options.mimeType );
  16473. }
  16474. // X-Requested-With header
  16475. // For cross-domain requests, seeing as conditions for a preflight are
  16476. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16477. // (it can always be set on a per-request basis or even using ajaxSetup)
  16478. // For same-domain requests, won't change header if already provided.
  16479. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16480. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16481. }
  16482. // Set headers
  16483. for ( i in headers ) {
  16484. xhr.setRequestHeader( i, headers[ i ] );
  16485. }
  16486. // Callback
  16487. callback = function( type ) {
  16488. return function() {
  16489. if ( callback ) {
  16490. callback = errorCallback = xhr.onload =
  16491. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16492. xhr.onreadystatechange = null;
  16493. if ( type === "abort" ) {
  16494. xhr.abort();
  16495. } else if ( type === "error" ) {
  16496. // Support: IE <=9 only
  16497. // On a manual native abort, IE9 throws
  16498. // errors on any property access that is not readyState
  16499. if ( typeof xhr.status !== "number" ) {
  16500. complete( 0, "error" );
  16501. } else {
  16502. complete(
  16503. // File: protocol always yields status 0; see #8605, #14207
  16504. xhr.status,
  16505. xhr.statusText
  16506. );
  16507. }
  16508. } else {
  16509. complete(
  16510. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16511. xhr.statusText,
  16512. // Support: IE <=9 only
  16513. // IE9 has no XHR2 but throws on binary (trac-11426)
  16514. // For XHR2 non-text, let the caller handle it (gh-2498)
  16515. ( xhr.responseType || "text" ) !== "text" ||
  16516. typeof xhr.responseText !== "string" ?
  16517. { binary: xhr.response } :
  16518. { text: xhr.responseText },
  16519. xhr.getAllResponseHeaders()
  16520. );
  16521. }
  16522. }
  16523. };
  16524. };
  16525. // Listen to events
  16526. xhr.onload = callback();
  16527. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16528. // Support: IE 9 only
  16529. // Use onreadystatechange to replace onabort
  16530. // to handle uncaught aborts
  16531. if ( xhr.onabort !== undefined ) {
  16532. xhr.onabort = errorCallback;
  16533. } else {
  16534. xhr.onreadystatechange = function() {
  16535. // Check readyState before timeout as it changes
  16536. if ( xhr.readyState === 4 ) {
  16537. // Allow onerror to be called first,
  16538. // but that will not handle a native abort
  16539. // Also, save errorCallback to a variable
  16540. // as xhr.onerror cannot be accessed
  16541. window.setTimeout( function() {
  16542. if ( callback ) {
  16543. errorCallback();
  16544. }
  16545. } );
  16546. }
  16547. };
  16548. }
  16549. // Create the abort callback
  16550. callback = callback( "abort" );
  16551. try {
  16552. // Do send the request (this may raise an exception)
  16553. xhr.send( options.hasContent && options.data || null );
  16554. } catch ( e ) {
  16555. // #14683: Only rethrow if this hasn't been notified as an error yet
  16556. if ( callback ) {
  16557. throw e;
  16558. }
  16559. }
  16560. },
  16561. abort: function() {
  16562. if ( callback ) {
  16563. callback();
  16564. }
  16565. }
  16566. };
  16567. }
  16568. } );
  16569. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16570. jQuery.ajaxPrefilter( function( s ) {
  16571. if ( s.crossDomain ) {
  16572. s.contents.script = false;
  16573. }
  16574. } );
  16575. // Install script dataType
  16576. jQuery.ajaxSetup( {
  16577. accepts: {
  16578. script: "text/javascript, application/javascript, " +
  16579. "application/ecmascript, application/x-ecmascript"
  16580. },
  16581. contents: {
  16582. script: /\b(?:java|ecma)script\b/
  16583. },
  16584. converters: {
  16585. "text script": function( text ) {
  16586. jQuery.globalEval( text );
  16587. return text;
  16588. }
  16589. }
  16590. } );
  16591. // Handle cache's special case and crossDomain
  16592. jQuery.ajaxPrefilter( "script", function( s ) {
  16593. if ( s.cache === undefined ) {
  16594. s.cache = false;
  16595. }
  16596. if ( s.crossDomain ) {
  16597. s.type = "GET";
  16598. }
  16599. } );
  16600. // Bind script tag hack transport
  16601. jQuery.ajaxTransport( "script", function( s ) {
  16602. // This transport only deals with cross domain or forced-by-attrs requests
  16603. if ( s.crossDomain || s.scriptAttrs ) {
  16604. var script, callback;
  16605. return {
  16606. send: function( _, complete ) {
  16607. script = jQuery( "<script>" )
  16608. .attr( s.scriptAttrs || {} )
  16609. .prop( { charset: s.scriptCharset, src: s.url } )
  16610. .on( "load error", callback = function( evt ) {
  16611. script.remove();
  16612. callback = null;
  16613. if ( evt ) {
  16614. complete( evt.type === "error" ? 404 : 200, evt.type );
  16615. }
  16616. } );
  16617. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16618. document.head.appendChild( script[ 0 ] );
  16619. },
  16620. abort: function() {
  16621. if ( callback ) {
  16622. callback();
  16623. }
  16624. }
  16625. };
  16626. }
  16627. } );
  16628. var oldCallbacks = [],
  16629. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16630. // Default jsonp settings
  16631. jQuery.ajaxSetup( {
  16632. jsonp: "callback",
  16633. jsonpCallback: function() {
  16634. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16635. this[ callback ] = true;
  16636. return callback;
  16637. }
  16638. } );
  16639. // Detect, normalize options and install callbacks for jsonp requests
  16640. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16641. var callbackName, overwritten, responseContainer,
  16642. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16643. "url" :
  16644. typeof s.data === "string" &&
  16645. ( s.contentType || "" )
  16646. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16647. rjsonp.test( s.data ) && "data"
  16648. );
  16649. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16650. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16651. // Get callback name, remembering preexisting value associated with it
  16652. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16653. s.jsonpCallback() :
  16654. s.jsonpCallback;
  16655. // Insert callback into url or form data
  16656. if ( jsonProp ) {
  16657. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16658. } else if ( s.jsonp !== false ) {
  16659. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16660. }
  16661. // Use data converter to retrieve json after script execution
  16662. s.converters[ "script json" ] = function() {
  16663. if ( !responseContainer ) {
  16664. jQuery.error( callbackName + " was not called" );
  16665. }
  16666. return responseContainer[ 0 ];
  16667. };
  16668. // Force json dataType
  16669. s.dataTypes[ 0 ] = "json";
  16670. // Install callback
  16671. overwritten = window[ callbackName ];
  16672. window[ callbackName ] = function() {
  16673. responseContainer = arguments;
  16674. };
  16675. // Clean-up function (fires after converters)
  16676. jqXHR.always( function() {
  16677. // If previous value didn't exist - remove it
  16678. if ( overwritten === undefined ) {
  16679. jQuery( window ).removeProp( callbackName );
  16680. // Otherwise restore preexisting value
  16681. } else {
  16682. window[ callbackName ] = overwritten;
  16683. }
  16684. // Save back as free
  16685. if ( s[ callbackName ] ) {
  16686. // Make sure that re-using the options doesn't screw things around
  16687. s.jsonpCallback = originalSettings.jsonpCallback;
  16688. // Save the callback name for future use
  16689. oldCallbacks.push( callbackName );
  16690. }
  16691. // Call if it was a function and we have a response
  16692. if ( responseContainer && isFunction( overwritten ) ) {
  16693. overwritten( responseContainer[ 0 ] );
  16694. }
  16695. responseContainer = overwritten = undefined;
  16696. } );
  16697. // Delegate to script
  16698. return "script";
  16699. }
  16700. } );
  16701. // Support: Safari 8 only
  16702. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16703. // collapse sibling forms: the second one becomes a child of the first one.
  16704. // Because of that, this security measure has to be disabled in Safari 8.
  16705. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16706. support.createHTMLDocument = ( function() {
  16707. var body = document.implementation.createHTMLDocument( "" ).body;
  16708. body.innerHTML = "<form></form><form></form>";
  16709. return body.childNodes.length === 2;
  16710. } )();
  16711. // Argument "data" should be string of html
  16712. // context (optional): If specified, the fragment will be created in this context,
  16713. // defaults to document
  16714. // keepScripts (optional): If true, will include scripts passed in the html string
  16715. jQuery.parseHTML = function( data, context, keepScripts ) {
  16716. if ( typeof data !== "string" ) {
  16717. return [];
  16718. }
  16719. if ( typeof context === "boolean" ) {
  16720. keepScripts = context;
  16721. context = false;
  16722. }
  16723. var base, parsed, scripts;
  16724. if ( !context ) {
  16725. // Stop scripts or inline event handlers from being executed immediately
  16726. // by using document.implementation
  16727. if ( support.createHTMLDocument ) {
  16728. context = document.implementation.createHTMLDocument( "" );
  16729. // Set the base href for the created document
  16730. // so any parsed elements with URLs
  16731. // are based on the document's URL (gh-2965)
  16732. base = context.createElement( "base" );
  16733. base.href = document.location.href;
  16734. context.head.appendChild( base );
  16735. } else {
  16736. context = document;
  16737. }
  16738. }
  16739. parsed = rsingleTag.exec( data );
  16740. scripts = !keepScripts && [];
  16741. // Single tag
  16742. if ( parsed ) {
  16743. return [ context.createElement( parsed[ 1 ] ) ];
  16744. }
  16745. parsed = buildFragment( [ data ], context, scripts );
  16746. if ( scripts && scripts.length ) {
  16747. jQuery( scripts ).remove();
  16748. }
  16749. return jQuery.merge( [], parsed.childNodes );
  16750. };
  16751. /**
  16752. * Load a url into a page
  16753. */
  16754. jQuery.fn.load = function( url, params, callback ) {
  16755. var selector, type, response,
  16756. self = this,
  16757. off = url.indexOf( " " );
  16758. if ( off > -1 ) {
  16759. selector = stripAndCollapse( url.slice( off ) );
  16760. url = url.slice( 0, off );
  16761. }
  16762. // If it's a function
  16763. if ( isFunction( params ) ) {
  16764. // We assume that it's the callback
  16765. callback = params;
  16766. params = undefined;
  16767. // Otherwise, build a param string
  16768. } else if ( params && typeof params === "object" ) {
  16769. type = "POST";
  16770. }
  16771. // If we have elements to modify, make the request
  16772. if ( self.length > 0 ) {
  16773. jQuery.ajax( {
  16774. url: url,
  16775. // If "type" variable is undefined, then "GET" method will be used.
  16776. // Make value of this field explicit since
  16777. // user can override it through ajaxSetup method
  16778. type: type || "GET",
  16779. dataType: "html",
  16780. data: params
  16781. } ).done( function( responseText ) {
  16782. // Save response for use in complete callback
  16783. response = arguments;
  16784. self.html( selector ?
  16785. // If a selector was specified, locate the right elements in a dummy div
  16786. // Exclude scripts to avoid IE 'Permission Denied' errors
  16787. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16788. // Otherwise use the full result
  16789. responseText );
  16790. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16791. // but they are ignored because response was set above.
  16792. // If it fails, this function gets "jqXHR", "status", "error"
  16793. } ).always( callback && function( jqXHR, status ) {
  16794. self.each( function() {
  16795. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16796. } );
  16797. } );
  16798. }
  16799. return this;
  16800. };
  16801. // Attach a bunch of functions for handling common AJAX events
  16802. jQuery.each( [
  16803. "ajaxStart",
  16804. "ajaxStop",
  16805. "ajaxComplete",
  16806. "ajaxError",
  16807. "ajaxSuccess",
  16808. "ajaxSend"
  16809. ], function( i, type ) {
  16810. jQuery.fn[ type ] = function( fn ) {
  16811. return this.on( type, fn );
  16812. };
  16813. } );
  16814. jQuery.expr.pseudos.animated = function( elem ) {
  16815. return jQuery.grep( jQuery.timers, function( fn ) {
  16816. return elem === fn.elem;
  16817. } ).length;
  16818. };
  16819. jQuery.offset = {
  16820. setOffset: function( elem, options, i ) {
  16821. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16822. position = jQuery.css( elem, "position" ),
  16823. curElem = jQuery( elem ),
  16824. props = {};
  16825. // Set position first, in-case top/left are set even on static elem
  16826. if ( position === "static" ) {
  16827. elem.style.position = "relative";
  16828. }
  16829. curOffset = curElem.offset();
  16830. curCSSTop = jQuery.css( elem, "top" );
  16831. curCSSLeft = jQuery.css( elem, "left" );
  16832. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16833. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16834. // Need to be able to calculate position if either
  16835. // top or left is auto and position is either absolute or fixed
  16836. if ( calculatePosition ) {
  16837. curPosition = curElem.position();
  16838. curTop = curPosition.top;
  16839. curLeft = curPosition.left;
  16840. } else {
  16841. curTop = parseFloat( curCSSTop ) || 0;
  16842. curLeft = parseFloat( curCSSLeft ) || 0;
  16843. }
  16844. if ( isFunction( options ) ) {
  16845. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16846. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16847. }
  16848. if ( options.top != null ) {
  16849. props.top = ( options.top - curOffset.top ) + curTop;
  16850. }
  16851. if ( options.left != null ) {
  16852. props.left = ( options.left - curOffset.left ) + curLeft;
  16853. }
  16854. if ( "using" in options ) {
  16855. options.using.call( elem, props );
  16856. } else {
  16857. curElem.css( props );
  16858. }
  16859. }
  16860. };
  16861. jQuery.fn.extend( {
  16862. // offset() relates an element's border box to the document origin
  16863. offset: function( options ) {
  16864. // Preserve chaining for setter
  16865. if ( arguments.length ) {
  16866. return options === undefined ?
  16867. this :
  16868. this.each( function( i ) {
  16869. jQuery.offset.setOffset( this, options, i );
  16870. } );
  16871. }
  16872. var rect, win,
  16873. elem = this[ 0 ];
  16874. if ( !elem ) {
  16875. return;
  16876. }
  16877. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16878. // Support: IE <=11 only
  16879. // Running getBoundingClientRect on a
  16880. // disconnected node in IE throws an error
  16881. if ( !elem.getClientRects().length ) {
  16882. return { top: 0, left: 0 };
  16883. }
  16884. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16885. rect = elem.getBoundingClientRect();
  16886. win = elem.ownerDocument.defaultView;
  16887. return {
  16888. top: rect.top + win.pageYOffset,
  16889. left: rect.left + win.pageXOffset
  16890. };
  16891. },
  16892. // position() relates an element's margin box to its offset parent's padding box
  16893. // This corresponds to the behavior of CSS absolute positioning
  16894. position: function() {
  16895. if ( !this[ 0 ] ) {
  16896. return;
  16897. }
  16898. var offsetParent, offset, doc,
  16899. elem = this[ 0 ],
  16900. parentOffset = { top: 0, left: 0 };
  16901. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16902. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16903. // Assume position:fixed implies availability of getBoundingClientRect
  16904. offset = elem.getBoundingClientRect();
  16905. } else {
  16906. offset = this.offset();
  16907. // Account for the *real* offset parent, which can be the document or its root element
  16908. // when a statically positioned element is identified
  16909. doc = elem.ownerDocument;
  16910. offsetParent = elem.offsetParent || doc.documentElement;
  16911. while ( offsetParent &&
  16912. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16913. jQuery.css( offsetParent, "position" ) === "static" ) {
  16914. offsetParent = offsetParent.parentNode;
  16915. }
  16916. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16917. // Incorporate borders into its offset, since they are outside its content origin
  16918. parentOffset = jQuery( offsetParent ).offset();
  16919. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16920. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16921. }
  16922. }
  16923. // Subtract parent offsets and element margins
  16924. return {
  16925. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16926. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16927. };
  16928. },
  16929. // This method will return documentElement in the following cases:
  16930. // 1) For the element inside the iframe without offsetParent, this method will return
  16931. // documentElement of the parent window
  16932. // 2) For the hidden or detached element
  16933. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16934. //
  16935. // but those exceptions were never presented as a real life use-cases
  16936. // and might be considered as more preferable results.
  16937. //
  16938. // This logic, however, is not guaranteed and can change at any point in the future
  16939. offsetParent: function() {
  16940. return this.map( function() {
  16941. var offsetParent = this.offsetParent;
  16942. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16943. offsetParent = offsetParent.offsetParent;
  16944. }
  16945. return offsetParent || documentElement;
  16946. } );
  16947. }
  16948. } );
  16949. // Create scrollLeft and scrollTop methods
  16950. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16951. var top = "pageYOffset" === prop;
  16952. jQuery.fn[ method ] = function( val ) {
  16953. return access( this, function( elem, method, val ) {
  16954. // Coalesce documents and windows
  16955. var win;
  16956. if ( isWindow( elem ) ) {
  16957. win = elem;
  16958. } else if ( elem.nodeType === 9 ) {
  16959. win = elem.defaultView;
  16960. }
  16961. if ( val === undefined ) {
  16962. return win ? win[ prop ] : elem[ method ];
  16963. }
  16964. if ( win ) {
  16965. win.scrollTo(
  16966. !top ? val : win.pageXOffset,
  16967. top ? val : win.pageYOffset
  16968. );
  16969. } else {
  16970. elem[ method ] = val;
  16971. }
  16972. }, method, val, arguments.length );
  16973. };
  16974. } );
  16975. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16976. // Add the top/left cssHooks using jQuery.fn.position
  16977. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16978. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16979. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16980. // rather than make the css module depend on the offset module, just check for it here
  16981. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16982. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16983. function( elem, computed ) {
  16984. if ( computed ) {
  16985. computed = curCSS( elem, prop );
  16986. // If curCSS returns percentage, fallback to offset
  16987. return rnumnonpx.test( computed ) ?
  16988. jQuery( elem ).position()[ prop ] + "px" :
  16989. computed;
  16990. }
  16991. }
  16992. );
  16993. } );
  16994. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16995. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16996. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16997. function( defaultExtra, funcName ) {
  16998. // Margin is only for outerHeight, outerWidth
  16999. jQuery.fn[ funcName ] = function( margin, value ) {
  17000. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17001. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17002. return access( this, function( elem, type, value ) {
  17003. var doc;
  17004. if ( isWindow( elem ) ) {
  17005. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17006. return funcName.indexOf( "outer" ) === 0 ?
  17007. elem[ "inner" + name ] :
  17008. elem.document.documentElement[ "client" + name ];
  17009. }
  17010. // Get document width or height
  17011. if ( elem.nodeType === 9 ) {
  17012. doc = elem.documentElement;
  17013. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17014. // whichever is greatest
  17015. return Math.max(
  17016. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17017. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17018. doc[ "client" + name ]
  17019. );
  17020. }
  17021. return value === undefined ?
  17022. // Get width or height on the element, requesting but not forcing parseFloat
  17023. jQuery.css( elem, type, extra ) :
  17024. // Set width or height on the element
  17025. jQuery.style( elem, type, value, extra );
  17026. }, type, chainable ? margin : undefined, chainable );
  17027. };
  17028. } );
  17029. } );
  17030. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17031. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17032. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17033. function( i, name ) {
  17034. // Handle event binding
  17035. jQuery.fn[ name ] = function( data, fn ) {
  17036. return arguments.length > 0 ?
  17037. this.on( name, null, data, fn ) :
  17038. this.trigger( name );
  17039. };
  17040. } );
  17041. jQuery.fn.extend( {
  17042. hover: function( fnOver, fnOut ) {
  17043. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17044. }
  17045. } );
  17046. jQuery.fn.extend( {
  17047. bind: function( types, data, fn ) {
  17048. return this.on( types, null, data, fn );
  17049. },
  17050. unbind: function( types, fn ) {
  17051. return this.off( types, null, fn );
  17052. },
  17053. delegate: function( selector, types, data, fn ) {
  17054. return this.on( types, selector, data, fn );
  17055. },
  17056. undelegate: function( selector, types, fn ) {
  17057. // ( namespace ) or ( selector, types [, fn] )
  17058. return arguments.length === 1 ?
  17059. this.off( selector, "**" ) :
  17060. this.off( types, selector || "**", fn );
  17061. }
  17062. } );
  17063. // Bind a function to a context, optionally partially applying any
  17064. // arguments.
  17065. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17066. // However, it is not slated for removal any time soon
  17067. jQuery.proxy = function( fn, context ) {
  17068. var tmp, args, proxy;
  17069. if ( typeof context === "string" ) {
  17070. tmp = fn[ context ];
  17071. context = fn;
  17072. fn = tmp;
  17073. }
  17074. // Quick check to determine if target is callable, in the spec
  17075. // this throws a TypeError, but we will just return undefined.
  17076. if ( !isFunction( fn ) ) {
  17077. return undefined;
  17078. }
  17079. // Simulated bind
  17080. args = slice.call( arguments, 2 );
  17081. proxy = function() {
  17082. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17083. };
  17084. // Set the guid of unique handler to the same of original handler, so it can be removed
  17085. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17086. return proxy;
  17087. };
  17088. jQuery.holdReady = function( hold ) {
  17089. if ( hold ) {
  17090. jQuery.readyWait++;
  17091. } else {
  17092. jQuery.ready( true );
  17093. }
  17094. };
  17095. jQuery.isArray = Array.isArray;
  17096. jQuery.parseJSON = JSON.parse;
  17097. jQuery.nodeName = nodeName;
  17098. jQuery.isFunction = isFunction;
  17099. jQuery.isWindow = isWindow;
  17100. jQuery.camelCase = camelCase;
  17101. jQuery.type = toType;
  17102. jQuery.now = Date.now;
  17103. jQuery.isNumeric = function( obj ) {
  17104. // As of jQuery 3.0, isNumeric is limited to
  17105. // strings and numbers (primitives or objects)
  17106. // that can be coerced to finite numbers (gh-2662)
  17107. var type = jQuery.type( obj );
  17108. return ( type === "number" || type === "string" ) &&
  17109. // parseFloat NaNs numeric-cast false positives ("")
  17110. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17111. // subtraction forces infinities to NaN
  17112. !isNaN( obj - parseFloat( obj ) );
  17113. };
  17114. // Register as a named AMD module, since jQuery can be concatenated with other
  17115. // files that may use define, but not via a proper concatenation script that
  17116. // understands anonymous AMD modules. A named AMD is safest and most robust
  17117. // way to register. Lowercase jquery is used because AMD module names are
  17118. // derived from file names, and jQuery is normally delivered in a lowercase
  17119. // file name. Do this after creating the global so that if an AMD module wants
  17120. // to call noConflict to hide this version of jQuery, it will work.
  17121. // Note that for maximum portability, libraries that are not jQuery should
  17122. // declare themselves as anonymous modules, and avoid setting a global if an
  17123. // AMD loader is present. jQuery is a special case. For more information, see
  17124. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17125. if ( true ) {
  17126. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17127. return jQuery;
  17128. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17129. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17130. }
  17131. var
  17132. // Map over jQuery in case of overwrite
  17133. _jQuery = window.jQuery,
  17134. // Map over the $ in case of overwrite
  17135. _$ = window.$;
  17136. jQuery.noConflict = function( deep ) {
  17137. if ( window.$ === jQuery ) {
  17138. window.$ = _$;
  17139. }
  17140. if ( deep && window.jQuery === jQuery ) {
  17141. window.jQuery = _jQuery;
  17142. }
  17143. return jQuery;
  17144. };
  17145. // Expose jQuery and $ identifiers, even in AMD
  17146. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17147. // and CommonJS for browser emulators (#13566)
  17148. if ( !noGlobal ) {
  17149. window.jQuery = window.$ = jQuery;
  17150. }
  17151. return jQuery;
  17152. } );
  17153. /***/ }),
  17154. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17155. /*!************************************************!*\
  17156. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17157. \************************************************/
  17158. /*! exports provided: default */
  17159. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17160. "use strict";
  17161. __webpack_require__.r(__webpack_exports__);
  17162. var classCallCheck = function (instance, Constructor) {
  17163. if (!(instance instanceof Constructor)) {
  17164. throw new TypeError("Cannot call a class as a function");
  17165. }
  17166. };
  17167. var createClass = function () {
  17168. function defineProperties(target, props) {
  17169. for (var i = 0; i < props.length; i++) {
  17170. var descriptor = props[i];
  17171. descriptor.enumerable = descriptor.enumerable || false;
  17172. descriptor.configurable = true;
  17173. if ("value" in descriptor) descriptor.writable = true;
  17174. Object.defineProperty(target, descriptor.key, descriptor);
  17175. }
  17176. }
  17177. return function (Constructor, protoProps, staticProps) {
  17178. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17179. if (staticProps) defineProperties(Constructor, staticProps);
  17180. return Constructor;
  17181. };
  17182. }();
  17183. var _extends = Object.assign || function (target) {
  17184. for (var i = 1; i < arguments.length; i++) {
  17185. var source = arguments[i];
  17186. for (var key in source) {
  17187. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17188. target[key] = source[key];
  17189. }
  17190. }
  17191. }
  17192. return target;
  17193. };
  17194. var inherits = function (subClass, superClass) {
  17195. if (typeof superClass !== "function" && superClass !== null) {
  17196. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17197. }
  17198. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17199. constructor: {
  17200. value: subClass,
  17201. enumerable: false,
  17202. writable: true,
  17203. configurable: true
  17204. }
  17205. });
  17206. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17207. };
  17208. var possibleConstructorReturn = function (self, call) {
  17209. if (!self) {
  17210. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17211. }
  17212. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17213. };
  17214. var Connector = function () {
  17215. /**
  17216. * Create a new class instance.
  17217. */
  17218. function Connector(options) {
  17219. classCallCheck(this, Connector);
  17220. /**
  17221. * Default connector options.
  17222. */
  17223. this._defaultOptions = {
  17224. auth: {
  17225. headers: {}
  17226. },
  17227. authEndpoint: '/broadcasting/auth',
  17228. broadcaster: 'pusher',
  17229. csrfToken: null,
  17230. host: null,
  17231. key: null,
  17232. namespace: 'App.Events'
  17233. };
  17234. this.setOptions(options);
  17235. this.connect();
  17236. }
  17237. /**
  17238. * Merge the custom options with the defaults.
  17239. */
  17240. createClass(Connector, [{
  17241. key: 'setOptions',
  17242. value: function setOptions(options) {
  17243. this.options = _extends(this._defaultOptions, options);
  17244. if (this.csrfToken()) {
  17245. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17246. }
  17247. return options;
  17248. }
  17249. /**
  17250. * Extract the CSRF token from the page.
  17251. */
  17252. }, {
  17253. key: 'csrfToken',
  17254. value: function csrfToken() {
  17255. var selector = void 0;
  17256. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17257. return window['Laravel'].csrfToken;
  17258. } else if (this.options.csrfToken) {
  17259. return this.options.csrfToken;
  17260. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17261. return selector.getAttribute('content');
  17262. }
  17263. return null;
  17264. }
  17265. }]);
  17266. return Connector;
  17267. }();
  17268. /**
  17269. * This class represents a basic channel.
  17270. */
  17271. var Channel = function () {
  17272. function Channel() {
  17273. classCallCheck(this, Channel);
  17274. }
  17275. createClass(Channel, [{
  17276. key: 'listenForWhisper',
  17277. /**
  17278. * Listen for a whisper event on the channel instance.
  17279. */
  17280. value: function listenForWhisper(event, callback) {
  17281. return this.listen('.client-' + event, callback);
  17282. }
  17283. /**
  17284. * Listen for an event on the channel instance.
  17285. */
  17286. }, {
  17287. key: 'notification',
  17288. value: function notification(callback) {
  17289. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17290. }
  17291. /**
  17292. * Stop listening for a whispser event on the channel instance.
  17293. */
  17294. }, {
  17295. key: 'stopListeningForWhisper',
  17296. value: function stopListeningForWhisper(event) {
  17297. return this.stopListening('.client-' + event);
  17298. }
  17299. }]);
  17300. return Channel;
  17301. }();
  17302. /**
  17303. * Event name formatter
  17304. */
  17305. var EventFormatter = function () {
  17306. /**
  17307. * Create a new class instance.
  17308. */
  17309. function EventFormatter(namespace) {
  17310. classCallCheck(this, EventFormatter);
  17311. this.setNamespace(namespace);
  17312. }
  17313. /**
  17314. * Format the given event name.
  17315. */
  17316. createClass(EventFormatter, [{
  17317. key: 'format',
  17318. value: function format(event) {
  17319. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17320. return event.substr(1);
  17321. } else if (this.namespace) {
  17322. event = this.namespace + '.' + event;
  17323. }
  17324. return event.replace(/\./g, '\\');
  17325. }
  17326. /**
  17327. * Set the event namespace.
  17328. */
  17329. }, {
  17330. key: 'setNamespace',
  17331. value: function setNamespace(value) {
  17332. this.namespace = value;
  17333. }
  17334. }]);
  17335. return EventFormatter;
  17336. }();
  17337. /**
  17338. * This class represents a Pusher channel.
  17339. */
  17340. var PusherChannel = function (_Channel) {
  17341. inherits(PusherChannel, _Channel);
  17342. /**
  17343. * Create a new class instance.
  17344. */
  17345. function PusherChannel(pusher, name, options) {
  17346. classCallCheck(this, PusherChannel);
  17347. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17348. _this.name = name;
  17349. _this.pusher = pusher;
  17350. _this.options = options;
  17351. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17352. _this.subscribe();
  17353. return _this;
  17354. }
  17355. /**
  17356. * Subscribe to a Pusher channel.
  17357. */
  17358. createClass(PusherChannel, [{
  17359. key: 'subscribe',
  17360. value: function subscribe() {
  17361. this.subscription = this.pusher.subscribe(this.name);
  17362. }
  17363. /**
  17364. * Unsubscribe from a Pusher channel.
  17365. */
  17366. }, {
  17367. key: 'unsubscribe',
  17368. value: function unsubscribe() {
  17369. this.pusher.unsubscribe(this.name);
  17370. }
  17371. /**
  17372. * Listen for an event on the channel instance.
  17373. */
  17374. }, {
  17375. key: 'listen',
  17376. value: function listen(event, callback) {
  17377. this.on(this.eventFormatter.format(event), callback);
  17378. return this;
  17379. }
  17380. /**
  17381. * Stop listening for an event on the channel instance.
  17382. */
  17383. }, {
  17384. key: 'stopListening',
  17385. value: function stopListening(event) {
  17386. this.subscription.unbind(this.eventFormatter.format(event));
  17387. return this;
  17388. }
  17389. /**
  17390. * Bind a channel to an event.
  17391. */
  17392. }, {
  17393. key: 'on',
  17394. value: function on(event, callback) {
  17395. this.subscription.bind(event, callback);
  17396. return this;
  17397. }
  17398. }]);
  17399. return PusherChannel;
  17400. }(Channel);
  17401. /**
  17402. * This class represents a Pusher private channel.
  17403. */
  17404. var PusherPrivateChannel = function (_PusherChannel) {
  17405. inherits(PusherPrivateChannel, _PusherChannel);
  17406. function PusherPrivateChannel() {
  17407. classCallCheck(this, PusherPrivateChannel);
  17408. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17409. }
  17410. createClass(PusherPrivateChannel, [{
  17411. key: 'whisper',
  17412. /**
  17413. * Trigger client event on the channel.
  17414. */
  17415. value: function whisper(eventName, data) {
  17416. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17417. return this;
  17418. }
  17419. }]);
  17420. return PusherPrivateChannel;
  17421. }(PusherChannel);
  17422. /**
  17423. * This class represents a Pusher presence channel.
  17424. */
  17425. var PusherPresenceChannel = function (_PusherChannel) {
  17426. inherits(PusherPresenceChannel, _PusherChannel);
  17427. function PusherPresenceChannel() {
  17428. classCallCheck(this, PusherPresenceChannel);
  17429. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17430. }
  17431. createClass(PusherPresenceChannel, [{
  17432. key: 'here',
  17433. /**
  17434. * Register a callback to be called anytime the member list changes.
  17435. */
  17436. value: function here(callback) {
  17437. this.on('pusher:subscription_succeeded', function (data) {
  17438. callback(Object.keys(data.members).map(function (k) {
  17439. return data.members[k];
  17440. }));
  17441. });
  17442. return this;
  17443. }
  17444. /**
  17445. * Listen for someone joining the channel.
  17446. */
  17447. }, {
  17448. key: 'joining',
  17449. value: function joining(callback) {
  17450. this.on('pusher:member_added', function (member) {
  17451. callback(member.info);
  17452. });
  17453. return this;
  17454. }
  17455. /**
  17456. * Listen for someone leaving the channel.
  17457. */
  17458. }, {
  17459. key: 'leaving',
  17460. value: function leaving(callback) {
  17461. this.on('pusher:member_removed', function (member) {
  17462. callback(member.info);
  17463. });
  17464. return this;
  17465. }
  17466. /**
  17467. * Trigger client event on the channel.
  17468. */
  17469. }, {
  17470. key: 'whisper',
  17471. value: function whisper(eventName, data) {
  17472. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17473. return this;
  17474. }
  17475. }]);
  17476. return PusherPresenceChannel;
  17477. }(PusherChannel);
  17478. /**
  17479. * This class represents a Socket.io channel.
  17480. */
  17481. var SocketIoChannel = function (_Channel) {
  17482. inherits(SocketIoChannel, _Channel);
  17483. /**
  17484. * Create a new class instance.
  17485. */
  17486. function SocketIoChannel(socket, name, options) {
  17487. classCallCheck(this, SocketIoChannel);
  17488. /**
  17489. * The event callbacks applied to the channel.
  17490. */
  17491. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17492. _this.events = {};
  17493. _this.name = name;
  17494. _this.socket = socket;
  17495. _this.options = options;
  17496. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17497. _this.subscribe();
  17498. _this.configureReconnector();
  17499. return _this;
  17500. }
  17501. /**
  17502. * Subscribe to a Socket.io channel.
  17503. */
  17504. createClass(SocketIoChannel, [{
  17505. key: 'subscribe',
  17506. value: function subscribe() {
  17507. this.socket.emit('subscribe', {
  17508. channel: this.name,
  17509. auth: this.options.auth || {}
  17510. });
  17511. }
  17512. /**
  17513. * Unsubscribe from channel and ubind event callbacks.
  17514. */
  17515. }, {
  17516. key: 'unsubscribe',
  17517. value: function unsubscribe() {
  17518. this.unbind();
  17519. this.socket.emit('unsubscribe', {
  17520. channel: this.name,
  17521. auth: this.options.auth || {}
  17522. });
  17523. }
  17524. /**
  17525. * Listen for an event on the channel instance.
  17526. */
  17527. }, {
  17528. key: 'listen',
  17529. value: function listen(event, callback) {
  17530. this.on(this.eventFormatter.format(event), callback);
  17531. return this;
  17532. }
  17533. /**
  17534. * Stop listening for an event on the channel instance.
  17535. */
  17536. }, {
  17537. key: 'stopListening',
  17538. value: function stopListening(event) {
  17539. var name = this.eventFormatter.format(event);
  17540. this.socket.removeListener(name);
  17541. delete this.events[name];
  17542. return this;
  17543. }
  17544. /**
  17545. * Bind the channel's socket to an event and store the callback.
  17546. */
  17547. }, {
  17548. key: 'on',
  17549. value: function on(event, callback) {
  17550. var _this2 = this;
  17551. var listener = function listener(channel, data) {
  17552. if (_this2.name == channel) {
  17553. callback(data);
  17554. }
  17555. };
  17556. this.socket.on(event, listener);
  17557. this.bind(event, listener);
  17558. }
  17559. /**
  17560. * Attach a 'reconnect' listener and bind the event.
  17561. */
  17562. }, {
  17563. key: 'configureReconnector',
  17564. value: function configureReconnector() {
  17565. var _this3 = this;
  17566. var listener = function listener() {
  17567. _this3.subscribe();
  17568. };
  17569. this.socket.on('reconnect', listener);
  17570. this.bind('reconnect', listener);
  17571. }
  17572. /**
  17573. * Bind the channel's socket to an event and store the callback.
  17574. */
  17575. }, {
  17576. key: 'bind',
  17577. value: function bind(event, callback) {
  17578. this.events[event] = this.events[event] || [];
  17579. this.events[event].push(callback);
  17580. }
  17581. /**
  17582. * Unbind the channel's socket from all stored event callbacks.
  17583. */
  17584. }, {
  17585. key: 'unbind',
  17586. value: function unbind() {
  17587. var _this4 = this;
  17588. Object.keys(this.events).forEach(function (event) {
  17589. _this4.events[event].forEach(function (callback) {
  17590. _this4.socket.removeListener(event, callback);
  17591. });
  17592. delete _this4.events[event];
  17593. });
  17594. }
  17595. }]);
  17596. return SocketIoChannel;
  17597. }(Channel);
  17598. /**
  17599. * This class represents a Socket.io presence channel.
  17600. */
  17601. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17602. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17603. function SocketIoPrivateChannel() {
  17604. classCallCheck(this, SocketIoPrivateChannel);
  17605. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17606. }
  17607. createClass(SocketIoPrivateChannel, [{
  17608. key: 'whisper',
  17609. /**
  17610. * Trigger client event on the channel.
  17611. */
  17612. value: function whisper(eventName, data) {
  17613. this.socket.emit('client event', {
  17614. channel: this.name,
  17615. event: 'client-' + eventName,
  17616. data: data
  17617. });
  17618. return this;
  17619. }
  17620. }]);
  17621. return SocketIoPrivateChannel;
  17622. }(SocketIoChannel);
  17623. /**
  17624. * This class represents a Socket.io presence channel.
  17625. */
  17626. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17627. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17628. function SocketIoPresenceChannel() {
  17629. classCallCheck(this, SocketIoPresenceChannel);
  17630. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17631. }
  17632. createClass(SocketIoPresenceChannel, [{
  17633. key: 'here',
  17634. /**
  17635. * Register a callback to be called anytime the member list changes.
  17636. */
  17637. value: function here(callback) {
  17638. this.on('presence:subscribed', function (members) {
  17639. callback(members.map(function (m) {
  17640. return m.user_info;
  17641. }));
  17642. });
  17643. return this;
  17644. }
  17645. /**
  17646. * Listen for someone joining the channel.
  17647. */
  17648. }, {
  17649. key: 'joining',
  17650. value: function joining(callback) {
  17651. this.on('presence:joining', function (member) {
  17652. return callback(member.user_info);
  17653. });
  17654. return this;
  17655. }
  17656. /**
  17657. * Listen for someone leaving the channel.
  17658. */
  17659. }, {
  17660. key: 'leaving',
  17661. value: function leaving(callback) {
  17662. this.on('presence:leaving', function (member) {
  17663. return callback(member.user_info);
  17664. });
  17665. return this;
  17666. }
  17667. }]);
  17668. return SocketIoPresenceChannel;
  17669. }(SocketIoPrivateChannel);
  17670. /**
  17671. * This class represents a null channel.
  17672. */
  17673. var NullChannel = function (_Channel) {
  17674. inherits(NullChannel, _Channel);
  17675. function NullChannel() {
  17676. classCallCheck(this, NullChannel);
  17677. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17678. }
  17679. createClass(NullChannel, [{
  17680. key: 'subscribe',
  17681. /**
  17682. * Subscribe to a channel.
  17683. */
  17684. value: function subscribe() {}
  17685. //
  17686. /**
  17687. * Unsubscribe from a channel.
  17688. */
  17689. }, {
  17690. key: 'unsubscribe',
  17691. value: function unsubscribe() {}
  17692. //
  17693. /**
  17694. * Listen for an event on the channel instance.
  17695. */
  17696. }, {
  17697. key: 'listen',
  17698. value: function listen(event, callback) {
  17699. return this;
  17700. }
  17701. /**
  17702. * Stop listening for an event on the channel instance.
  17703. */
  17704. }, {
  17705. key: 'stopListening',
  17706. value: function stopListening(event) {
  17707. return this;
  17708. }
  17709. /**
  17710. * Bind a channel to an event.
  17711. */
  17712. }, {
  17713. key: 'on',
  17714. value: function on(event, callback) {
  17715. return this;
  17716. }
  17717. }]);
  17718. return NullChannel;
  17719. }(Channel);
  17720. /**
  17721. * This class represents a null private channel.
  17722. */
  17723. var NullPrivateChannel = function (_NullChannel) {
  17724. inherits(NullPrivateChannel, _NullChannel);
  17725. function NullPrivateChannel() {
  17726. classCallCheck(this, NullPrivateChannel);
  17727. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17728. }
  17729. createClass(NullPrivateChannel, [{
  17730. key: 'whisper',
  17731. /**
  17732. * Trigger client event on the channel.
  17733. */
  17734. value: function whisper(eventName, data) {
  17735. return this;
  17736. }
  17737. }]);
  17738. return NullPrivateChannel;
  17739. }(NullChannel);
  17740. /**
  17741. * This class represents a null presence channel.
  17742. */
  17743. var NullPresenceChannel = function (_NullChannel) {
  17744. inherits(NullPresenceChannel, _NullChannel);
  17745. function NullPresenceChannel() {
  17746. classCallCheck(this, NullPresenceChannel);
  17747. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17748. }
  17749. createClass(NullPresenceChannel, [{
  17750. key: 'here',
  17751. /**
  17752. * Register a callback to be called anytime the member list changes.
  17753. */
  17754. value: function here(callback) {
  17755. return this;
  17756. }
  17757. /**
  17758. * Listen for someone joining the channel.
  17759. */
  17760. }, {
  17761. key: 'joining',
  17762. value: function joining(callback) {
  17763. return this;
  17764. }
  17765. /**
  17766. * Listen for someone leaving the channel.
  17767. */
  17768. }, {
  17769. key: 'leaving',
  17770. value: function leaving(callback) {
  17771. return this;
  17772. }
  17773. /**
  17774. * Trigger client event on the channel.
  17775. */
  17776. }, {
  17777. key: 'whisper',
  17778. value: function whisper(eventName, data) {
  17779. return this;
  17780. }
  17781. }]);
  17782. return NullPresenceChannel;
  17783. }(NullChannel);
  17784. /**
  17785. * This class creates a connector to Pusher.
  17786. */
  17787. var PusherConnector = function (_Connector) {
  17788. inherits(PusherConnector, _Connector);
  17789. function PusherConnector() {
  17790. classCallCheck(this, PusherConnector);
  17791. /**
  17792. * All of the subscribed channel names.
  17793. */
  17794. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17795. _this.channels = {};
  17796. return _this;
  17797. }
  17798. /**
  17799. * Create a fresh Pusher connection.
  17800. */
  17801. createClass(PusherConnector, [{
  17802. key: 'connect',
  17803. value: function connect() {
  17804. if (typeof this.options.client !== 'undefined') {
  17805. this.pusher = this.options.client;
  17806. } else {
  17807. this.pusher = new Pusher(this.options.key, this.options);
  17808. }
  17809. }
  17810. /**
  17811. * Listen for an event on a channel instance.
  17812. */
  17813. }, {
  17814. key: 'listen',
  17815. value: function listen(name, event, callback) {
  17816. return this.channel(name).listen(event, callback);
  17817. }
  17818. /**
  17819. * Get a channel instance by name.
  17820. */
  17821. }, {
  17822. key: 'channel',
  17823. value: function channel(name) {
  17824. if (!this.channels[name]) {
  17825. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17826. }
  17827. return this.channels[name];
  17828. }
  17829. /**
  17830. * Get a private channel instance by name.
  17831. */
  17832. }, {
  17833. key: 'privateChannel',
  17834. value: function privateChannel(name) {
  17835. if (!this.channels['private-' + name]) {
  17836. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17837. }
  17838. return this.channels['private-' + name];
  17839. }
  17840. /**
  17841. * Get a presence channel instance by name.
  17842. */
  17843. }, {
  17844. key: 'presenceChannel',
  17845. value: function presenceChannel(name) {
  17846. if (!this.channels['presence-' + name]) {
  17847. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17848. }
  17849. return this.channels['presence-' + name];
  17850. }
  17851. /**
  17852. * Leave the given channel, as well as its private and presence variants.
  17853. */
  17854. }, {
  17855. key: 'leave',
  17856. value: function leave(name) {
  17857. var _this2 = this;
  17858. var channels = [name, 'private-' + name, 'presence-' + name];
  17859. channels.forEach(function (name, index) {
  17860. _this2.leaveChannel(name);
  17861. });
  17862. }
  17863. /**
  17864. * Leave the given channel.
  17865. */
  17866. }, {
  17867. key: 'leaveChannel',
  17868. value: function leaveChannel(name) {
  17869. if (this.channels[name]) {
  17870. this.channels[name].unsubscribe();
  17871. delete this.channels[name];
  17872. }
  17873. }
  17874. /**
  17875. * Get the socket ID for the connection.
  17876. */
  17877. }, {
  17878. key: 'socketId',
  17879. value: function socketId() {
  17880. return this.pusher.connection.socket_id;
  17881. }
  17882. /**
  17883. * Disconnect Pusher connection.
  17884. */
  17885. }, {
  17886. key: 'disconnect',
  17887. value: function disconnect() {
  17888. this.pusher.disconnect();
  17889. }
  17890. }]);
  17891. return PusherConnector;
  17892. }(Connector);
  17893. /**
  17894. * This class creates a connnector to a Socket.io server.
  17895. */
  17896. var SocketIoConnector = function (_Connector) {
  17897. inherits(SocketIoConnector, _Connector);
  17898. function SocketIoConnector() {
  17899. classCallCheck(this, SocketIoConnector);
  17900. /**
  17901. * All of the subscribed channel names.
  17902. */
  17903. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17904. _this.channels = {};
  17905. return _this;
  17906. }
  17907. /**
  17908. * Create a fresh Socket.io connection.
  17909. */
  17910. createClass(SocketIoConnector, [{
  17911. key: 'connect',
  17912. value: function connect() {
  17913. var io = this.getSocketIO();
  17914. this.socket = io(this.options.host, this.options);
  17915. return this.socket;
  17916. }
  17917. /**
  17918. * Get socket.io module from global scope or options.
  17919. */
  17920. }, {
  17921. key: 'getSocketIO',
  17922. value: function getSocketIO() {
  17923. if (typeof this.options.client !== 'undefined') {
  17924. return this.options.client;
  17925. }
  17926. if (typeof io !== 'undefined') {
  17927. return io;
  17928. }
  17929. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17930. }
  17931. /**
  17932. * Listen for an event on a channel instance.
  17933. */
  17934. }, {
  17935. key: 'listen',
  17936. value: function listen(name, event, callback) {
  17937. return this.channel(name).listen(event, callback);
  17938. }
  17939. /**
  17940. * Get a channel instance by name.
  17941. */
  17942. }, {
  17943. key: 'channel',
  17944. value: function channel(name) {
  17945. if (!this.channels[name]) {
  17946. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17947. }
  17948. return this.channels[name];
  17949. }
  17950. /**
  17951. * Get a private channel instance by name.
  17952. */
  17953. }, {
  17954. key: 'privateChannel',
  17955. value: function privateChannel(name) {
  17956. if (!this.channels['private-' + name]) {
  17957. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17958. }
  17959. return this.channels['private-' + name];
  17960. }
  17961. /**
  17962. * Get a presence channel instance by name.
  17963. */
  17964. }, {
  17965. key: 'presenceChannel',
  17966. value: function presenceChannel(name) {
  17967. if (!this.channels['presence-' + name]) {
  17968. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17969. }
  17970. return this.channels['presence-' + name];
  17971. }
  17972. /**
  17973. * Leave the given channel, as well as its private and presence variants.
  17974. */
  17975. }, {
  17976. key: 'leave',
  17977. value: function leave(name) {
  17978. var _this2 = this;
  17979. var channels = [name, 'private-' + name, 'presence-' + name];
  17980. channels.forEach(function (name) {
  17981. _this2.leaveChannel(name);
  17982. });
  17983. }
  17984. /**
  17985. * Leave the given channel.
  17986. */
  17987. }, {
  17988. key: 'leaveChannel',
  17989. value: function leaveChannel(name) {
  17990. if (this.channels[name]) {
  17991. this.channels[name].unsubscribe();
  17992. delete this.channels[name];
  17993. }
  17994. }
  17995. /**
  17996. * Get the socket ID for the connection.
  17997. */
  17998. }, {
  17999. key: 'socketId',
  18000. value: function socketId() {
  18001. return this.socket.id;
  18002. }
  18003. /**
  18004. * Disconnect Socketio connection.
  18005. */
  18006. }, {
  18007. key: 'disconnect',
  18008. value: function disconnect() {
  18009. this.socket.disconnect();
  18010. }
  18011. }]);
  18012. return SocketIoConnector;
  18013. }(Connector);
  18014. /**
  18015. * This class creates a null connector.
  18016. */
  18017. var NullConnector = function (_Connector) {
  18018. inherits(NullConnector, _Connector);
  18019. function NullConnector() {
  18020. classCallCheck(this, NullConnector);
  18021. /**
  18022. * All of the subscribed channel names.
  18023. */
  18024. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18025. _this.channels = {};
  18026. return _this;
  18027. }
  18028. /**
  18029. * Create a fresh connection.
  18030. */
  18031. createClass(NullConnector, [{
  18032. key: 'connect',
  18033. value: function connect() {}
  18034. //
  18035. /**
  18036. * Listen for an event on a channel instance.
  18037. */
  18038. }, {
  18039. key: 'listen',
  18040. value: function listen(name, event, callback) {
  18041. return new NullChannel();
  18042. }
  18043. /**
  18044. * Get a channel instance by name.
  18045. */
  18046. }, {
  18047. key: 'channel',
  18048. value: function channel(name) {
  18049. return new NullChannel();
  18050. }
  18051. /**
  18052. * Get a private channel instance by name.
  18053. */
  18054. }, {
  18055. key: 'privateChannel',
  18056. value: function privateChannel(name) {
  18057. return new NullPrivateChannel();
  18058. }
  18059. /**
  18060. * Get a presence channel instance by name.
  18061. */
  18062. }, {
  18063. key: 'presenceChannel',
  18064. value: function presenceChannel(name) {
  18065. return new NullPresenceChannel();
  18066. }
  18067. /**
  18068. * Leave the given channel, as well as its private and presence variants.
  18069. */
  18070. }, {
  18071. key: 'leave',
  18072. value: function leave(name) {}
  18073. //
  18074. /**
  18075. * Leave the given channel.
  18076. */
  18077. }, {
  18078. key: 'leaveChannel',
  18079. value: function leaveChannel(name) {}
  18080. //
  18081. /**
  18082. * Get the socket ID for the connection.
  18083. */
  18084. }, {
  18085. key: 'socketId',
  18086. value: function socketId() {
  18087. return 'fake-socket-id';
  18088. }
  18089. /**
  18090. * Disconnect the connection.
  18091. */
  18092. }, {
  18093. key: 'disconnect',
  18094. value: function disconnect() {
  18095. //
  18096. }
  18097. }]);
  18098. return NullConnector;
  18099. }(Connector);
  18100. /**
  18101. * This class is the primary API for interacting with broadcasting.
  18102. */
  18103. var Echo = function () {
  18104. /**
  18105. * Create a new class instance.
  18106. */
  18107. function Echo(options) {
  18108. classCallCheck(this, Echo);
  18109. this.options = options;
  18110. this.connect();
  18111. if (!this.options.withoutInterceptors) {
  18112. this.registerInterceptors();
  18113. }
  18114. }
  18115. /**
  18116. * Get a channel instance by name.
  18117. */
  18118. createClass(Echo, [{
  18119. key: 'channel',
  18120. value: function channel(_channel) {
  18121. return this.connector.channel(_channel);
  18122. }
  18123. /**
  18124. * Create a new connection.
  18125. */
  18126. }, {
  18127. key: 'connect',
  18128. value: function connect() {
  18129. if (this.options.broadcaster == 'pusher') {
  18130. this.connector = new PusherConnector(this.options);
  18131. } else if (this.options.broadcaster == 'socket.io') {
  18132. this.connector = new SocketIoConnector(this.options);
  18133. } else if (this.options.broadcaster == 'null') {
  18134. this.connector = new NullConnector(this.options);
  18135. } else if (typeof this.options.broadcaster == 'function') {
  18136. this.connector = new this.options.broadcaster(this.options);
  18137. }
  18138. }
  18139. /**
  18140. * Disconnect from the Echo server.
  18141. */
  18142. }, {
  18143. key: 'disconnect',
  18144. value: function disconnect() {
  18145. this.connector.disconnect();
  18146. }
  18147. /**
  18148. * Get a presence channel instance by name.
  18149. */
  18150. }, {
  18151. key: 'join',
  18152. value: function join(channel) {
  18153. return this.connector.presenceChannel(channel);
  18154. }
  18155. /**
  18156. * Leave the given channel, as well as its private and presence variants.
  18157. */
  18158. }, {
  18159. key: 'leave',
  18160. value: function leave(channel) {
  18161. this.connector.leave(channel);
  18162. }
  18163. /**
  18164. * Leave the given channel.
  18165. */
  18166. }, {
  18167. key: 'leaveChannel',
  18168. value: function leaveChannel(channel) {
  18169. this.connector.leaveChannel(channel);
  18170. }
  18171. /**
  18172. * Listen for an event on a channel instance.
  18173. */
  18174. }, {
  18175. key: 'listen',
  18176. value: function listen(channel, event, callback) {
  18177. return this.connector.listen(channel, event, callback);
  18178. }
  18179. /**
  18180. * Get a private channel instance by name.
  18181. */
  18182. }, {
  18183. key: 'private',
  18184. value: function _private(channel) {
  18185. return this.connector.privateChannel(channel);
  18186. }
  18187. /**
  18188. * Get the Socket ID for the connection.
  18189. */
  18190. }, {
  18191. key: 'socketId',
  18192. value: function socketId() {
  18193. return this.connector.socketId();
  18194. }
  18195. /**
  18196. * Register 3rd party request interceptiors. These are used to automatically
  18197. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18198. */
  18199. }, {
  18200. key: 'registerInterceptors',
  18201. value: function registerInterceptors() {
  18202. if (typeof Vue === 'function' && Vue.http) {
  18203. this.registerVueRequestInterceptor();
  18204. }
  18205. if (typeof axios === 'function') {
  18206. this.registerAxiosRequestInterceptor();
  18207. }
  18208. if (typeof jQuery === 'function') {
  18209. this.registerjQueryAjaxSetup();
  18210. }
  18211. }
  18212. /**
  18213. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18214. */
  18215. }, {
  18216. key: 'registerVueRequestInterceptor',
  18217. value: function registerVueRequestInterceptor() {
  18218. var _this = this;
  18219. Vue.http.interceptors.push(function (request, next) {
  18220. if (_this.socketId()) {
  18221. request.headers.set('X-Socket-ID', _this.socketId());
  18222. }
  18223. next();
  18224. });
  18225. }
  18226. /**
  18227. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18228. */
  18229. }, {
  18230. key: 'registerAxiosRequestInterceptor',
  18231. value: function registerAxiosRequestInterceptor() {
  18232. var _this2 = this;
  18233. axios.interceptors.request.use(function (config) {
  18234. if (_this2.socketId()) {
  18235. config.headers['X-Socket-Id'] = _this2.socketId();
  18236. }
  18237. return config;
  18238. });
  18239. }
  18240. /**
  18241. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18242. */
  18243. }, {
  18244. key: 'registerjQueryAjaxSetup',
  18245. value: function registerjQueryAjaxSetup() {
  18246. var _this3 = this;
  18247. if (typeof jQuery.ajax != 'undefined') {
  18248. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18249. if (_this3.socketId()) {
  18250. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18251. }
  18252. });
  18253. }
  18254. }
  18255. }]);
  18256. return Echo;
  18257. }();
  18258. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18259. /***/ }),
  18260. /***/ "./node_modules/lodash/lodash.js":
  18261. /*!***************************************!*\
  18262. !*** ./node_modules/lodash/lodash.js ***!
  18263. \***************************************/
  18264. /*! no static exports found */
  18265. /***/ (function(module, exports, __webpack_require__) {
  18266. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18267. * @license
  18268. * Lodash <https://lodash.com/>
  18269. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18270. * Released under MIT license <https://lodash.com/license>
  18271. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18272. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18273. */
  18274. ;(function() {
  18275. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18276. var undefined;
  18277. /** Used as the semantic version number. */
  18278. var VERSION = '4.17.15';
  18279. /** Used as the size to enable large array optimizations. */
  18280. var LARGE_ARRAY_SIZE = 200;
  18281. /** Error message constants. */
  18282. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18283. FUNC_ERROR_TEXT = 'Expected a function';
  18284. /** Used to stand-in for `undefined` hash values. */
  18285. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18286. /** Used as the maximum memoize cache size. */
  18287. var MAX_MEMOIZE_SIZE = 500;
  18288. /** Used as the internal argument placeholder. */
  18289. var PLACEHOLDER = '__lodash_placeholder__';
  18290. /** Used to compose bitmasks for cloning. */
  18291. var CLONE_DEEP_FLAG = 1,
  18292. CLONE_FLAT_FLAG = 2,
  18293. CLONE_SYMBOLS_FLAG = 4;
  18294. /** Used to compose bitmasks for value comparisons. */
  18295. var COMPARE_PARTIAL_FLAG = 1,
  18296. COMPARE_UNORDERED_FLAG = 2;
  18297. /** Used to compose bitmasks for function metadata. */
  18298. var WRAP_BIND_FLAG = 1,
  18299. WRAP_BIND_KEY_FLAG = 2,
  18300. WRAP_CURRY_BOUND_FLAG = 4,
  18301. WRAP_CURRY_FLAG = 8,
  18302. WRAP_CURRY_RIGHT_FLAG = 16,
  18303. WRAP_PARTIAL_FLAG = 32,
  18304. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18305. WRAP_ARY_FLAG = 128,
  18306. WRAP_REARG_FLAG = 256,
  18307. WRAP_FLIP_FLAG = 512;
  18308. /** Used as default options for `_.truncate`. */
  18309. var DEFAULT_TRUNC_LENGTH = 30,
  18310. DEFAULT_TRUNC_OMISSION = '...';
  18311. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18312. var HOT_COUNT = 800,
  18313. HOT_SPAN = 16;
  18314. /** Used to indicate the type of lazy iteratees. */
  18315. var LAZY_FILTER_FLAG = 1,
  18316. LAZY_MAP_FLAG = 2,
  18317. LAZY_WHILE_FLAG = 3;
  18318. /** Used as references for various `Number` constants. */
  18319. var INFINITY = 1 / 0,
  18320. MAX_SAFE_INTEGER = 9007199254740991,
  18321. MAX_INTEGER = 1.7976931348623157e+308,
  18322. NAN = 0 / 0;
  18323. /** Used as references for the maximum length and index of an array. */
  18324. var MAX_ARRAY_LENGTH = 4294967295,
  18325. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18326. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18327. /** Used to associate wrap methods with their bit flags. */
  18328. var wrapFlags = [
  18329. ['ary', WRAP_ARY_FLAG],
  18330. ['bind', WRAP_BIND_FLAG],
  18331. ['bindKey', WRAP_BIND_KEY_FLAG],
  18332. ['curry', WRAP_CURRY_FLAG],
  18333. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18334. ['flip', WRAP_FLIP_FLAG],
  18335. ['partial', WRAP_PARTIAL_FLAG],
  18336. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18337. ['rearg', WRAP_REARG_FLAG]
  18338. ];
  18339. /** `Object#toString` result references. */
  18340. var argsTag = '[object Arguments]',
  18341. arrayTag = '[object Array]',
  18342. asyncTag = '[object AsyncFunction]',
  18343. boolTag = '[object Boolean]',
  18344. dateTag = '[object Date]',
  18345. domExcTag = '[object DOMException]',
  18346. errorTag = '[object Error]',
  18347. funcTag = '[object Function]',
  18348. genTag = '[object GeneratorFunction]',
  18349. mapTag = '[object Map]',
  18350. numberTag = '[object Number]',
  18351. nullTag = '[object Null]',
  18352. objectTag = '[object Object]',
  18353. promiseTag = '[object Promise]',
  18354. proxyTag = '[object Proxy]',
  18355. regexpTag = '[object RegExp]',
  18356. setTag = '[object Set]',
  18357. stringTag = '[object String]',
  18358. symbolTag = '[object Symbol]',
  18359. undefinedTag = '[object Undefined]',
  18360. weakMapTag = '[object WeakMap]',
  18361. weakSetTag = '[object WeakSet]';
  18362. var arrayBufferTag = '[object ArrayBuffer]',
  18363. dataViewTag = '[object DataView]',
  18364. float32Tag = '[object Float32Array]',
  18365. float64Tag = '[object Float64Array]',
  18366. int8Tag = '[object Int8Array]',
  18367. int16Tag = '[object Int16Array]',
  18368. int32Tag = '[object Int32Array]',
  18369. uint8Tag = '[object Uint8Array]',
  18370. uint8ClampedTag = '[object Uint8ClampedArray]',
  18371. uint16Tag = '[object Uint16Array]',
  18372. uint32Tag = '[object Uint32Array]';
  18373. /** Used to match empty string literals in compiled template source. */
  18374. var reEmptyStringLeading = /\b__p \+= '';/g,
  18375. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18376. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18377. /** Used to match HTML entities and HTML characters. */
  18378. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18379. reUnescapedHtml = /[&<>"']/g,
  18380. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18381. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18382. /** Used to match template delimiters. */
  18383. var reEscape = /<%-([\s\S]+?)%>/g,
  18384. reEvaluate = /<%([\s\S]+?)%>/g,
  18385. reInterpolate = /<%=([\s\S]+?)%>/g;
  18386. /** Used to match property names within property paths. */
  18387. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18388. reIsPlainProp = /^\w*$/,
  18389. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18390. /**
  18391. * Used to match `RegExp`
  18392. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18393. */
  18394. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18395. reHasRegExpChar = RegExp(reRegExpChar.source);
  18396. /** Used to match leading and trailing whitespace. */
  18397. var reTrim = /^\s+|\s+$/g,
  18398. reTrimStart = /^\s+/,
  18399. reTrimEnd = /\s+$/;
  18400. /** Used to match wrap detail comments. */
  18401. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18402. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18403. reSplitDetails = /,? & /;
  18404. /** Used to match words composed of alphanumeric characters. */
  18405. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18406. /** Used to match backslashes in property paths. */
  18407. var reEscapeChar = /\\(\\)?/g;
  18408. /**
  18409. * Used to match
  18410. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18411. */
  18412. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18413. /** Used to match `RegExp` flags from their coerced string values. */
  18414. var reFlags = /\w*$/;
  18415. /** Used to detect bad signed hexadecimal string values. */
  18416. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18417. /** Used to detect binary string values. */
  18418. var reIsBinary = /^0b[01]+$/i;
  18419. /** Used to detect host constructors (Safari). */
  18420. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18421. /** Used to detect octal string values. */
  18422. var reIsOctal = /^0o[0-7]+$/i;
  18423. /** Used to detect unsigned integer values. */
  18424. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18425. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18426. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18427. /** Used to ensure capturing order of template delimiters. */
  18428. var reNoMatch = /($^)/;
  18429. /** Used to match unescaped characters in compiled string literals. */
  18430. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18431. /** Used to compose unicode character classes. */
  18432. var rsAstralRange = '\\ud800-\\udfff',
  18433. rsComboMarksRange = '\\u0300-\\u036f',
  18434. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18435. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18436. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18437. rsDingbatRange = '\\u2700-\\u27bf',
  18438. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18439. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18440. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18441. rsPunctuationRange = '\\u2000-\\u206f',
  18442. 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',
  18443. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18444. rsVarRange = '\\ufe0e\\ufe0f',
  18445. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18446. /** Used to compose unicode capture groups. */
  18447. var rsApos = "['\u2019]",
  18448. rsAstral = '[' + rsAstralRange + ']',
  18449. rsBreak = '[' + rsBreakRange + ']',
  18450. rsCombo = '[' + rsComboRange + ']',
  18451. rsDigits = '\\d+',
  18452. rsDingbat = '[' + rsDingbatRange + ']',
  18453. rsLower = '[' + rsLowerRange + ']',
  18454. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18455. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18456. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18457. rsNonAstral = '[^' + rsAstralRange + ']',
  18458. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18459. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18460. rsUpper = '[' + rsUpperRange + ']',
  18461. rsZWJ = '\\u200d';
  18462. /** Used to compose unicode regexes. */
  18463. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18464. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18465. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18466. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18467. reOptMod = rsModifier + '?',
  18468. rsOptVar = '[' + rsVarRange + ']?',
  18469. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18470. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18471. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18472. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18473. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18474. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18475. /** Used to match apostrophes. */
  18476. var reApos = RegExp(rsApos, 'g');
  18477. /**
  18478. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18479. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18480. */
  18481. var reComboMark = RegExp(rsCombo, 'g');
  18482. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18483. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18484. /** Used to match complex or compound words. */
  18485. var reUnicodeWord = RegExp([
  18486. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18487. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18488. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18489. rsUpper + '+' + rsOptContrUpper,
  18490. rsOrdUpper,
  18491. rsOrdLower,
  18492. rsDigits,
  18493. rsEmoji
  18494. ].join('|'), 'g');
  18495. /** 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/). */
  18496. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18497. /** Used to detect strings that need a more robust regexp to match words. */
  18498. 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 ]/;
  18499. /** Used to assign default `context` object properties. */
  18500. var contextProps = [
  18501. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18502. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18503. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18504. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18505. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18506. ];
  18507. /** Used to make template sourceURLs easier to identify. */
  18508. var templateCounter = -1;
  18509. /** Used to identify `toStringTag` values of typed arrays. */
  18510. var typedArrayTags = {};
  18511. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18512. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18513. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18514. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18515. typedArrayTags[uint32Tag] = true;
  18516. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18517. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18518. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18519. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18520. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18521. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18522. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18523. typedArrayTags[weakMapTag] = false;
  18524. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18525. var cloneableTags = {};
  18526. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18527. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18528. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18529. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18530. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18531. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18532. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18533. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18534. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18535. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18536. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18537. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18538. cloneableTags[weakMapTag] = false;
  18539. /** Used to map Latin Unicode letters to basic Latin letters. */
  18540. var deburredLetters = {
  18541. // Latin-1 Supplement block.
  18542. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18543. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18544. '\xc7': 'C', '\xe7': 'c',
  18545. '\xd0': 'D', '\xf0': 'd',
  18546. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18547. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18548. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18549. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18550. '\xd1': 'N', '\xf1': 'n',
  18551. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18552. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18553. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18554. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18555. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18556. '\xc6': 'Ae', '\xe6': 'ae',
  18557. '\xde': 'Th', '\xfe': 'th',
  18558. '\xdf': 'ss',
  18559. // Latin Extended-A block.
  18560. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18561. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18562. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18563. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18564. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18565. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18566. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18567. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18568. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18569. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18570. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18571. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18572. '\u0134': 'J', '\u0135': 'j',
  18573. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18574. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18575. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18576. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18577. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18578. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18579. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18580. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18581. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18582. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18583. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18584. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18585. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18586. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18587. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18588. '\u0174': 'W', '\u0175': 'w',
  18589. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18590. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18591. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18592. '\u0132': 'IJ', '\u0133': 'ij',
  18593. '\u0152': 'Oe', '\u0153': 'oe',
  18594. '\u0149': "'n", '\u017f': 's'
  18595. };
  18596. /** Used to map characters to HTML entities. */
  18597. var htmlEscapes = {
  18598. '&': '&amp;',
  18599. '<': '&lt;',
  18600. '>': '&gt;',
  18601. '"': '&quot;',
  18602. "'": '&#39;'
  18603. };
  18604. /** Used to map HTML entities to characters. */
  18605. var htmlUnescapes = {
  18606. '&amp;': '&',
  18607. '&lt;': '<',
  18608. '&gt;': '>',
  18609. '&quot;': '"',
  18610. '&#39;': "'"
  18611. };
  18612. /** Used to escape characters for inclusion in compiled string literals. */
  18613. var stringEscapes = {
  18614. '\\': '\\',
  18615. "'": "'",
  18616. '\n': 'n',
  18617. '\r': 'r',
  18618. '\u2028': 'u2028',
  18619. '\u2029': 'u2029'
  18620. };
  18621. /** Built-in method references without a dependency on `root`. */
  18622. var freeParseFloat = parseFloat,
  18623. freeParseInt = parseInt;
  18624. /** Detect free variable `global` from Node.js. */
  18625. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18626. /** Detect free variable `self`. */
  18627. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18628. /** Used as a reference to the global object. */
  18629. var root = freeGlobal || freeSelf || Function('return this')();
  18630. /** Detect free variable `exports`. */
  18631. var freeExports = true && exports && !exports.nodeType && exports;
  18632. /** Detect free variable `module`. */
  18633. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18634. /** Detect the popular CommonJS extension `module.exports`. */
  18635. var moduleExports = freeModule && freeModule.exports === freeExports;
  18636. /** Detect free variable `process` from Node.js. */
  18637. var freeProcess = moduleExports && freeGlobal.process;
  18638. /** Used to access faster Node.js helpers. */
  18639. var nodeUtil = (function() {
  18640. try {
  18641. // Use `util.types` for Node.js 10+.
  18642. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18643. if (types) {
  18644. return types;
  18645. }
  18646. // Legacy `process.binding('util')` for Node.js < 10.
  18647. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18648. } catch (e) {}
  18649. }());
  18650. /* Node.js helper references. */
  18651. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18652. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18653. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18654. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18655. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18656. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18657. /*--------------------------------------------------------------------------*/
  18658. /**
  18659. * A faster alternative to `Function#apply`, this function invokes `func`
  18660. * with the `this` binding of `thisArg` and the arguments of `args`.
  18661. *
  18662. * @private
  18663. * @param {Function} func The function to invoke.
  18664. * @param {*} thisArg The `this` binding of `func`.
  18665. * @param {Array} args The arguments to invoke `func` with.
  18666. * @returns {*} Returns the result of `func`.
  18667. */
  18668. function apply(func, thisArg, args) {
  18669. switch (args.length) {
  18670. case 0: return func.call(thisArg);
  18671. case 1: return func.call(thisArg, args[0]);
  18672. case 2: return func.call(thisArg, args[0], args[1]);
  18673. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18674. }
  18675. return func.apply(thisArg, args);
  18676. }
  18677. /**
  18678. * A specialized version of `baseAggregator` for arrays.
  18679. *
  18680. * @private
  18681. * @param {Array} [array] The array to iterate over.
  18682. * @param {Function} setter The function to set `accumulator` values.
  18683. * @param {Function} iteratee The iteratee to transform keys.
  18684. * @param {Object} accumulator The initial aggregated object.
  18685. * @returns {Function} Returns `accumulator`.
  18686. */
  18687. function arrayAggregator(array, setter, iteratee, accumulator) {
  18688. var index = -1,
  18689. length = array == null ? 0 : array.length;
  18690. while (++index < length) {
  18691. var value = array[index];
  18692. setter(accumulator, value, iteratee(value), array);
  18693. }
  18694. return accumulator;
  18695. }
  18696. /**
  18697. * A specialized version of `_.forEach` for arrays without support for
  18698. * iteratee shorthands.
  18699. *
  18700. * @private
  18701. * @param {Array} [array] The array to iterate over.
  18702. * @param {Function} iteratee The function invoked per iteration.
  18703. * @returns {Array} Returns `array`.
  18704. */
  18705. function arrayEach(array, iteratee) {
  18706. var index = -1,
  18707. length = array == null ? 0 : array.length;
  18708. while (++index < length) {
  18709. if (iteratee(array[index], index, array) === false) {
  18710. break;
  18711. }
  18712. }
  18713. return array;
  18714. }
  18715. /**
  18716. * A specialized version of `_.forEachRight` for arrays without support for
  18717. * iteratee shorthands.
  18718. *
  18719. * @private
  18720. * @param {Array} [array] The array to iterate over.
  18721. * @param {Function} iteratee The function invoked per iteration.
  18722. * @returns {Array} Returns `array`.
  18723. */
  18724. function arrayEachRight(array, iteratee) {
  18725. var length = array == null ? 0 : array.length;
  18726. while (length--) {
  18727. if (iteratee(array[length], length, array) === false) {
  18728. break;
  18729. }
  18730. }
  18731. return array;
  18732. }
  18733. /**
  18734. * A specialized version of `_.every` for arrays without support for
  18735. * iteratee shorthands.
  18736. *
  18737. * @private
  18738. * @param {Array} [array] The array to iterate over.
  18739. * @param {Function} predicate The function invoked per iteration.
  18740. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18741. * else `false`.
  18742. */
  18743. function arrayEvery(array, predicate) {
  18744. var index = -1,
  18745. length = array == null ? 0 : array.length;
  18746. while (++index < length) {
  18747. if (!predicate(array[index], index, array)) {
  18748. return false;
  18749. }
  18750. }
  18751. return true;
  18752. }
  18753. /**
  18754. * A specialized version of `_.filter` for arrays without support for
  18755. * iteratee shorthands.
  18756. *
  18757. * @private
  18758. * @param {Array} [array] The array to iterate over.
  18759. * @param {Function} predicate The function invoked per iteration.
  18760. * @returns {Array} Returns the new filtered array.
  18761. */
  18762. function arrayFilter(array, predicate) {
  18763. var index = -1,
  18764. length = array == null ? 0 : array.length,
  18765. resIndex = 0,
  18766. result = [];
  18767. while (++index < length) {
  18768. var value = array[index];
  18769. if (predicate(value, index, array)) {
  18770. result[resIndex++] = value;
  18771. }
  18772. }
  18773. return result;
  18774. }
  18775. /**
  18776. * A specialized version of `_.includes` for arrays without support for
  18777. * specifying an index to search from.
  18778. *
  18779. * @private
  18780. * @param {Array} [array] The array to inspect.
  18781. * @param {*} target The value to search for.
  18782. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18783. */
  18784. function arrayIncludes(array, value) {
  18785. var length = array == null ? 0 : array.length;
  18786. return !!length && baseIndexOf(array, value, 0) > -1;
  18787. }
  18788. /**
  18789. * This function is like `arrayIncludes` except that it accepts a comparator.
  18790. *
  18791. * @private
  18792. * @param {Array} [array] The array to inspect.
  18793. * @param {*} target The value to search for.
  18794. * @param {Function} comparator The comparator invoked per element.
  18795. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18796. */
  18797. function arrayIncludesWith(array, value, comparator) {
  18798. var index = -1,
  18799. length = array == null ? 0 : array.length;
  18800. while (++index < length) {
  18801. if (comparator(value, array[index])) {
  18802. return true;
  18803. }
  18804. }
  18805. return false;
  18806. }
  18807. /**
  18808. * A specialized version of `_.map` for arrays without support for iteratee
  18809. * shorthands.
  18810. *
  18811. * @private
  18812. * @param {Array} [array] The array to iterate over.
  18813. * @param {Function} iteratee The function invoked per iteration.
  18814. * @returns {Array} Returns the new mapped array.
  18815. */
  18816. function arrayMap(array, iteratee) {
  18817. var index = -1,
  18818. length = array == null ? 0 : array.length,
  18819. result = Array(length);
  18820. while (++index < length) {
  18821. result[index] = iteratee(array[index], index, array);
  18822. }
  18823. return result;
  18824. }
  18825. /**
  18826. * Appends the elements of `values` to `array`.
  18827. *
  18828. * @private
  18829. * @param {Array} array The array to modify.
  18830. * @param {Array} values The values to append.
  18831. * @returns {Array} Returns `array`.
  18832. */
  18833. function arrayPush(array, values) {
  18834. var index = -1,
  18835. length = values.length,
  18836. offset = array.length;
  18837. while (++index < length) {
  18838. array[offset + index] = values[index];
  18839. }
  18840. return array;
  18841. }
  18842. /**
  18843. * A specialized version of `_.reduce` for arrays without support for
  18844. * iteratee shorthands.
  18845. *
  18846. * @private
  18847. * @param {Array} [array] The array to iterate over.
  18848. * @param {Function} iteratee The function invoked per iteration.
  18849. * @param {*} [accumulator] The initial value.
  18850. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18851. * the initial value.
  18852. * @returns {*} Returns the accumulated value.
  18853. */
  18854. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18855. var index = -1,
  18856. length = array == null ? 0 : array.length;
  18857. if (initAccum && length) {
  18858. accumulator = array[++index];
  18859. }
  18860. while (++index < length) {
  18861. accumulator = iteratee(accumulator, array[index], index, array);
  18862. }
  18863. return accumulator;
  18864. }
  18865. /**
  18866. * A specialized version of `_.reduceRight` for arrays without support for
  18867. * iteratee shorthands.
  18868. *
  18869. * @private
  18870. * @param {Array} [array] The array to iterate over.
  18871. * @param {Function} iteratee The function invoked per iteration.
  18872. * @param {*} [accumulator] The initial value.
  18873. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18874. * the initial value.
  18875. * @returns {*} Returns the accumulated value.
  18876. */
  18877. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18878. var length = array == null ? 0 : array.length;
  18879. if (initAccum && length) {
  18880. accumulator = array[--length];
  18881. }
  18882. while (length--) {
  18883. accumulator = iteratee(accumulator, array[length], length, array);
  18884. }
  18885. return accumulator;
  18886. }
  18887. /**
  18888. * A specialized version of `_.some` for arrays without support for iteratee
  18889. * shorthands.
  18890. *
  18891. * @private
  18892. * @param {Array} [array] The array to iterate over.
  18893. * @param {Function} predicate The function invoked per iteration.
  18894. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18895. * else `false`.
  18896. */
  18897. function arraySome(array, predicate) {
  18898. var index = -1,
  18899. length = array == null ? 0 : array.length;
  18900. while (++index < length) {
  18901. if (predicate(array[index], index, array)) {
  18902. return true;
  18903. }
  18904. }
  18905. return false;
  18906. }
  18907. /**
  18908. * Gets the size of an ASCII `string`.
  18909. *
  18910. * @private
  18911. * @param {string} string The string inspect.
  18912. * @returns {number} Returns the string size.
  18913. */
  18914. var asciiSize = baseProperty('length');
  18915. /**
  18916. * Converts an ASCII `string` to an array.
  18917. *
  18918. * @private
  18919. * @param {string} string The string to convert.
  18920. * @returns {Array} Returns the converted array.
  18921. */
  18922. function asciiToArray(string) {
  18923. return string.split('');
  18924. }
  18925. /**
  18926. * Splits an ASCII `string` into an array of its words.
  18927. *
  18928. * @private
  18929. * @param {string} The string to inspect.
  18930. * @returns {Array} Returns the words of `string`.
  18931. */
  18932. function asciiWords(string) {
  18933. return string.match(reAsciiWord) || [];
  18934. }
  18935. /**
  18936. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18937. * without support for iteratee shorthands, which iterates over `collection`
  18938. * using `eachFunc`.
  18939. *
  18940. * @private
  18941. * @param {Array|Object} collection The collection to inspect.
  18942. * @param {Function} predicate The function invoked per iteration.
  18943. * @param {Function} eachFunc The function to iterate over `collection`.
  18944. * @returns {*} Returns the found element or its key, else `undefined`.
  18945. */
  18946. function baseFindKey(collection, predicate, eachFunc) {
  18947. var result;
  18948. eachFunc(collection, function(value, key, collection) {
  18949. if (predicate(value, key, collection)) {
  18950. result = key;
  18951. return false;
  18952. }
  18953. });
  18954. return result;
  18955. }
  18956. /**
  18957. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18958. * support for iteratee shorthands.
  18959. *
  18960. * @private
  18961. * @param {Array} array The array to inspect.
  18962. * @param {Function} predicate The function invoked per iteration.
  18963. * @param {number} fromIndex The index to search from.
  18964. * @param {boolean} [fromRight] Specify iterating from right to left.
  18965. * @returns {number} Returns the index of the matched value, else `-1`.
  18966. */
  18967. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18968. var length = array.length,
  18969. index = fromIndex + (fromRight ? 1 : -1);
  18970. while ((fromRight ? index-- : ++index < length)) {
  18971. if (predicate(array[index], index, array)) {
  18972. return index;
  18973. }
  18974. }
  18975. return -1;
  18976. }
  18977. /**
  18978. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18979. *
  18980. * @private
  18981. * @param {Array} array The array to inspect.
  18982. * @param {*} value The value to search for.
  18983. * @param {number} fromIndex The index to search from.
  18984. * @returns {number} Returns the index of the matched value, else `-1`.
  18985. */
  18986. function baseIndexOf(array, value, fromIndex) {
  18987. return value === value
  18988. ? strictIndexOf(array, value, fromIndex)
  18989. : baseFindIndex(array, baseIsNaN, fromIndex);
  18990. }
  18991. /**
  18992. * This function is like `baseIndexOf` except that it accepts a comparator.
  18993. *
  18994. * @private
  18995. * @param {Array} array The array to inspect.
  18996. * @param {*} value The value to search for.
  18997. * @param {number} fromIndex The index to search from.
  18998. * @param {Function} comparator The comparator invoked per element.
  18999. * @returns {number} Returns the index of the matched value, else `-1`.
  19000. */
  19001. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19002. var index = fromIndex - 1,
  19003. length = array.length;
  19004. while (++index < length) {
  19005. if (comparator(array[index], value)) {
  19006. return index;
  19007. }
  19008. }
  19009. return -1;
  19010. }
  19011. /**
  19012. * The base implementation of `_.isNaN` without support for number objects.
  19013. *
  19014. * @private
  19015. * @param {*} value The value to check.
  19016. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19017. */
  19018. function baseIsNaN(value) {
  19019. return value !== value;
  19020. }
  19021. /**
  19022. * The base implementation of `_.mean` and `_.meanBy` without support for
  19023. * iteratee shorthands.
  19024. *
  19025. * @private
  19026. * @param {Array} array The array to iterate over.
  19027. * @param {Function} iteratee The function invoked per iteration.
  19028. * @returns {number} Returns the mean.
  19029. */
  19030. function baseMean(array, iteratee) {
  19031. var length = array == null ? 0 : array.length;
  19032. return length ? (baseSum(array, iteratee) / length) : NAN;
  19033. }
  19034. /**
  19035. * The base implementation of `_.property` without support for deep paths.
  19036. *
  19037. * @private
  19038. * @param {string} key The key of the property to get.
  19039. * @returns {Function} Returns the new accessor function.
  19040. */
  19041. function baseProperty(key) {
  19042. return function(object) {
  19043. return object == null ? undefined : object[key];
  19044. };
  19045. }
  19046. /**
  19047. * The base implementation of `_.propertyOf` without support for deep paths.
  19048. *
  19049. * @private
  19050. * @param {Object} object The object to query.
  19051. * @returns {Function} Returns the new accessor function.
  19052. */
  19053. function basePropertyOf(object) {
  19054. return function(key) {
  19055. return object == null ? undefined : object[key];
  19056. };
  19057. }
  19058. /**
  19059. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19060. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19061. *
  19062. * @private
  19063. * @param {Array|Object} collection The collection to iterate over.
  19064. * @param {Function} iteratee The function invoked per iteration.
  19065. * @param {*} accumulator The initial value.
  19066. * @param {boolean} initAccum Specify using the first or last element of
  19067. * `collection` as the initial value.
  19068. * @param {Function} eachFunc The function to iterate over `collection`.
  19069. * @returns {*} Returns the accumulated value.
  19070. */
  19071. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19072. eachFunc(collection, function(value, index, collection) {
  19073. accumulator = initAccum
  19074. ? (initAccum = false, value)
  19075. : iteratee(accumulator, value, index, collection);
  19076. });
  19077. return accumulator;
  19078. }
  19079. /**
  19080. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19081. * sort order of `array` and replaces criteria objects with their corresponding
  19082. * values.
  19083. *
  19084. * @private
  19085. * @param {Array} array The array to sort.
  19086. * @param {Function} comparer The function to define sort order.
  19087. * @returns {Array} Returns `array`.
  19088. */
  19089. function baseSortBy(array, comparer) {
  19090. var length = array.length;
  19091. array.sort(comparer);
  19092. while (length--) {
  19093. array[length] = array[length].value;
  19094. }
  19095. return array;
  19096. }
  19097. /**
  19098. * The base implementation of `_.sum` and `_.sumBy` without support for
  19099. * iteratee shorthands.
  19100. *
  19101. * @private
  19102. * @param {Array} array The array to iterate over.
  19103. * @param {Function} iteratee The function invoked per iteration.
  19104. * @returns {number} Returns the sum.
  19105. */
  19106. function baseSum(array, iteratee) {
  19107. var result,
  19108. index = -1,
  19109. length = array.length;
  19110. while (++index < length) {
  19111. var current = iteratee(array[index]);
  19112. if (current !== undefined) {
  19113. result = result === undefined ? current : (result + current);
  19114. }
  19115. }
  19116. return result;
  19117. }
  19118. /**
  19119. * The base implementation of `_.times` without support for iteratee shorthands
  19120. * or max array length checks.
  19121. *
  19122. * @private
  19123. * @param {number} n The number of times to invoke `iteratee`.
  19124. * @param {Function} iteratee The function invoked per iteration.
  19125. * @returns {Array} Returns the array of results.
  19126. */
  19127. function baseTimes(n, iteratee) {
  19128. var index = -1,
  19129. result = Array(n);
  19130. while (++index < n) {
  19131. result[index] = iteratee(index);
  19132. }
  19133. return result;
  19134. }
  19135. /**
  19136. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19137. * of key-value pairs for `object` corresponding to the property names of `props`.
  19138. *
  19139. * @private
  19140. * @param {Object} object The object to query.
  19141. * @param {Array} props The property names to get values for.
  19142. * @returns {Object} Returns the key-value pairs.
  19143. */
  19144. function baseToPairs(object, props) {
  19145. return arrayMap(props, function(key) {
  19146. return [key, object[key]];
  19147. });
  19148. }
  19149. /**
  19150. * The base implementation of `_.unary` without support for storing metadata.
  19151. *
  19152. * @private
  19153. * @param {Function} func The function to cap arguments for.
  19154. * @returns {Function} Returns the new capped function.
  19155. */
  19156. function baseUnary(func) {
  19157. return function(value) {
  19158. return func(value);
  19159. };
  19160. }
  19161. /**
  19162. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19163. * array of `object` property values corresponding to the property names
  19164. * of `props`.
  19165. *
  19166. * @private
  19167. * @param {Object} object The object to query.
  19168. * @param {Array} props The property names to get values for.
  19169. * @returns {Object} Returns the array of property values.
  19170. */
  19171. function baseValues(object, props) {
  19172. return arrayMap(props, function(key) {
  19173. return object[key];
  19174. });
  19175. }
  19176. /**
  19177. * Checks if a `cache` value for `key` exists.
  19178. *
  19179. * @private
  19180. * @param {Object} cache The cache to query.
  19181. * @param {string} key The key of the entry to check.
  19182. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19183. */
  19184. function cacheHas(cache, key) {
  19185. return cache.has(key);
  19186. }
  19187. /**
  19188. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19189. * that is not found in the character symbols.
  19190. *
  19191. * @private
  19192. * @param {Array} strSymbols The string symbols to inspect.
  19193. * @param {Array} chrSymbols The character symbols to find.
  19194. * @returns {number} Returns the index of the first unmatched string symbol.
  19195. */
  19196. function charsStartIndex(strSymbols, chrSymbols) {
  19197. var index = -1,
  19198. length = strSymbols.length;
  19199. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19200. return index;
  19201. }
  19202. /**
  19203. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19204. * that is not found in the character symbols.
  19205. *
  19206. * @private
  19207. * @param {Array} strSymbols The string symbols to inspect.
  19208. * @param {Array} chrSymbols The character symbols to find.
  19209. * @returns {number} Returns the index of the last unmatched string symbol.
  19210. */
  19211. function charsEndIndex(strSymbols, chrSymbols) {
  19212. var index = strSymbols.length;
  19213. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19214. return index;
  19215. }
  19216. /**
  19217. * Gets the number of `placeholder` occurrences in `array`.
  19218. *
  19219. * @private
  19220. * @param {Array} array The array to inspect.
  19221. * @param {*} placeholder The placeholder to search for.
  19222. * @returns {number} Returns the placeholder count.
  19223. */
  19224. function countHolders(array, placeholder) {
  19225. var length = array.length,
  19226. result = 0;
  19227. while (length--) {
  19228. if (array[length] === placeholder) {
  19229. ++result;
  19230. }
  19231. }
  19232. return result;
  19233. }
  19234. /**
  19235. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19236. * letters to basic Latin letters.
  19237. *
  19238. * @private
  19239. * @param {string} letter The matched letter to deburr.
  19240. * @returns {string} Returns the deburred letter.
  19241. */
  19242. var deburrLetter = basePropertyOf(deburredLetters);
  19243. /**
  19244. * Used by `_.escape` to convert characters to HTML entities.
  19245. *
  19246. * @private
  19247. * @param {string} chr The matched character to escape.
  19248. * @returns {string} Returns the escaped character.
  19249. */
  19250. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19251. /**
  19252. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19253. *
  19254. * @private
  19255. * @param {string} chr The matched character to escape.
  19256. * @returns {string} Returns the escaped character.
  19257. */
  19258. function escapeStringChar(chr) {
  19259. return '\\' + stringEscapes[chr];
  19260. }
  19261. /**
  19262. * Gets the value at `key` of `object`.
  19263. *
  19264. * @private
  19265. * @param {Object} [object] The object to query.
  19266. * @param {string} key The key of the property to get.
  19267. * @returns {*} Returns the property value.
  19268. */
  19269. function getValue(object, key) {
  19270. return object == null ? undefined : object[key];
  19271. }
  19272. /**
  19273. * Checks if `string` contains Unicode symbols.
  19274. *
  19275. * @private
  19276. * @param {string} string The string to inspect.
  19277. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19278. */
  19279. function hasUnicode(string) {
  19280. return reHasUnicode.test(string);
  19281. }
  19282. /**
  19283. * Checks if `string` contains a word composed of Unicode symbols.
  19284. *
  19285. * @private
  19286. * @param {string} string The string to inspect.
  19287. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19288. */
  19289. function hasUnicodeWord(string) {
  19290. return reHasUnicodeWord.test(string);
  19291. }
  19292. /**
  19293. * Converts `iterator` to an array.
  19294. *
  19295. * @private
  19296. * @param {Object} iterator The iterator to convert.
  19297. * @returns {Array} Returns the converted array.
  19298. */
  19299. function iteratorToArray(iterator) {
  19300. var data,
  19301. result = [];
  19302. while (!(data = iterator.next()).done) {
  19303. result.push(data.value);
  19304. }
  19305. return result;
  19306. }
  19307. /**
  19308. * Converts `map` to its key-value pairs.
  19309. *
  19310. * @private
  19311. * @param {Object} map The map to convert.
  19312. * @returns {Array} Returns the key-value pairs.
  19313. */
  19314. function mapToArray(map) {
  19315. var index = -1,
  19316. result = Array(map.size);
  19317. map.forEach(function(value, key) {
  19318. result[++index] = [key, value];
  19319. });
  19320. return result;
  19321. }
  19322. /**
  19323. * Creates a unary function that invokes `func` with its argument transformed.
  19324. *
  19325. * @private
  19326. * @param {Function} func The function to wrap.
  19327. * @param {Function} transform The argument transform.
  19328. * @returns {Function} Returns the new function.
  19329. */
  19330. function overArg(func, transform) {
  19331. return function(arg) {
  19332. return func(transform(arg));
  19333. };
  19334. }
  19335. /**
  19336. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19337. * and returns an array of their indexes.
  19338. *
  19339. * @private
  19340. * @param {Array} array The array to modify.
  19341. * @param {*} placeholder The placeholder to replace.
  19342. * @returns {Array} Returns the new array of placeholder indexes.
  19343. */
  19344. function replaceHolders(array, placeholder) {
  19345. var index = -1,
  19346. length = array.length,
  19347. resIndex = 0,
  19348. result = [];
  19349. while (++index < length) {
  19350. var value = array[index];
  19351. if (value === placeholder || value === PLACEHOLDER) {
  19352. array[index] = PLACEHOLDER;
  19353. result[resIndex++] = index;
  19354. }
  19355. }
  19356. return result;
  19357. }
  19358. /**
  19359. * Converts `set` to an array of its values.
  19360. *
  19361. * @private
  19362. * @param {Object} set The set to convert.
  19363. * @returns {Array} Returns the values.
  19364. */
  19365. function setToArray(set) {
  19366. var index = -1,
  19367. result = Array(set.size);
  19368. set.forEach(function(value) {
  19369. result[++index] = value;
  19370. });
  19371. return result;
  19372. }
  19373. /**
  19374. * Converts `set` to its value-value pairs.
  19375. *
  19376. * @private
  19377. * @param {Object} set The set to convert.
  19378. * @returns {Array} Returns the value-value pairs.
  19379. */
  19380. function setToPairs(set) {
  19381. var index = -1,
  19382. result = Array(set.size);
  19383. set.forEach(function(value) {
  19384. result[++index] = [value, value];
  19385. });
  19386. return result;
  19387. }
  19388. /**
  19389. * A specialized version of `_.indexOf` which performs strict equality
  19390. * comparisons of values, i.e. `===`.
  19391. *
  19392. * @private
  19393. * @param {Array} array The array to inspect.
  19394. * @param {*} value The value to search for.
  19395. * @param {number} fromIndex The index to search from.
  19396. * @returns {number} Returns the index of the matched value, else `-1`.
  19397. */
  19398. function strictIndexOf(array, value, fromIndex) {
  19399. var index = fromIndex - 1,
  19400. length = array.length;
  19401. while (++index < length) {
  19402. if (array[index] === value) {
  19403. return index;
  19404. }
  19405. }
  19406. return -1;
  19407. }
  19408. /**
  19409. * A specialized version of `_.lastIndexOf` which performs strict equality
  19410. * comparisons of values, i.e. `===`.
  19411. *
  19412. * @private
  19413. * @param {Array} array The array to inspect.
  19414. * @param {*} value The value to search for.
  19415. * @param {number} fromIndex The index to search from.
  19416. * @returns {number} Returns the index of the matched value, else `-1`.
  19417. */
  19418. function strictLastIndexOf(array, value, fromIndex) {
  19419. var index = fromIndex + 1;
  19420. while (index--) {
  19421. if (array[index] === value) {
  19422. return index;
  19423. }
  19424. }
  19425. return index;
  19426. }
  19427. /**
  19428. * Gets the number of symbols in `string`.
  19429. *
  19430. * @private
  19431. * @param {string} string The string to inspect.
  19432. * @returns {number} Returns the string size.
  19433. */
  19434. function stringSize(string) {
  19435. return hasUnicode(string)
  19436. ? unicodeSize(string)
  19437. : asciiSize(string);
  19438. }
  19439. /**
  19440. * Converts `string` to an array.
  19441. *
  19442. * @private
  19443. * @param {string} string The string to convert.
  19444. * @returns {Array} Returns the converted array.
  19445. */
  19446. function stringToArray(string) {
  19447. return hasUnicode(string)
  19448. ? unicodeToArray(string)
  19449. : asciiToArray(string);
  19450. }
  19451. /**
  19452. * Used by `_.unescape` to convert HTML entities to characters.
  19453. *
  19454. * @private
  19455. * @param {string} chr The matched character to unescape.
  19456. * @returns {string} Returns the unescaped character.
  19457. */
  19458. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19459. /**
  19460. * Gets the size of a Unicode `string`.
  19461. *
  19462. * @private
  19463. * @param {string} string The string inspect.
  19464. * @returns {number} Returns the string size.
  19465. */
  19466. function unicodeSize(string) {
  19467. var result = reUnicode.lastIndex = 0;
  19468. while (reUnicode.test(string)) {
  19469. ++result;
  19470. }
  19471. return result;
  19472. }
  19473. /**
  19474. * Converts a Unicode `string` to an array.
  19475. *
  19476. * @private
  19477. * @param {string} string The string to convert.
  19478. * @returns {Array} Returns the converted array.
  19479. */
  19480. function unicodeToArray(string) {
  19481. return string.match(reUnicode) || [];
  19482. }
  19483. /**
  19484. * Splits a Unicode `string` into an array of its words.
  19485. *
  19486. * @private
  19487. * @param {string} The string to inspect.
  19488. * @returns {Array} Returns the words of `string`.
  19489. */
  19490. function unicodeWords(string) {
  19491. return string.match(reUnicodeWord) || [];
  19492. }
  19493. /*--------------------------------------------------------------------------*/
  19494. /**
  19495. * Create a new pristine `lodash` function using the `context` object.
  19496. *
  19497. * @static
  19498. * @memberOf _
  19499. * @since 1.1.0
  19500. * @category Util
  19501. * @param {Object} [context=root] The context object.
  19502. * @returns {Function} Returns a new `lodash` function.
  19503. * @example
  19504. *
  19505. * _.mixin({ 'foo': _.constant('foo') });
  19506. *
  19507. * var lodash = _.runInContext();
  19508. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19509. *
  19510. * _.isFunction(_.foo);
  19511. * // => true
  19512. * _.isFunction(_.bar);
  19513. * // => false
  19514. *
  19515. * lodash.isFunction(lodash.foo);
  19516. * // => false
  19517. * lodash.isFunction(lodash.bar);
  19518. * // => true
  19519. *
  19520. * // Create a suped-up `defer` in Node.js.
  19521. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19522. */
  19523. var runInContext = (function runInContext(context) {
  19524. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19525. /** Built-in constructor references. */
  19526. var Array = context.Array,
  19527. Date = context.Date,
  19528. Error = context.Error,
  19529. Function = context.Function,
  19530. Math = context.Math,
  19531. Object = context.Object,
  19532. RegExp = context.RegExp,
  19533. String = context.String,
  19534. TypeError = context.TypeError;
  19535. /** Used for built-in method references. */
  19536. var arrayProto = Array.prototype,
  19537. funcProto = Function.prototype,
  19538. objectProto = Object.prototype;
  19539. /** Used to detect overreaching core-js shims. */
  19540. var coreJsData = context['__core-js_shared__'];
  19541. /** Used to resolve the decompiled source of functions. */
  19542. var funcToString = funcProto.toString;
  19543. /** Used to check objects for own properties. */
  19544. var hasOwnProperty = objectProto.hasOwnProperty;
  19545. /** Used to generate unique IDs. */
  19546. var idCounter = 0;
  19547. /** Used to detect methods masquerading as native. */
  19548. var maskSrcKey = (function() {
  19549. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19550. return uid ? ('Symbol(src)_1.' + uid) : '';
  19551. }());
  19552. /**
  19553. * Used to resolve the
  19554. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19555. * of values.
  19556. */
  19557. var nativeObjectToString = objectProto.toString;
  19558. /** Used to infer the `Object` constructor. */
  19559. var objectCtorString = funcToString.call(Object);
  19560. /** Used to restore the original `_` reference in `_.noConflict`. */
  19561. var oldDash = root._;
  19562. /** Used to detect if a method is native. */
  19563. var reIsNative = RegExp('^' +
  19564. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19565. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19566. );
  19567. /** Built-in value references. */
  19568. var Buffer = moduleExports ? context.Buffer : undefined,
  19569. Symbol = context.Symbol,
  19570. Uint8Array = context.Uint8Array,
  19571. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19572. getPrototype = overArg(Object.getPrototypeOf, Object),
  19573. objectCreate = Object.create,
  19574. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19575. splice = arrayProto.splice,
  19576. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19577. symIterator = Symbol ? Symbol.iterator : undefined,
  19578. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19579. var defineProperty = (function() {
  19580. try {
  19581. var func = getNative(Object, 'defineProperty');
  19582. func({}, '', {});
  19583. return func;
  19584. } catch (e) {}
  19585. }());
  19586. /** Mocked built-ins. */
  19587. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19588. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19589. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19590. /* Built-in method references for those with the same name as other `lodash` methods. */
  19591. var nativeCeil = Math.ceil,
  19592. nativeFloor = Math.floor,
  19593. nativeGetSymbols = Object.getOwnPropertySymbols,
  19594. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19595. nativeIsFinite = context.isFinite,
  19596. nativeJoin = arrayProto.join,
  19597. nativeKeys = overArg(Object.keys, Object),
  19598. nativeMax = Math.max,
  19599. nativeMin = Math.min,
  19600. nativeNow = Date.now,
  19601. nativeParseInt = context.parseInt,
  19602. nativeRandom = Math.random,
  19603. nativeReverse = arrayProto.reverse;
  19604. /* Built-in method references that are verified to be native. */
  19605. var DataView = getNative(context, 'DataView'),
  19606. Map = getNative(context, 'Map'),
  19607. Promise = getNative(context, 'Promise'),
  19608. Set = getNative(context, 'Set'),
  19609. WeakMap = getNative(context, 'WeakMap'),
  19610. nativeCreate = getNative(Object, 'create');
  19611. /** Used to store function metadata. */
  19612. var metaMap = WeakMap && new WeakMap;
  19613. /** Used to lookup unminified function names. */
  19614. var realNames = {};
  19615. /** Used to detect maps, sets, and weakmaps. */
  19616. var dataViewCtorString = toSource(DataView),
  19617. mapCtorString = toSource(Map),
  19618. promiseCtorString = toSource(Promise),
  19619. setCtorString = toSource(Set),
  19620. weakMapCtorString = toSource(WeakMap);
  19621. /** Used to convert symbols to primitives and strings. */
  19622. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19623. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19624. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19625. /*------------------------------------------------------------------------*/
  19626. /**
  19627. * Creates a `lodash` object which wraps `value` to enable implicit method
  19628. * chain sequences. Methods that operate on and return arrays, collections,
  19629. * and functions can be chained together. Methods that retrieve a single value
  19630. * or may return a primitive value will automatically end the chain sequence
  19631. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19632. * with `_#value`.
  19633. *
  19634. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19635. * enabled using `_.chain`.
  19636. *
  19637. * The execution of chained methods is lazy, that is, it's deferred until
  19638. * `_#value` is implicitly or explicitly called.
  19639. *
  19640. * Lazy evaluation allows several methods to support shortcut fusion.
  19641. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19642. * the creation of intermediate arrays and can greatly reduce the number of
  19643. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19644. * fusion if the section is applied to an array and iteratees accept only
  19645. * one argument. The heuristic for whether a section qualifies for shortcut
  19646. * fusion is subject to change.
  19647. *
  19648. * Chaining is supported in custom builds as long as the `_#value` method is
  19649. * directly or indirectly included in the build.
  19650. *
  19651. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19652. *
  19653. * The wrapper `Array` methods are:
  19654. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19655. *
  19656. * The wrapper `String` methods are:
  19657. * `replace` and `split`
  19658. *
  19659. * The wrapper methods that support shortcut fusion are:
  19660. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19661. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19662. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19663. *
  19664. * The chainable wrapper methods are:
  19665. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19666. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19667. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19668. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19669. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19670. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19671. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19672. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19673. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19674. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19675. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19676. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19677. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19678. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19679. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19680. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19681. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19682. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19683. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19684. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19685. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19686. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19687. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19688. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19689. *
  19690. * The wrapper methods that are **not** chainable by default are:
  19691. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19692. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19693. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19694. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19695. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19696. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19697. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19698. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19699. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19700. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19701. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19702. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19703. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19704. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19705. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19706. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19707. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19708. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19709. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19710. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19711. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19712. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19713. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19714. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19715. * `upperFirst`, `value`, and `words`
  19716. *
  19717. * @name _
  19718. * @constructor
  19719. * @category Seq
  19720. * @param {*} value The value to wrap in a `lodash` instance.
  19721. * @returns {Object} Returns the new `lodash` wrapper instance.
  19722. * @example
  19723. *
  19724. * function square(n) {
  19725. * return n * n;
  19726. * }
  19727. *
  19728. * var wrapped = _([1, 2, 3]);
  19729. *
  19730. * // Returns an unwrapped value.
  19731. * wrapped.reduce(_.add);
  19732. * // => 6
  19733. *
  19734. * // Returns a wrapped value.
  19735. * var squares = wrapped.map(square);
  19736. *
  19737. * _.isArray(squares);
  19738. * // => false
  19739. *
  19740. * _.isArray(squares.value());
  19741. * // => true
  19742. */
  19743. function lodash(value) {
  19744. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19745. if (value instanceof LodashWrapper) {
  19746. return value;
  19747. }
  19748. if (hasOwnProperty.call(value, '__wrapped__')) {
  19749. return wrapperClone(value);
  19750. }
  19751. }
  19752. return new LodashWrapper(value);
  19753. }
  19754. /**
  19755. * The base implementation of `_.create` without support for assigning
  19756. * properties to the created object.
  19757. *
  19758. * @private
  19759. * @param {Object} proto The object to inherit from.
  19760. * @returns {Object} Returns the new object.
  19761. */
  19762. var baseCreate = (function() {
  19763. function object() {}
  19764. return function(proto) {
  19765. if (!isObject(proto)) {
  19766. return {};
  19767. }
  19768. if (objectCreate) {
  19769. return objectCreate(proto);
  19770. }
  19771. object.prototype = proto;
  19772. var result = new object;
  19773. object.prototype = undefined;
  19774. return result;
  19775. };
  19776. }());
  19777. /**
  19778. * The function whose prototype chain sequence wrappers inherit from.
  19779. *
  19780. * @private
  19781. */
  19782. function baseLodash() {
  19783. // No operation performed.
  19784. }
  19785. /**
  19786. * The base constructor for creating `lodash` wrapper objects.
  19787. *
  19788. * @private
  19789. * @param {*} value The value to wrap.
  19790. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19791. */
  19792. function LodashWrapper(value, chainAll) {
  19793. this.__wrapped__ = value;
  19794. this.__actions__ = [];
  19795. this.__chain__ = !!chainAll;
  19796. this.__index__ = 0;
  19797. this.__values__ = undefined;
  19798. }
  19799. /**
  19800. * By default, the template delimiters used by lodash are like those in
  19801. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19802. * following template settings to use alternative delimiters.
  19803. *
  19804. * @static
  19805. * @memberOf _
  19806. * @type {Object}
  19807. */
  19808. lodash.templateSettings = {
  19809. /**
  19810. * Used to detect `data` property values to be HTML-escaped.
  19811. *
  19812. * @memberOf _.templateSettings
  19813. * @type {RegExp}
  19814. */
  19815. 'escape': reEscape,
  19816. /**
  19817. * Used to detect code to be evaluated.
  19818. *
  19819. * @memberOf _.templateSettings
  19820. * @type {RegExp}
  19821. */
  19822. 'evaluate': reEvaluate,
  19823. /**
  19824. * Used to detect `data` property values to inject.
  19825. *
  19826. * @memberOf _.templateSettings
  19827. * @type {RegExp}
  19828. */
  19829. 'interpolate': reInterpolate,
  19830. /**
  19831. * Used to reference the data object in the template text.
  19832. *
  19833. * @memberOf _.templateSettings
  19834. * @type {string}
  19835. */
  19836. 'variable': '',
  19837. /**
  19838. * Used to import variables into the compiled template.
  19839. *
  19840. * @memberOf _.templateSettings
  19841. * @type {Object}
  19842. */
  19843. 'imports': {
  19844. /**
  19845. * A reference to the `lodash` function.
  19846. *
  19847. * @memberOf _.templateSettings.imports
  19848. * @type {Function}
  19849. */
  19850. '_': lodash
  19851. }
  19852. };
  19853. // Ensure wrappers are instances of `baseLodash`.
  19854. lodash.prototype = baseLodash.prototype;
  19855. lodash.prototype.constructor = lodash;
  19856. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19857. LodashWrapper.prototype.constructor = LodashWrapper;
  19858. /*------------------------------------------------------------------------*/
  19859. /**
  19860. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19861. *
  19862. * @private
  19863. * @constructor
  19864. * @param {*} value The value to wrap.
  19865. */
  19866. function LazyWrapper(value) {
  19867. this.__wrapped__ = value;
  19868. this.__actions__ = [];
  19869. this.__dir__ = 1;
  19870. this.__filtered__ = false;
  19871. this.__iteratees__ = [];
  19872. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19873. this.__views__ = [];
  19874. }
  19875. /**
  19876. * Creates a clone of the lazy wrapper object.
  19877. *
  19878. * @private
  19879. * @name clone
  19880. * @memberOf LazyWrapper
  19881. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19882. */
  19883. function lazyClone() {
  19884. var result = new LazyWrapper(this.__wrapped__);
  19885. result.__actions__ = copyArray(this.__actions__);
  19886. result.__dir__ = this.__dir__;
  19887. result.__filtered__ = this.__filtered__;
  19888. result.__iteratees__ = copyArray(this.__iteratees__);
  19889. result.__takeCount__ = this.__takeCount__;
  19890. result.__views__ = copyArray(this.__views__);
  19891. return result;
  19892. }
  19893. /**
  19894. * Reverses the direction of lazy iteration.
  19895. *
  19896. * @private
  19897. * @name reverse
  19898. * @memberOf LazyWrapper
  19899. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19900. */
  19901. function lazyReverse() {
  19902. if (this.__filtered__) {
  19903. var result = new LazyWrapper(this);
  19904. result.__dir__ = -1;
  19905. result.__filtered__ = true;
  19906. } else {
  19907. result = this.clone();
  19908. result.__dir__ *= -1;
  19909. }
  19910. return result;
  19911. }
  19912. /**
  19913. * Extracts the unwrapped value from its lazy wrapper.
  19914. *
  19915. * @private
  19916. * @name value
  19917. * @memberOf LazyWrapper
  19918. * @returns {*} Returns the unwrapped value.
  19919. */
  19920. function lazyValue() {
  19921. var array = this.__wrapped__.value(),
  19922. dir = this.__dir__,
  19923. isArr = isArray(array),
  19924. isRight = dir < 0,
  19925. arrLength = isArr ? array.length : 0,
  19926. view = getView(0, arrLength, this.__views__),
  19927. start = view.start,
  19928. end = view.end,
  19929. length = end - start,
  19930. index = isRight ? end : (start - 1),
  19931. iteratees = this.__iteratees__,
  19932. iterLength = iteratees.length,
  19933. resIndex = 0,
  19934. takeCount = nativeMin(length, this.__takeCount__);
  19935. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19936. return baseWrapperValue(array, this.__actions__);
  19937. }
  19938. var result = [];
  19939. outer:
  19940. while (length-- && resIndex < takeCount) {
  19941. index += dir;
  19942. var iterIndex = -1,
  19943. value = array[index];
  19944. while (++iterIndex < iterLength) {
  19945. var data = iteratees[iterIndex],
  19946. iteratee = data.iteratee,
  19947. type = data.type,
  19948. computed = iteratee(value);
  19949. if (type == LAZY_MAP_FLAG) {
  19950. value = computed;
  19951. } else if (!computed) {
  19952. if (type == LAZY_FILTER_FLAG) {
  19953. continue outer;
  19954. } else {
  19955. break outer;
  19956. }
  19957. }
  19958. }
  19959. result[resIndex++] = value;
  19960. }
  19961. return result;
  19962. }
  19963. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19964. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19965. LazyWrapper.prototype.constructor = LazyWrapper;
  19966. /*------------------------------------------------------------------------*/
  19967. /**
  19968. * Creates a hash object.
  19969. *
  19970. * @private
  19971. * @constructor
  19972. * @param {Array} [entries] The key-value pairs to cache.
  19973. */
  19974. function Hash(entries) {
  19975. var index = -1,
  19976. length = entries == null ? 0 : entries.length;
  19977. this.clear();
  19978. while (++index < length) {
  19979. var entry = entries[index];
  19980. this.set(entry[0], entry[1]);
  19981. }
  19982. }
  19983. /**
  19984. * Removes all key-value entries from the hash.
  19985. *
  19986. * @private
  19987. * @name clear
  19988. * @memberOf Hash
  19989. */
  19990. function hashClear() {
  19991. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19992. this.size = 0;
  19993. }
  19994. /**
  19995. * Removes `key` and its value from the hash.
  19996. *
  19997. * @private
  19998. * @name delete
  19999. * @memberOf Hash
  20000. * @param {Object} hash The hash to modify.
  20001. * @param {string} key The key of the value to remove.
  20002. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20003. */
  20004. function hashDelete(key) {
  20005. var result = this.has(key) && delete this.__data__[key];
  20006. this.size -= result ? 1 : 0;
  20007. return result;
  20008. }
  20009. /**
  20010. * Gets the hash value for `key`.
  20011. *
  20012. * @private
  20013. * @name get
  20014. * @memberOf Hash
  20015. * @param {string} key The key of the value to get.
  20016. * @returns {*} Returns the entry value.
  20017. */
  20018. function hashGet(key) {
  20019. var data = this.__data__;
  20020. if (nativeCreate) {
  20021. var result = data[key];
  20022. return result === HASH_UNDEFINED ? undefined : result;
  20023. }
  20024. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20025. }
  20026. /**
  20027. * Checks if a hash value for `key` exists.
  20028. *
  20029. * @private
  20030. * @name has
  20031. * @memberOf Hash
  20032. * @param {string} key The key of the entry to check.
  20033. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20034. */
  20035. function hashHas(key) {
  20036. var data = this.__data__;
  20037. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20038. }
  20039. /**
  20040. * Sets the hash `key` to `value`.
  20041. *
  20042. * @private
  20043. * @name set
  20044. * @memberOf Hash
  20045. * @param {string} key The key of the value to set.
  20046. * @param {*} value The value to set.
  20047. * @returns {Object} Returns the hash instance.
  20048. */
  20049. function hashSet(key, value) {
  20050. var data = this.__data__;
  20051. this.size += this.has(key) ? 0 : 1;
  20052. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20053. return this;
  20054. }
  20055. // Add methods to `Hash`.
  20056. Hash.prototype.clear = hashClear;
  20057. Hash.prototype['delete'] = hashDelete;
  20058. Hash.prototype.get = hashGet;
  20059. Hash.prototype.has = hashHas;
  20060. Hash.prototype.set = hashSet;
  20061. /*------------------------------------------------------------------------*/
  20062. /**
  20063. * Creates an list cache object.
  20064. *
  20065. * @private
  20066. * @constructor
  20067. * @param {Array} [entries] The key-value pairs to cache.
  20068. */
  20069. function ListCache(entries) {
  20070. var index = -1,
  20071. length = entries == null ? 0 : entries.length;
  20072. this.clear();
  20073. while (++index < length) {
  20074. var entry = entries[index];
  20075. this.set(entry[0], entry[1]);
  20076. }
  20077. }
  20078. /**
  20079. * Removes all key-value entries from the list cache.
  20080. *
  20081. * @private
  20082. * @name clear
  20083. * @memberOf ListCache
  20084. */
  20085. function listCacheClear() {
  20086. this.__data__ = [];
  20087. this.size = 0;
  20088. }
  20089. /**
  20090. * Removes `key` and its value from the list cache.
  20091. *
  20092. * @private
  20093. * @name delete
  20094. * @memberOf ListCache
  20095. * @param {string} key The key of the value to remove.
  20096. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20097. */
  20098. function listCacheDelete(key) {
  20099. var data = this.__data__,
  20100. index = assocIndexOf(data, key);
  20101. if (index < 0) {
  20102. return false;
  20103. }
  20104. var lastIndex = data.length - 1;
  20105. if (index == lastIndex) {
  20106. data.pop();
  20107. } else {
  20108. splice.call(data, index, 1);
  20109. }
  20110. --this.size;
  20111. return true;
  20112. }
  20113. /**
  20114. * Gets the list cache value for `key`.
  20115. *
  20116. * @private
  20117. * @name get
  20118. * @memberOf ListCache
  20119. * @param {string} key The key of the value to get.
  20120. * @returns {*} Returns the entry value.
  20121. */
  20122. function listCacheGet(key) {
  20123. var data = this.__data__,
  20124. index = assocIndexOf(data, key);
  20125. return index < 0 ? undefined : data[index][1];
  20126. }
  20127. /**
  20128. * Checks if a list cache value for `key` exists.
  20129. *
  20130. * @private
  20131. * @name has
  20132. * @memberOf ListCache
  20133. * @param {string} key The key of the entry to check.
  20134. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20135. */
  20136. function listCacheHas(key) {
  20137. return assocIndexOf(this.__data__, key) > -1;
  20138. }
  20139. /**
  20140. * Sets the list cache `key` to `value`.
  20141. *
  20142. * @private
  20143. * @name set
  20144. * @memberOf ListCache
  20145. * @param {string} key The key of the value to set.
  20146. * @param {*} value The value to set.
  20147. * @returns {Object} Returns the list cache instance.
  20148. */
  20149. function listCacheSet(key, value) {
  20150. var data = this.__data__,
  20151. index = assocIndexOf(data, key);
  20152. if (index < 0) {
  20153. ++this.size;
  20154. data.push([key, value]);
  20155. } else {
  20156. data[index][1] = value;
  20157. }
  20158. return this;
  20159. }
  20160. // Add methods to `ListCache`.
  20161. ListCache.prototype.clear = listCacheClear;
  20162. ListCache.prototype['delete'] = listCacheDelete;
  20163. ListCache.prototype.get = listCacheGet;
  20164. ListCache.prototype.has = listCacheHas;
  20165. ListCache.prototype.set = listCacheSet;
  20166. /*------------------------------------------------------------------------*/
  20167. /**
  20168. * Creates a map cache object to store key-value pairs.
  20169. *
  20170. * @private
  20171. * @constructor
  20172. * @param {Array} [entries] The key-value pairs to cache.
  20173. */
  20174. function MapCache(entries) {
  20175. var index = -1,
  20176. length = entries == null ? 0 : entries.length;
  20177. this.clear();
  20178. while (++index < length) {
  20179. var entry = entries[index];
  20180. this.set(entry[0], entry[1]);
  20181. }
  20182. }
  20183. /**
  20184. * Removes all key-value entries from the map.
  20185. *
  20186. * @private
  20187. * @name clear
  20188. * @memberOf MapCache
  20189. */
  20190. function mapCacheClear() {
  20191. this.size = 0;
  20192. this.__data__ = {
  20193. 'hash': new Hash,
  20194. 'map': new (Map || ListCache),
  20195. 'string': new Hash
  20196. };
  20197. }
  20198. /**
  20199. * Removes `key` and its value from the map.
  20200. *
  20201. * @private
  20202. * @name delete
  20203. * @memberOf MapCache
  20204. * @param {string} key The key of the value to remove.
  20205. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20206. */
  20207. function mapCacheDelete(key) {
  20208. var result = getMapData(this, key)['delete'](key);
  20209. this.size -= result ? 1 : 0;
  20210. return result;
  20211. }
  20212. /**
  20213. * Gets the map value for `key`.
  20214. *
  20215. * @private
  20216. * @name get
  20217. * @memberOf MapCache
  20218. * @param {string} key The key of the value to get.
  20219. * @returns {*} Returns the entry value.
  20220. */
  20221. function mapCacheGet(key) {
  20222. return getMapData(this, key).get(key);
  20223. }
  20224. /**
  20225. * Checks if a map value for `key` exists.
  20226. *
  20227. * @private
  20228. * @name has
  20229. * @memberOf MapCache
  20230. * @param {string} key The key of the entry to check.
  20231. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20232. */
  20233. function mapCacheHas(key) {
  20234. return getMapData(this, key).has(key);
  20235. }
  20236. /**
  20237. * Sets the map `key` to `value`.
  20238. *
  20239. * @private
  20240. * @name set
  20241. * @memberOf MapCache
  20242. * @param {string} key The key of the value to set.
  20243. * @param {*} value The value to set.
  20244. * @returns {Object} Returns the map cache instance.
  20245. */
  20246. function mapCacheSet(key, value) {
  20247. var data = getMapData(this, key),
  20248. size = data.size;
  20249. data.set(key, value);
  20250. this.size += data.size == size ? 0 : 1;
  20251. return this;
  20252. }
  20253. // Add methods to `MapCache`.
  20254. MapCache.prototype.clear = mapCacheClear;
  20255. MapCache.prototype['delete'] = mapCacheDelete;
  20256. MapCache.prototype.get = mapCacheGet;
  20257. MapCache.prototype.has = mapCacheHas;
  20258. MapCache.prototype.set = mapCacheSet;
  20259. /*------------------------------------------------------------------------*/
  20260. /**
  20261. *
  20262. * Creates an array cache object to store unique values.
  20263. *
  20264. * @private
  20265. * @constructor
  20266. * @param {Array} [values] The values to cache.
  20267. */
  20268. function SetCache(values) {
  20269. var index = -1,
  20270. length = values == null ? 0 : values.length;
  20271. this.__data__ = new MapCache;
  20272. while (++index < length) {
  20273. this.add(values[index]);
  20274. }
  20275. }
  20276. /**
  20277. * Adds `value` to the array cache.
  20278. *
  20279. * @private
  20280. * @name add
  20281. * @memberOf SetCache
  20282. * @alias push
  20283. * @param {*} value The value to cache.
  20284. * @returns {Object} Returns the cache instance.
  20285. */
  20286. function setCacheAdd(value) {
  20287. this.__data__.set(value, HASH_UNDEFINED);
  20288. return this;
  20289. }
  20290. /**
  20291. * Checks if `value` is in the array cache.
  20292. *
  20293. * @private
  20294. * @name has
  20295. * @memberOf SetCache
  20296. * @param {*} value The value to search for.
  20297. * @returns {number} Returns `true` if `value` is found, else `false`.
  20298. */
  20299. function setCacheHas(value) {
  20300. return this.__data__.has(value);
  20301. }
  20302. // Add methods to `SetCache`.
  20303. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20304. SetCache.prototype.has = setCacheHas;
  20305. /*------------------------------------------------------------------------*/
  20306. /**
  20307. * Creates a stack cache object to store key-value pairs.
  20308. *
  20309. * @private
  20310. * @constructor
  20311. * @param {Array} [entries] The key-value pairs to cache.
  20312. */
  20313. function Stack(entries) {
  20314. var data = this.__data__ = new ListCache(entries);
  20315. this.size = data.size;
  20316. }
  20317. /**
  20318. * Removes all key-value entries from the stack.
  20319. *
  20320. * @private
  20321. * @name clear
  20322. * @memberOf Stack
  20323. */
  20324. function stackClear() {
  20325. this.__data__ = new ListCache;
  20326. this.size = 0;
  20327. }
  20328. /**
  20329. * Removes `key` and its value from the stack.
  20330. *
  20331. * @private
  20332. * @name delete
  20333. * @memberOf Stack
  20334. * @param {string} key The key of the value to remove.
  20335. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20336. */
  20337. function stackDelete(key) {
  20338. var data = this.__data__,
  20339. result = data['delete'](key);
  20340. this.size = data.size;
  20341. return result;
  20342. }
  20343. /**
  20344. * Gets the stack value for `key`.
  20345. *
  20346. * @private
  20347. * @name get
  20348. * @memberOf Stack
  20349. * @param {string} key The key of the value to get.
  20350. * @returns {*} Returns the entry value.
  20351. */
  20352. function stackGet(key) {
  20353. return this.__data__.get(key);
  20354. }
  20355. /**
  20356. * Checks if a stack value for `key` exists.
  20357. *
  20358. * @private
  20359. * @name has
  20360. * @memberOf Stack
  20361. * @param {string} key The key of the entry to check.
  20362. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20363. */
  20364. function stackHas(key) {
  20365. return this.__data__.has(key);
  20366. }
  20367. /**
  20368. * Sets the stack `key` to `value`.
  20369. *
  20370. * @private
  20371. * @name set
  20372. * @memberOf Stack
  20373. * @param {string} key The key of the value to set.
  20374. * @param {*} value The value to set.
  20375. * @returns {Object} Returns the stack cache instance.
  20376. */
  20377. function stackSet(key, value) {
  20378. var data = this.__data__;
  20379. if (data instanceof ListCache) {
  20380. var pairs = data.__data__;
  20381. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20382. pairs.push([key, value]);
  20383. this.size = ++data.size;
  20384. return this;
  20385. }
  20386. data = this.__data__ = new MapCache(pairs);
  20387. }
  20388. data.set(key, value);
  20389. this.size = data.size;
  20390. return this;
  20391. }
  20392. // Add methods to `Stack`.
  20393. Stack.prototype.clear = stackClear;
  20394. Stack.prototype['delete'] = stackDelete;
  20395. Stack.prototype.get = stackGet;
  20396. Stack.prototype.has = stackHas;
  20397. Stack.prototype.set = stackSet;
  20398. /*------------------------------------------------------------------------*/
  20399. /**
  20400. * Creates an array of the enumerable property names of the array-like `value`.
  20401. *
  20402. * @private
  20403. * @param {*} value The value to query.
  20404. * @param {boolean} inherited Specify returning inherited property names.
  20405. * @returns {Array} Returns the array of property names.
  20406. */
  20407. function arrayLikeKeys(value, inherited) {
  20408. var isArr = isArray(value),
  20409. isArg = !isArr && isArguments(value),
  20410. isBuff = !isArr && !isArg && isBuffer(value),
  20411. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20412. skipIndexes = isArr || isArg || isBuff || isType,
  20413. result = skipIndexes ? baseTimes(value.length, String) : [],
  20414. length = result.length;
  20415. for (var key in value) {
  20416. if ((inherited || hasOwnProperty.call(value, key)) &&
  20417. !(skipIndexes && (
  20418. // Safari 9 has enumerable `arguments.length` in strict mode.
  20419. key == 'length' ||
  20420. // Node.js 0.10 has enumerable non-index properties on buffers.
  20421. (isBuff && (key == 'offset' || key == 'parent')) ||
  20422. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20423. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20424. // Skip index properties.
  20425. isIndex(key, length)
  20426. ))) {
  20427. result.push(key);
  20428. }
  20429. }
  20430. return result;
  20431. }
  20432. /**
  20433. * A specialized version of `_.sample` for arrays.
  20434. *
  20435. * @private
  20436. * @param {Array} array The array to sample.
  20437. * @returns {*} Returns the random element.
  20438. */
  20439. function arraySample(array) {
  20440. var length = array.length;
  20441. return length ? array[baseRandom(0, length - 1)] : undefined;
  20442. }
  20443. /**
  20444. * A specialized version of `_.sampleSize` for arrays.
  20445. *
  20446. * @private
  20447. * @param {Array} array The array to sample.
  20448. * @param {number} n The number of elements to sample.
  20449. * @returns {Array} Returns the random elements.
  20450. */
  20451. function arraySampleSize(array, n) {
  20452. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20453. }
  20454. /**
  20455. * A specialized version of `_.shuffle` for arrays.
  20456. *
  20457. * @private
  20458. * @param {Array} array The array to shuffle.
  20459. * @returns {Array} Returns the new shuffled array.
  20460. */
  20461. function arrayShuffle(array) {
  20462. return shuffleSelf(copyArray(array));
  20463. }
  20464. /**
  20465. * This function is like `assignValue` except that it doesn't assign
  20466. * `undefined` values.
  20467. *
  20468. * @private
  20469. * @param {Object} object The object to modify.
  20470. * @param {string} key The key of the property to assign.
  20471. * @param {*} value The value to assign.
  20472. */
  20473. function assignMergeValue(object, key, value) {
  20474. if ((value !== undefined && !eq(object[key], value)) ||
  20475. (value === undefined && !(key in object))) {
  20476. baseAssignValue(object, key, value);
  20477. }
  20478. }
  20479. /**
  20480. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20481. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20482. * for equality comparisons.
  20483. *
  20484. * @private
  20485. * @param {Object} object The object to modify.
  20486. * @param {string} key The key of the property to assign.
  20487. * @param {*} value The value to assign.
  20488. */
  20489. function assignValue(object, key, value) {
  20490. var objValue = object[key];
  20491. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20492. (value === undefined && !(key in object))) {
  20493. baseAssignValue(object, key, value);
  20494. }
  20495. }
  20496. /**
  20497. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20498. *
  20499. * @private
  20500. * @param {Array} array The array to inspect.
  20501. * @param {*} key The key to search for.
  20502. * @returns {number} Returns the index of the matched value, else `-1`.
  20503. */
  20504. function assocIndexOf(array, key) {
  20505. var length = array.length;
  20506. while (length--) {
  20507. if (eq(array[length][0], key)) {
  20508. return length;
  20509. }
  20510. }
  20511. return -1;
  20512. }
  20513. /**
  20514. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20515. * by `iteratee` and values set by `setter`.
  20516. *
  20517. * @private
  20518. * @param {Array|Object} collection The collection to iterate over.
  20519. * @param {Function} setter The function to set `accumulator` values.
  20520. * @param {Function} iteratee The iteratee to transform keys.
  20521. * @param {Object} accumulator The initial aggregated object.
  20522. * @returns {Function} Returns `accumulator`.
  20523. */
  20524. function baseAggregator(collection, setter, iteratee, accumulator) {
  20525. baseEach(collection, function(value, key, collection) {
  20526. setter(accumulator, value, iteratee(value), collection);
  20527. });
  20528. return accumulator;
  20529. }
  20530. /**
  20531. * The base implementation of `_.assign` without support for multiple sources
  20532. * or `customizer` functions.
  20533. *
  20534. * @private
  20535. * @param {Object} object The destination object.
  20536. * @param {Object} source The source object.
  20537. * @returns {Object} Returns `object`.
  20538. */
  20539. function baseAssign(object, source) {
  20540. return object && copyObject(source, keys(source), object);
  20541. }
  20542. /**
  20543. * The base implementation of `_.assignIn` without support for multiple sources
  20544. * or `customizer` functions.
  20545. *
  20546. * @private
  20547. * @param {Object} object The destination object.
  20548. * @param {Object} source The source object.
  20549. * @returns {Object} Returns `object`.
  20550. */
  20551. function baseAssignIn(object, source) {
  20552. return object && copyObject(source, keysIn(source), object);
  20553. }
  20554. /**
  20555. * The base implementation of `assignValue` and `assignMergeValue` without
  20556. * value checks.
  20557. *
  20558. * @private
  20559. * @param {Object} object The object to modify.
  20560. * @param {string} key The key of the property to assign.
  20561. * @param {*} value The value to assign.
  20562. */
  20563. function baseAssignValue(object, key, value) {
  20564. if (key == '__proto__' && defineProperty) {
  20565. defineProperty(object, key, {
  20566. 'configurable': true,
  20567. 'enumerable': true,
  20568. 'value': value,
  20569. 'writable': true
  20570. });
  20571. } else {
  20572. object[key] = value;
  20573. }
  20574. }
  20575. /**
  20576. * The base implementation of `_.at` without support for individual paths.
  20577. *
  20578. * @private
  20579. * @param {Object} object The object to iterate over.
  20580. * @param {string[]} paths The property paths to pick.
  20581. * @returns {Array} Returns the picked elements.
  20582. */
  20583. function baseAt(object, paths) {
  20584. var index = -1,
  20585. length = paths.length,
  20586. result = Array(length),
  20587. skip = object == null;
  20588. while (++index < length) {
  20589. result[index] = skip ? undefined : get(object, paths[index]);
  20590. }
  20591. return result;
  20592. }
  20593. /**
  20594. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20595. *
  20596. * @private
  20597. * @param {number} number The number to clamp.
  20598. * @param {number} [lower] The lower bound.
  20599. * @param {number} upper The upper bound.
  20600. * @returns {number} Returns the clamped number.
  20601. */
  20602. function baseClamp(number, lower, upper) {
  20603. if (number === number) {
  20604. if (upper !== undefined) {
  20605. number = number <= upper ? number : upper;
  20606. }
  20607. if (lower !== undefined) {
  20608. number = number >= lower ? number : lower;
  20609. }
  20610. }
  20611. return number;
  20612. }
  20613. /**
  20614. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20615. * traversed objects.
  20616. *
  20617. * @private
  20618. * @param {*} value The value to clone.
  20619. * @param {boolean} bitmask The bitmask flags.
  20620. * 1 - Deep clone
  20621. * 2 - Flatten inherited properties
  20622. * 4 - Clone symbols
  20623. * @param {Function} [customizer] The function to customize cloning.
  20624. * @param {string} [key] The key of `value`.
  20625. * @param {Object} [object] The parent object of `value`.
  20626. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20627. * @returns {*} Returns the cloned value.
  20628. */
  20629. function baseClone(value, bitmask, customizer, key, object, stack) {
  20630. var result,
  20631. isDeep = bitmask & CLONE_DEEP_FLAG,
  20632. isFlat = bitmask & CLONE_FLAT_FLAG,
  20633. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20634. if (customizer) {
  20635. result = object ? customizer(value, key, object, stack) : customizer(value);
  20636. }
  20637. if (result !== undefined) {
  20638. return result;
  20639. }
  20640. if (!isObject(value)) {
  20641. return value;
  20642. }
  20643. var isArr = isArray(value);
  20644. if (isArr) {
  20645. result = initCloneArray(value);
  20646. if (!isDeep) {
  20647. return copyArray(value, result);
  20648. }
  20649. } else {
  20650. var tag = getTag(value),
  20651. isFunc = tag == funcTag || tag == genTag;
  20652. if (isBuffer(value)) {
  20653. return cloneBuffer(value, isDeep);
  20654. }
  20655. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20656. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20657. if (!isDeep) {
  20658. return isFlat
  20659. ? copySymbolsIn(value, baseAssignIn(result, value))
  20660. : copySymbols(value, baseAssign(result, value));
  20661. }
  20662. } else {
  20663. if (!cloneableTags[tag]) {
  20664. return object ? value : {};
  20665. }
  20666. result = initCloneByTag(value, tag, isDeep);
  20667. }
  20668. }
  20669. // Check for circular references and return its corresponding clone.
  20670. stack || (stack = new Stack);
  20671. var stacked = stack.get(value);
  20672. if (stacked) {
  20673. return stacked;
  20674. }
  20675. stack.set(value, result);
  20676. if (isSet(value)) {
  20677. value.forEach(function(subValue) {
  20678. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20679. });
  20680. } else if (isMap(value)) {
  20681. value.forEach(function(subValue, key) {
  20682. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20683. });
  20684. }
  20685. var keysFunc = isFull
  20686. ? (isFlat ? getAllKeysIn : getAllKeys)
  20687. : (isFlat ? keysIn : keys);
  20688. var props = isArr ? undefined : keysFunc(value);
  20689. arrayEach(props || value, function(subValue, key) {
  20690. if (props) {
  20691. key = subValue;
  20692. subValue = value[key];
  20693. }
  20694. // Recursively populate clone (susceptible to call stack limits).
  20695. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20696. });
  20697. return result;
  20698. }
  20699. /**
  20700. * The base implementation of `_.conforms` which doesn't clone `source`.
  20701. *
  20702. * @private
  20703. * @param {Object} source The object of property predicates to conform to.
  20704. * @returns {Function} Returns the new spec function.
  20705. */
  20706. function baseConforms(source) {
  20707. var props = keys(source);
  20708. return function(object) {
  20709. return baseConformsTo(object, source, props);
  20710. };
  20711. }
  20712. /**
  20713. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20714. *
  20715. * @private
  20716. * @param {Object} object The object to inspect.
  20717. * @param {Object} source The object of property predicates to conform to.
  20718. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20719. */
  20720. function baseConformsTo(object, source, props) {
  20721. var length = props.length;
  20722. if (object == null) {
  20723. return !length;
  20724. }
  20725. object = Object(object);
  20726. while (length--) {
  20727. var key = props[length],
  20728. predicate = source[key],
  20729. value = object[key];
  20730. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20731. return false;
  20732. }
  20733. }
  20734. return true;
  20735. }
  20736. /**
  20737. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20738. * to provide to `func`.
  20739. *
  20740. * @private
  20741. * @param {Function} func The function to delay.
  20742. * @param {number} wait The number of milliseconds to delay invocation.
  20743. * @param {Array} args The arguments to provide to `func`.
  20744. * @returns {number|Object} Returns the timer id or timeout object.
  20745. */
  20746. function baseDelay(func, wait, args) {
  20747. if (typeof func != 'function') {
  20748. throw new TypeError(FUNC_ERROR_TEXT);
  20749. }
  20750. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20751. }
  20752. /**
  20753. * The base implementation of methods like `_.difference` without support
  20754. * for excluding multiple arrays or iteratee shorthands.
  20755. *
  20756. * @private
  20757. * @param {Array} array The array to inspect.
  20758. * @param {Array} values The values to exclude.
  20759. * @param {Function} [iteratee] The iteratee invoked per element.
  20760. * @param {Function} [comparator] The comparator invoked per element.
  20761. * @returns {Array} Returns the new array of filtered values.
  20762. */
  20763. function baseDifference(array, values, iteratee, comparator) {
  20764. var index = -1,
  20765. includes = arrayIncludes,
  20766. isCommon = true,
  20767. length = array.length,
  20768. result = [],
  20769. valuesLength = values.length;
  20770. if (!length) {
  20771. return result;
  20772. }
  20773. if (iteratee) {
  20774. values = arrayMap(values, baseUnary(iteratee));
  20775. }
  20776. if (comparator) {
  20777. includes = arrayIncludesWith;
  20778. isCommon = false;
  20779. }
  20780. else if (values.length >= LARGE_ARRAY_SIZE) {
  20781. includes = cacheHas;
  20782. isCommon = false;
  20783. values = new SetCache(values);
  20784. }
  20785. outer:
  20786. while (++index < length) {
  20787. var value = array[index],
  20788. computed = iteratee == null ? value : iteratee(value);
  20789. value = (comparator || value !== 0) ? value : 0;
  20790. if (isCommon && computed === computed) {
  20791. var valuesIndex = valuesLength;
  20792. while (valuesIndex--) {
  20793. if (values[valuesIndex] === computed) {
  20794. continue outer;
  20795. }
  20796. }
  20797. result.push(value);
  20798. }
  20799. else if (!includes(values, computed, comparator)) {
  20800. result.push(value);
  20801. }
  20802. }
  20803. return result;
  20804. }
  20805. /**
  20806. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20807. *
  20808. * @private
  20809. * @param {Array|Object} collection The collection to iterate over.
  20810. * @param {Function} iteratee The function invoked per iteration.
  20811. * @returns {Array|Object} Returns `collection`.
  20812. */
  20813. var baseEach = createBaseEach(baseForOwn);
  20814. /**
  20815. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20816. *
  20817. * @private
  20818. * @param {Array|Object} collection The collection to iterate over.
  20819. * @param {Function} iteratee The function invoked per iteration.
  20820. * @returns {Array|Object} Returns `collection`.
  20821. */
  20822. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20823. /**
  20824. * The base implementation of `_.every` without support for iteratee shorthands.
  20825. *
  20826. * @private
  20827. * @param {Array|Object} collection The collection to iterate over.
  20828. * @param {Function} predicate The function invoked per iteration.
  20829. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20830. * else `false`
  20831. */
  20832. function baseEvery(collection, predicate) {
  20833. var result = true;
  20834. baseEach(collection, function(value, index, collection) {
  20835. result = !!predicate(value, index, collection);
  20836. return result;
  20837. });
  20838. return result;
  20839. }
  20840. /**
  20841. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20842. * `comparator` to determine the extremum value.
  20843. *
  20844. * @private
  20845. * @param {Array} array The array to iterate over.
  20846. * @param {Function} iteratee The iteratee invoked per iteration.
  20847. * @param {Function} comparator The comparator used to compare values.
  20848. * @returns {*} Returns the extremum value.
  20849. */
  20850. function baseExtremum(array, iteratee, comparator) {
  20851. var index = -1,
  20852. length = array.length;
  20853. while (++index < length) {
  20854. var value = array[index],
  20855. current = iteratee(value);
  20856. if (current != null && (computed === undefined
  20857. ? (current === current && !isSymbol(current))
  20858. : comparator(current, computed)
  20859. )) {
  20860. var computed = current,
  20861. result = value;
  20862. }
  20863. }
  20864. return result;
  20865. }
  20866. /**
  20867. * The base implementation of `_.fill` without an iteratee call guard.
  20868. *
  20869. * @private
  20870. * @param {Array} array The array to fill.
  20871. * @param {*} value The value to fill `array` with.
  20872. * @param {number} [start=0] The start position.
  20873. * @param {number} [end=array.length] The end position.
  20874. * @returns {Array} Returns `array`.
  20875. */
  20876. function baseFill(array, value, start, end) {
  20877. var length = array.length;
  20878. start = toInteger(start);
  20879. if (start < 0) {
  20880. start = -start > length ? 0 : (length + start);
  20881. }
  20882. end = (end === undefined || end > length) ? length : toInteger(end);
  20883. if (end < 0) {
  20884. end += length;
  20885. }
  20886. end = start > end ? 0 : toLength(end);
  20887. while (start < end) {
  20888. array[start++] = value;
  20889. }
  20890. return array;
  20891. }
  20892. /**
  20893. * The base implementation of `_.filter` without support for iteratee shorthands.
  20894. *
  20895. * @private
  20896. * @param {Array|Object} collection The collection to iterate over.
  20897. * @param {Function} predicate The function invoked per iteration.
  20898. * @returns {Array} Returns the new filtered array.
  20899. */
  20900. function baseFilter(collection, predicate) {
  20901. var result = [];
  20902. baseEach(collection, function(value, index, collection) {
  20903. if (predicate(value, index, collection)) {
  20904. result.push(value);
  20905. }
  20906. });
  20907. return result;
  20908. }
  20909. /**
  20910. * The base implementation of `_.flatten` with support for restricting flattening.
  20911. *
  20912. * @private
  20913. * @param {Array} array The array to flatten.
  20914. * @param {number} depth The maximum recursion depth.
  20915. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20916. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20917. * @param {Array} [result=[]] The initial result value.
  20918. * @returns {Array} Returns the new flattened array.
  20919. */
  20920. function baseFlatten(array, depth, predicate, isStrict, result) {
  20921. var index = -1,
  20922. length = array.length;
  20923. predicate || (predicate = isFlattenable);
  20924. result || (result = []);
  20925. while (++index < length) {
  20926. var value = array[index];
  20927. if (depth > 0 && predicate(value)) {
  20928. if (depth > 1) {
  20929. // Recursively flatten arrays (susceptible to call stack limits).
  20930. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20931. } else {
  20932. arrayPush(result, value);
  20933. }
  20934. } else if (!isStrict) {
  20935. result[result.length] = value;
  20936. }
  20937. }
  20938. return result;
  20939. }
  20940. /**
  20941. * The base implementation of `baseForOwn` which iterates over `object`
  20942. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20943. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20944. *
  20945. * @private
  20946. * @param {Object} object The object to iterate over.
  20947. * @param {Function} iteratee The function invoked per iteration.
  20948. * @param {Function} keysFunc The function to get the keys of `object`.
  20949. * @returns {Object} Returns `object`.
  20950. */
  20951. var baseFor = createBaseFor();
  20952. /**
  20953. * This function is like `baseFor` except that it iterates over properties
  20954. * in the opposite order.
  20955. *
  20956. * @private
  20957. * @param {Object} object The object to iterate over.
  20958. * @param {Function} iteratee The function invoked per iteration.
  20959. * @param {Function} keysFunc The function to get the keys of `object`.
  20960. * @returns {Object} Returns `object`.
  20961. */
  20962. var baseForRight = createBaseFor(true);
  20963. /**
  20964. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20965. *
  20966. * @private
  20967. * @param {Object} object The object to iterate over.
  20968. * @param {Function} iteratee The function invoked per iteration.
  20969. * @returns {Object} Returns `object`.
  20970. */
  20971. function baseForOwn(object, iteratee) {
  20972. return object && baseFor(object, iteratee, keys);
  20973. }
  20974. /**
  20975. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20976. *
  20977. * @private
  20978. * @param {Object} object The object to iterate over.
  20979. * @param {Function} iteratee The function invoked per iteration.
  20980. * @returns {Object} Returns `object`.
  20981. */
  20982. function baseForOwnRight(object, iteratee) {
  20983. return object && baseForRight(object, iteratee, keys);
  20984. }
  20985. /**
  20986. * The base implementation of `_.functions` which creates an array of
  20987. * `object` function property names filtered from `props`.
  20988. *
  20989. * @private
  20990. * @param {Object} object The object to inspect.
  20991. * @param {Array} props The property names to filter.
  20992. * @returns {Array} Returns the function names.
  20993. */
  20994. function baseFunctions(object, props) {
  20995. return arrayFilter(props, function(key) {
  20996. return isFunction(object[key]);
  20997. });
  20998. }
  20999. /**
  21000. * The base implementation of `_.get` without support for default values.
  21001. *
  21002. * @private
  21003. * @param {Object} object The object to query.
  21004. * @param {Array|string} path The path of the property to get.
  21005. * @returns {*} Returns the resolved value.
  21006. */
  21007. function baseGet(object, path) {
  21008. path = castPath(path, object);
  21009. var index = 0,
  21010. length = path.length;
  21011. while (object != null && index < length) {
  21012. object = object[toKey(path[index++])];
  21013. }
  21014. return (index && index == length) ? object : undefined;
  21015. }
  21016. /**
  21017. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21018. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21019. * symbols of `object`.
  21020. *
  21021. * @private
  21022. * @param {Object} object The object to query.
  21023. * @param {Function} keysFunc The function to get the keys of `object`.
  21024. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21025. * @returns {Array} Returns the array of property names and symbols.
  21026. */
  21027. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21028. var result = keysFunc(object);
  21029. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21030. }
  21031. /**
  21032. * The base implementation of `getTag` without fallbacks for buggy environments.
  21033. *
  21034. * @private
  21035. * @param {*} value The value to query.
  21036. * @returns {string} Returns the `toStringTag`.
  21037. */
  21038. function baseGetTag(value) {
  21039. if (value == null) {
  21040. return value === undefined ? undefinedTag : nullTag;
  21041. }
  21042. return (symToStringTag && symToStringTag in Object(value))
  21043. ? getRawTag(value)
  21044. : objectToString(value);
  21045. }
  21046. /**
  21047. * The base implementation of `_.gt` which doesn't coerce arguments.
  21048. *
  21049. * @private
  21050. * @param {*} value The value to compare.
  21051. * @param {*} other The other value to compare.
  21052. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21053. * else `false`.
  21054. */
  21055. function baseGt(value, other) {
  21056. return value > other;
  21057. }
  21058. /**
  21059. * The base implementation of `_.has` without support for deep paths.
  21060. *
  21061. * @private
  21062. * @param {Object} [object] The object to query.
  21063. * @param {Array|string} key The key to check.
  21064. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21065. */
  21066. function baseHas(object, key) {
  21067. return object != null && hasOwnProperty.call(object, key);
  21068. }
  21069. /**
  21070. * The base implementation of `_.hasIn` without support for deep paths.
  21071. *
  21072. * @private
  21073. * @param {Object} [object] The object to query.
  21074. * @param {Array|string} key The key to check.
  21075. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21076. */
  21077. function baseHasIn(object, key) {
  21078. return object != null && key in Object(object);
  21079. }
  21080. /**
  21081. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21082. *
  21083. * @private
  21084. * @param {number} number The number to check.
  21085. * @param {number} start The start of the range.
  21086. * @param {number} end The end of the range.
  21087. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21088. */
  21089. function baseInRange(number, start, end) {
  21090. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21091. }
  21092. /**
  21093. * The base implementation of methods like `_.intersection`, without support
  21094. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21095. *
  21096. * @private
  21097. * @param {Array} arrays The arrays to inspect.
  21098. * @param {Function} [iteratee] The iteratee invoked per element.
  21099. * @param {Function} [comparator] The comparator invoked per element.
  21100. * @returns {Array} Returns the new array of shared values.
  21101. */
  21102. function baseIntersection(arrays, iteratee, comparator) {
  21103. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21104. length = arrays[0].length,
  21105. othLength = arrays.length,
  21106. othIndex = othLength,
  21107. caches = Array(othLength),
  21108. maxLength = Infinity,
  21109. result = [];
  21110. while (othIndex--) {
  21111. var array = arrays[othIndex];
  21112. if (othIndex && iteratee) {
  21113. array = arrayMap(array, baseUnary(iteratee));
  21114. }
  21115. maxLength = nativeMin(array.length, maxLength);
  21116. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21117. ? new SetCache(othIndex && array)
  21118. : undefined;
  21119. }
  21120. array = arrays[0];
  21121. var index = -1,
  21122. seen = caches[0];
  21123. outer:
  21124. while (++index < length && result.length < maxLength) {
  21125. var value = array[index],
  21126. computed = iteratee ? iteratee(value) : value;
  21127. value = (comparator || value !== 0) ? value : 0;
  21128. if (!(seen
  21129. ? cacheHas(seen, computed)
  21130. : includes(result, computed, comparator)
  21131. )) {
  21132. othIndex = othLength;
  21133. while (--othIndex) {
  21134. var cache = caches[othIndex];
  21135. if (!(cache
  21136. ? cacheHas(cache, computed)
  21137. : includes(arrays[othIndex], computed, comparator))
  21138. ) {
  21139. continue outer;
  21140. }
  21141. }
  21142. if (seen) {
  21143. seen.push(computed);
  21144. }
  21145. result.push(value);
  21146. }
  21147. }
  21148. return result;
  21149. }
  21150. /**
  21151. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21152. * `object` with values transformed by `iteratee` and set by `setter`.
  21153. *
  21154. * @private
  21155. * @param {Object} object The object to iterate over.
  21156. * @param {Function} setter The function to set `accumulator` values.
  21157. * @param {Function} iteratee The iteratee to transform values.
  21158. * @param {Object} accumulator The initial inverted object.
  21159. * @returns {Function} Returns `accumulator`.
  21160. */
  21161. function baseInverter(object, setter, iteratee, accumulator) {
  21162. baseForOwn(object, function(value, key, object) {
  21163. setter(accumulator, iteratee(value), key, object);
  21164. });
  21165. return accumulator;
  21166. }
  21167. /**
  21168. * The base implementation of `_.invoke` without support for individual
  21169. * method arguments.
  21170. *
  21171. * @private
  21172. * @param {Object} object The object to query.
  21173. * @param {Array|string} path The path of the method to invoke.
  21174. * @param {Array} args The arguments to invoke the method with.
  21175. * @returns {*} Returns the result of the invoked method.
  21176. */
  21177. function baseInvoke(object, path, args) {
  21178. path = castPath(path, object);
  21179. object = parent(object, path);
  21180. var func = object == null ? object : object[toKey(last(path))];
  21181. return func == null ? undefined : apply(func, object, args);
  21182. }
  21183. /**
  21184. * The base implementation of `_.isArguments`.
  21185. *
  21186. * @private
  21187. * @param {*} value The value to check.
  21188. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21189. */
  21190. function baseIsArguments(value) {
  21191. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21192. }
  21193. /**
  21194. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21195. *
  21196. * @private
  21197. * @param {*} value The value to check.
  21198. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21199. */
  21200. function baseIsArrayBuffer(value) {
  21201. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21202. }
  21203. /**
  21204. * The base implementation of `_.isDate` without Node.js optimizations.
  21205. *
  21206. * @private
  21207. * @param {*} value The value to check.
  21208. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21209. */
  21210. function baseIsDate(value) {
  21211. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21212. }
  21213. /**
  21214. * The base implementation of `_.isEqual` which supports partial comparisons
  21215. * and tracks traversed objects.
  21216. *
  21217. * @private
  21218. * @param {*} value The value to compare.
  21219. * @param {*} other The other value to compare.
  21220. * @param {boolean} bitmask The bitmask flags.
  21221. * 1 - Unordered comparison
  21222. * 2 - Partial comparison
  21223. * @param {Function} [customizer] The function to customize comparisons.
  21224. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21225. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21226. */
  21227. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21228. if (value === other) {
  21229. return true;
  21230. }
  21231. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21232. return value !== value && other !== other;
  21233. }
  21234. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21235. }
  21236. /**
  21237. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21238. * deep comparisons and tracks traversed objects enabling objects with circular
  21239. * references to be compared.
  21240. *
  21241. * @private
  21242. * @param {Object} object The object to compare.
  21243. * @param {Object} other The other object to compare.
  21244. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21245. * @param {Function} customizer The function to customize comparisons.
  21246. * @param {Function} equalFunc The function to determine equivalents of values.
  21247. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21248. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21249. */
  21250. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21251. var objIsArr = isArray(object),
  21252. othIsArr = isArray(other),
  21253. objTag = objIsArr ? arrayTag : getTag(object),
  21254. othTag = othIsArr ? arrayTag : getTag(other);
  21255. objTag = objTag == argsTag ? objectTag : objTag;
  21256. othTag = othTag == argsTag ? objectTag : othTag;
  21257. var objIsObj = objTag == objectTag,
  21258. othIsObj = othTag == objectTag,
  21259. isSameTag = objTag == othTag;
  21260. if (isSameTag && isBuffer(object)) {
  21261. if (!isBuffer(other)) {
  21262. return false;
  21263. }
  21264. objIsArr = true;
  21265. objIsObj = false;
  21266. }
  21267. if (isSameTag && !objIsObj) {
  21268. stack || (stack = new Stack);
  21269. return (objIsArr || isTypedArray(object))
  21270. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21271. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21272. }
  21273. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21274. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21275. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21276. if (objIsWrapped || othIsWrapped) {
  21277. var objUnwrapped = objIsWrapped ? object.value() : object,
  21278. othUnwrapped = othIsWrapped ? other.value() : other;
  21279. stack || (stack = new Stack);
  21280. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21281. }
  21282. }
  21283. if (!isSameTag) {
  21284. return false;
  21285. }
  21286. stack || (stack = new Stack);
  21287. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21288. }
  21289. /**
  21290. * The base implementation of `_.isMap` without Node.js optimizations.
  21291. *
  21292. * @private
  21293. * @param {*} value The value to check.
  21294. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21295. */
  21296. function baseIsMap(value) {
  21297. return isObjectLike(value) && getTag(value) == mapTag;
  21298. }
  21299. /**
  21300. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21301. *
  21302. * @private
  21303. * @param {Object} object The object to inspect.
  21304. * @param {Object} source The object of property values to match.
  21305. * @param {Array} matchData The property names, values, and compare flags to match.
  21306. * @param {Function} [customizer] The function to customize comparisons.
  21307. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21308. */
  21309. function baseIsMatch(object, source, matchData, customizer) {
  21310. var index = matchData.length,
  21311. length = index,
  21312. noCustomizer = !customizer;
  21313. if (object == null) {
  21314. return !length;
  21315. }
  21316. object = Object(object);
  21317. while (index--) {
  21318. var data = matchData[index];
  21319. if ((noCustomizer && data[2])
  21320. ? data[1] !== object[data[0]]
  21321. : !(data[0] in object)
  21322. ) {
  21323. return false;
  21324. }
  21325. }
  21326. while (++index < length) {
  21327. data = matchData[index];
  21328. var key = data[0],
  21329. objValue = object[key],
  21330. srcValue = data[1];
  21331. if (noCustomizer && data[2]) {
  21332. if (objValue === undefined && !(key in object)) {
  21333. return false;
  21334. }
  21335. } else {
  21336. var stack = new Stack;
  21337. if (customizer) {
  21338. var result = customizer(objValue, srcValue, key, object, source, stack);
  21339. }
  21340. if (!(result === undefined
  21341. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21342. : result
  21343. )) {
  21344. return false;
  21345. }
  21346. }
  21347. }
  21348. return true;
  21349. }
  21350. /**
  21351. * The base implementation of `_.isNative` without bad shim checks.
  21352. *
  21353. * @private
  21354. * @param {*} value The value to check.
  21355. * @returns {boolean} Returns `true` if `value` is a native function,
  21356. * else `false`.
  21357. */
  21358. function baseIsNative(value) {
  21359. if (!isObject(value) || isMasked(value)) {
  21360. return false;
  21361. }
  21362. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21363. return pattern.test(toSource(value));
  21364. }
  21365. /**
  21366. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21367. *
  21368. * @private
  21369. * @param {*} value The value to check.
  21370. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21371. */
  21372. function baseIsRegExp(value) {
  21373. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21374. }
  21375. /**
  21376. * The base implementation of `_.isSet` without Node.js optimizations.
  21377. *
  21378. * @private
  21379. * @param {*} value The value to check.
  21380. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21381. */
  21382. function baseIsSet(value) {
  21383. return isObjectLike(value) && getTag(value) == setTag;
  21384. }
  21385. /**
  21386. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21387. *
  21388. * @private
  21389. * @param {*} value The value to check.
  21390. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21391. */
  21392. function baseIsTypedArray(value) {
  21393. return isObjectLike(value) &&
  21394. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21395. }
  21396. /**
  21397. * The base implementation of `_.iteratee`.
  21398. *
  21399. * @private
  21400. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21401. * @returns {Function} Returns the iteratee.
  21402. */
  21403. function baseIteratee(value) {
  21404. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21405. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21406. if (typeof value == 'function') {
  21407. return value;
  21408. }
  21409. if (value == null) {
  21410. return identity;
  21411. }
  21412. if (typeof value == 'object') {
  21413. return isArray(value)
  21414. ? baseMatchesProperty(value[0], value[1])
  21415. : baseMatches(value);
  21416. }
  21417. return property(value);
  21418. }
  21419. /**
  21420. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21421. *
  21422. * @private
  21423. * @param {Object} object The object to query.
  21424. * @returns {Array} Returns the array of property names.
  21425. */
  21426. function baseKeys(object) {
  21427. if (!isPrototype(object)) {
  21428. return nativeKeys(object);
  21429. }
  21430. var result = [];
  21431. for (var key in Object(object)) {
  21432. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21433. result.push(key);
  21434. }
  21435. }
  21436. return result;
  21437. }
  21438. /**
  21439. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21440. *
  21441. * @private
  21442. * @param {Object} object The object to query.
  21443. * @returns {Array} Returns the array of property names.
  21444. */
  21445. function baseKeysIn(object) {
  21446. if (!isObject(object)) {
  21447. return nativeKeysIn(object);
  21448. }
  21449. var isProto = isPrototype(object),
  21450. result = [];
  21451. for (var key in object) {
  21452. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21453. result.push(key);
  21454. }
  21455. }
  21456. return result;
  21457. }
  21458. /**
  21459. * The base implementation of `_.lt` which doesn't coerce arguments.
  21460. *
  21461. * @private
  21462. * @param {*} value The value to compare.
  21463. * @param {*} other The other value to compare.
  21464. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21465. * else `false`.
  21466. */
  21467. function baseLt(value, other) {
  21468. return value < other;
  21469. }
  21470. /**
  21471. * The base implementation of `_.map` without support for iteratee shorthands.
  21472. *
  21473. * @private
  21474. * @param {Array|Object} collection The collection to iterate over.
  21475. * @param {Function} iteratee The function invoked per iteration.
  21476. * @returns {Array} Returns the new mapped array.
  21477. */
  21478. function baseMap(collection, iteratee) {
  21479. var index = -1,
  21480. result = isArrayLike(collection) ? Array(collection.length) : [];
  21481. baseEach(collection, function(value, key, collection) {
  21482. result[++index] = iteratee(value, key, collection);
  21483. });
  21484. return result;
  21485. }
  21486. /**
  21487. * The base implementation of `_.matches` which doesn't clone `source`.
  21488. *
  21489. * @private
  21490. * @param {Object} source The object of property values to match.
  21491. * @returns {Function} Returns the new spec function.
  21492. */
  21493. function baseMatches(source) {
  21494. var matchData = getMatchData(source);
  21495. if (matchData.length == 1 && matchData[0][2]) {
  21496. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21497. }
  21498. return function(object) {
  21499. return object === source || baseIsMatch(object, source, matchData);
  21500. };
  21501. }
  21502. /**
  21503. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21504. *
  21505. * @private
  21506. * @param {string} path The path of the property to get.
  21507. * @param {*} srcValue The value to match.
  21508. * @returns {Function} Returns the new spec function.
  21509. */
  21510. function baseMatchesProperty(path, srcValue) {
  21511. if (isKey(path) && isStrictComparable(srcValue)) {
  21512. return matchesStrictComparable(toKey(path), srcValue);
  21513. }
  21514. return function(object) {
  21515. var objValue = get(object, path);
  21516. return (objValue === undefined && objValue === srcValue)
  21517. ? hasIn(object, path)
  21518. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21519. };
  21520. }
  21521. /**
  21522. * The base implementation of `_.merge` without support for multiple sources.
  21523. *
  21524. * @private
  21525. * @param {Object} object The destination object.
  21526. * @param {Object} source The source object.
  21527. * @param {number} srcIndex The index of `source`.
  21528. * @param {Function} [customizer] The function to customize merged values.
  21529. * @param {Object} [stack] Tracks traversed source values and their merged
  21530. * counterparts.
  21531. */
  21532. function baseMerge(object, source, srcIndex, customizer, stack) {
  21533. if (object === source) {
  21534. return;
  21535. }
  21536. baseFor(source, function(srcValue, key) {
  21537. stack || (stack = new Stack);
  21538. if (isObject(srcValue)) {
  21539. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21540. }
  21541. else {
  21542. var newValue = customizer
  21543. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21544. : undefined;
  21545. if (newValue === undefined) {
  21546. newValue = srcValue;
  21547. }
  21548. assignMergeValue(object, key, newValue);
  21549. }
  21550. }, keysIn);
  21551. }
  21552. /**
  21553. * A specialized version of `baseMerge` for arrays and objects which performs
  21554. * deep merges and tracks traversed objects enabling objects with circular
  21555. * references to be merged.
  21556. *
  21557. * @private
  21558. * @param {Object} object The destination object.
  21559. * @param {Object} source The source object.
  21560. * @param {string} key The key of the value to merge.
  21561. * @param {number} srcIndex The index of `source`.
  21562. * @param {Function} mergeFunc The function to merge values.
  21563. * @param {Function} [customizer] The function to customize assigned values.
  21564. * @param {Object} [stack] Tracks traversed source values and their merged
  21565. * counterparts.
  21566. */
  21567. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21568. var objValue = safeGet(object, key),
  21569. srcValue = safeGet(source, key),
  21570. stacked = stack.get(srcValue);
  21571. if (stacked) {
  21572. assignMergeValue(object, key, stacked);
  21573. return;
  21574. }
  21575. var newValue = customizer
  21576. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21577. : undefined;
  21578. var isCommon = newValue === undefined;
  21579. if (isCommon) {
  21580. var isArr = isArray(srcValue),
  21581. isBuff = !isArr && isBuffer(srcValue),
  21582. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21583. newValue = srcValue;
  21584. if (isArr || isBuff || isTyped) {
  21585. if (isArray(objValue)) {
  21586. newValue = objValue;
  21587. }
  21588. else if (isArrayLikeObject(objValue)) {
  21589. newValue = copyArray(objValue);
  21590. }
  21591. else if (isBuff) {
  21592. isCommon = false;
  21593. newValue = cloneBuffer(srcValue, true);
  21594. }
  21595. else if (isTyped) {
  21596. isCommon = false;
  21597. newValue = cloneTypedArray(srcValue, true);
  21598. }
  21599. else {
  21600. newValue = [];
  21601. }
  21602. }
  21603. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21604. newValue = objValue;
  21605. if (isArguments(objValue)) {
  21606. newValue = toPlainObject(objValue);
  21607. }
  21608. else if (!isObject(objValue) || isFunction(objValue)) {
  21609. newValue = initCloneObject(srcValue);
  21610. }
  21611. }
  21612. else {
  21613. isCommon = false;
  21614. }
  21615. }
  21616. if (isCommon) {
  21617. // Recursively merge objects and arrays (susceptible to call stack limits).
  21618. stack.set(srcValue, newValue);
  21619. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21620. stack['delete'](srcValue);
  21621. }
  21622. assignMergeValue(object, key, newValue);
  21623. }
  21624. /**
  21625. * The base implementation of `_.nth` which doesn't coerce arguments.
  21626. *
  21627. * @private
  21628. * @param {Array} array The array to query.
  21629. * @param {number} n The index of the element to return.
  21630. * @returns {*} Returns the nth element of `array`.
  21631. */
  21632. function baseNth(array, n) {
  21633. var length = array.length;
  21634. if (!length) {
  21635. return;
  21636. }
  21637. n += n < 0 ? length : 0;
  21638. return isIndex(n, length) ? array[n] : undefined;
  21639. }
  21640. /**
  21641. * The base implementation of `_.orderBy` without param guards.
  21642. *
  21643. * @private
  21644. * @param {Array|Object} collection The collection to iterate over.
  21645. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21646. * @param {string[]} orders The sort orders of `iteratees`.
  21647. * @returns {Array} Returns the new sorted array.
  21648. */
  21649. function baseOrderBy(collection, iteratees, orders) {
  21650. var index = -1;
  21651. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21652. var result = baseMap(collection, function(value, key, collection) {
  21653. var criteria = arrayMap(iteratees, function(iteratee) {
  21654. return iteratee(value);
  21655. });
  21656. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21657. });
  21658. return baseSortBy(result, function(object, other) {
  21659. return compareMultiple(object, other, orders);
  21660. });
  21661. }
  21662. /**
  21663. * The base implementation of `_.pick` without support for individual
  21664. * property identifiers.
  21665. *
  21666. * @private
  21667. * @param {Object} object The source object.
  21668. * @param {string[]} paths The property paths to pick.
  21669. * @returns {Object} Returns the new object.
  21670. */
  21671. function basePick(object, paths) {
  21672. return basePickBy(object, paths, function(value, path) {
  21673. return hasIn(object, path);
  21674. });
  21675. }
  21676. /**
  21677. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21678. *
  21679. * @private
  21680. * @param {Object} object The source object.
  21681. * @param {string[]} paths The property paths to pick.
  21682. * @param {Function} predicate The function invoked per property.
  21683. * @returns {Object} Returns the new object.
  21684. */
  21685. function basePickBy(object, paths, predicate) {
  21686. var index = -1,
  21687. length = paths.length,
  21688. result = {};
  21689. while (++index < length) {
  21690. var path = paths[index],
  21691. value = baseGet(object, path);
  21692. if (predicate(value, path)) {
  21693. baseSet(result, castPath(path, object), value);
  21694. }
  21695. }
  21696. return result;
  21697. }
  21698. /**
  21699. * A specialized version of `baseProperty` which supports deep paths.
  21700. *
  21701. * @private
  21702. * @param {Array|string} path The path of the property to get.
  21703. * @returns {Function} Returns the new accessor function.
  21704. */
  21705. function basePropertyDeep(path) {
  21706. return function(object) {
  21707. return baseGet(object, path);
  21708. };
  21709. }
  21710. /**
  21711. * The base implementation of `_.pullAllBy` without support for iteratee
  21712. * shorthands.
  21713. *
  21714. * @private
  21715. * @param {Array} array The array to modify.
  21716. * @param {Array} values The values to remove.
  21717. * @param {Function} [iteratee] The iteratee invoked per element.
  21718. * @param {Function} [comparator] The comparator invoked per element.
  21719. * @returns {Array} Returns `array`.
  21720. */
  21721. function basePullAll(array, values, iteratee, comparator) {
  21722. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21723. index = -1,
  21724. length = values.length,
  21725. seen = array;
  21726. if (array === values) {
  21727. values = copyArray(values);
  21728. }
  21729. if (iteratee) {
  21730. seen = arrayMap(array, baseUnary(iteratee));
  21731. }
  21732. while (++index < length) {
  21733. var fromIndex = 0,
  21734. value = values[index],
  21735. computed = iteratee ? iteratee(value) : value;
  21736. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21737. if (seen !== array) {
  21738. splice.call(seen, fromIndex, 1);
  21739. }
  21740. splice.call(array, fromIndex, 1);
  21741. }
  21742. }
  21743. return array;
  21744. }
  21745. /**
  21746. * The base implementation of `_.pullAt` without support for individual
  21747. * indexes or capturing the removed elements.
  21748. *
  21749. * @private
  21750. * @param {Array} array The array to modify.
  21751. * @param {number[]} indexes The indexes of elements to remove.
  21752. * @returns {Array} Returns `array`.
  21753. */
  21754. function basePullAt(array, indexes) {
  21755. var length = array ? indexes.length : 0,
  21756. lastIndex = length - 1;
  21757. while (length--) {
  21758. var index = indexes[length];
  21759. if (length == lastIndex || index !== previous) {
  21760. var previous = index;
  21761. if (isIndex(index)) {
  21762. splice.call(array, index, 1);
  21763. } else {
  21764. baseUnset(array, index);
  21765. }
  21766. }
  21767. }
  21768. return array;
  21769. }
  21770. /**
  21771. * The base implementation of `_.random` without support for returning
  21772. * floating-point numbers.
  21773. *
  21774. * @private
  21775. * @param {number} lower The lower bound.
  21776. * @param {number} upper The upper bound.
  21777. * @returns {number} Returns the random number.
  21778. */
  21779. function baseRandom(lower, upper) {
  21780. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21781. }
  21782. /**
  21783. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21784. * coerce arguments.
  21785. *
  21786. * @private
  21787. * @param {number} start The start of the range.
  21788. * @param {number} end The end of the range.
  21789. * @param {number} step The value to increment or decrement by.
  21790. * @param {boolean} [fromRight] Specify iterating from right to left.
  21791. * @returns {Array} Returns the range of numbers.
  21792. */
  21793. function baseRange(start, end, step, fromRight) {
  21794. var index = -1,
  21795. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21796. result = Array(length);
  21797. while (length--) {
  21798. result[fromRight ? length : ++index] = start;
  21799. start += step;
  21800. }
  21801. return result;
  21802. }
  21803. /**
  21804. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21805. *
  21806. * @private
  21807. * @param {string} string The string to repeat.
  21808. * @param {number} n The number of times to repeat the string.
  21809. * @returns {string} Returns the repeated string.
  21810. */
  21811. function baseRepeat(string, n) {
  21812. var result = '';
  21813. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21814. return result;
  21815. }
  21816. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21817. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21818. do {
  21819. if (n % 2) {
  21820. result += string;
  21821. }
  21822. n = nativeFloor(n / 2);
  21823. if (n) {
  21824. string += string;
  21825. }
  21826. } while (n);
  21827. return result;
  21828. }
  21829. /**
  21830. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21831. *
  21832. * @private
  21833. * @param {Function} func The function to apply a rest parameter to.
  21834. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21835. * @returns {Function} Returns the new function.
  21836. */
  21837. function baseRest(func, start) {
  21838. return setToString(overRest(func, start, identity), func + '');
  21839. }
  21840. /**
  21841. * The base implementation of `_.sample`.
  21842. *
  21843. * @private
  21844. * @param {Array|Object} collection The collection to sample.
  21845. * @returns {*} Returns the random element.
  21846. */
  21847. function baseSample(collection) {
  21848. return arraySample(values(collection));
  21849. }
  21850. /**
  21851. * The base implementation of `_.sampleSize` without param guards.
  21852. *
  21853. * @private
  21854. * @param {Array|Object} collection The collection to sample.
  21855. * @param {number} n The number of elements to sample.
  21856. * @returns {Array} Returns the random elements.
  21857. */
  21858. function baseSampleSize(collection, n) {
  21859. var array = values(collection);
  21860. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21861. }
  21862. /**
  21863. * The base implementation of `_.set`.
  21864. *
  21865. * @private
  21866. * @param {Object} object The object to modify.
  21867. * @param {Array|string} path The path of the property to set.
  21868. * @param {*} value The value to set.
  21869. * @param {Function} [customizer] The function to customize path creation.
  21870. * @returns {Object} Returns `object`.
  21871. */
  21872. function baseSet(object, path, value, customizer) {
  21873. if (!isObject(object)) {
  21874. return object;
  21875. }
  21876. path = castPath(path, object);
  21877. var index = -1,
  21878. length = path.length,
  21879. lastIndex = length - 1,
  21880. nested = object;
  21881. while (nested != null && ++index < length) {
  21882. var key = toKey(path[index]),
  21883. newValue = value;
  21884. if (index != lastIndex) {
  21885. var objValue = nested[key];
  21886. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21887. if (newValue === undefined) {
  21888. newValue = isObject(objValue)
  21889. ? objValue
  21890. : (isIndex(path[index + 1]) ? [] : {});
  21891. }
  21892. }
  21893. assignValue(nested, key, newValue);
  21894. nested = nested[key];
  21895. }
  21896. return object;
  21897. }
  21898. /**
  21899. * The base implementation of `setData` without support for hot loop shorting.
  21900. *
  21901. * @private
  21902. * @param {Function} func The function to associate metadata with.
  21903. * @param {*} data The metadata.
  21904. * @returns {Function} Returns `func`.
  21905. */
  21906. var baseSetData = !metaMap ? identity : function(func, data) {
  21907. metaMap.set(func, data);
  21908. return func;
  21909. };
  21910. /**
  21911. * The base implementation of `setToString` without support for hot loop shorting.
  21912. *
  21913. * @private
  21914. * @param {Function} func The function to modify.
  21915. * @param {Function} string The `toString` result.
  21916. * @returns {Function} Returns `func`.
  21917. */
  21918. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21919. return defineProperty(func, 'toString', {
  21920. 'configurable': true,
  21921. 'enumerable': false,
  21922. 'value': constant(string),
  21923. 'writable': true
  21924. });
  21925. };
  21926. /**
  21927. * The base implementation of `_.shuffle`.
  21928. *
  21929. * @private
  21930. * @param {Array|Object} collection The collection to shuffle.
  21931. * @returns {Array} Returns the new shuffled array.
  21932. */
  21933. function baseShuffle(collection) {
  21934. return shuffleSelf(values(collection));
  21935. }
  21936. /**
  21937. * The base implementation of `_.slice` without an iteratee call guard.
  21938. *
  21939. * @private
  21940. * @param {Array} array The array to slice.
  21941. * @param {number} [start=0] The start position.
  21942. * @param {number} [end=array.length] The end position.
  21943. * @returns {Array} Returns the slice of `array`.
  21944. */
  21945. function baseSlice(array, start, end) {
  21946. var index = -1,
  21947. length = array.length;
  21948. if (start < 0) {
  21949. start = -start > length ? 0 : (length + start);
  21950. }
  21951. end = end > length ? length : end;
  21952. if (end < 0) {
  21953. end += length;
  21954. }
  21955. length = start > end ? 0 : ((end - start) >>> 0);
  21956. start >>>= 0;
  21957. var result = Array(length);
  21958. while (++index < length) {
  21959. result[index] = array[index + start];
  21960. }
  21961. return result;
  21962. }
  21963. /**
  21964. * The base implementation of `_.some` without support for iteratee shorthands.
  21965. *
  21966. * @private
  21967. * @param {Array|Object} collection The collection to iterate over.
  21968. * @param {Function} predicate The function invoked per iteration.
  21969. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21970. * else `false`.
  21971. */
  21972. function baseSome(collection, predicate) {
  21973. var result;
  21974. baseEach(collection, function(value, index, collection) {
  21975. result = predicate(value, index, collection);
  21976. return !result;
  21977. });
  21978. return !!result;
  21979. }
  21980. /**
  21981. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21982. * performs a binary search of `array` to determine the index at which `value`
  21983. * should be inserted into `array` in order to maintain its sort order.
  21984. *
  21985. * @private
  21986. * @param {Array} array The sorted array to inspect.
  21987. * @param {*} value The value to evaluate.
  21988. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21989. * @returns {number} Returns the index at which `value` should be inserted
  21990. * into `array`.
  21991. */
  21992. function baseSortedIndex(array, value, retHighest) {
  21993. var low = 0,
  21994. high = array == null ? low : array.length;
  21995. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21996. while (low < high) {
  21997. var mid = (low + high) >>> 1,
  21998. computed = array[mid];
  21999. if (computed !== null && !isSymbol(computed) &&
  22000. (retHighest ? (computed <= value) : (computed < value))) {
  22001. low = mid + 1;
  22002. } else {
  22003. high = mid;
  22004. }
  22005. }
  22006. return high;
  22007. }
  22008. return baseSortedIndexBy(array, value, identity, retHighest);
  22009. }
  22010. /**
  22011. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22012. * which invokes `iteratee` for `value` and each element of `array` to compute
  22013. * their sort ranking. The iteratee is invoked with one argument; (value).
  22014. *
  22015. * @private
  22016. * @param {Array} array The sorted array to inspect.
  22017. * @param {*} value The value to evaluate.
  22018. * @param {Function} iteratee The iteratee invoked per element.
  22019. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22020. * @returns {number} Returns the index at which `value` should be inserted
  22021. * into `array`.
  22022. */
  22023. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22024. value = iteratee(value);
  22025. var low = 0,
  22026. high = array == null ? 0 : array.length,
  22027. valIsNaN = value !== value,
  22028. valIsNull = value === null,
  22029. valIsSymbol = isSymbol(value),
  22030. valIsUndefined = value === undefined;
  22031. while (low < high) {
  22032. var mid = nativeFloor((low + high) / 2),
  22033. computed = iteratee(array[mid]),
  22034. othIsDefined = computed !== undefined,
  22035. othIsNull = computed === null,
  22036. othIsReflexive = computed === computed,
  22037. othIsSymbol = isSymbol(computed);
  22038. if (valIsNaN) {
  22039. var setLow = retHighest || othIsReflexive;
  22040. } else if (valIsUndefined) {
  22041. setLow = othIsReflexive && (retHighest || othIsDefined);
  22042. } else if (valIsNull) {
  22043. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22044. } else if (valIsSymbol) {
  22045. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22046. } else if (othIsNull || othIsSymbol) {
  22047. setLow = false;
  22048. } else {
  22049. setLow = retHighest ? (computed <= value) : (computed < value);
  22050. }
  22051. if (setLow) {
  22052. low = mid + 1;
  22053. } else {
  22054. high = mid;
  22055. }
  22056. }
  22057. return nativeMin(high, MAX_ARRAY_INDEX);
  22058. }
  22059. /**
  22060. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22061. * support for iteratee shorthands.
  22062. *
  22063. * @private
  22064. * @param {Array} array The array to inspect.
  22065. * @param {Function} [iteratee] The iteratee invoked per element.
  22066. * @returns {Array} Returns the new duplicate free array.
  22067. */
  22068. function baseSortedUniq(array, iteratee) {
  22069. var index = -1,
  22070. length = array.length,
  22071. resIndex = 0,
  22072. result = [];
  22073. while (++index < length) {
  22074. var value = array[index],
  22075. computed = iteratee ? iteratee(value) : value;
  22076. if (!index || !eq(computed, seen)) {
  22077. var seen = computed;
  22078. result[resIndex++] = value === 0 ? 0 : value;
  22079. }
  22080. }
  22081. return result;
  22082. }
  22083. /**
  22084. * The base implementation of `_.toNumber` which doesn't ensure correct
  22085. * conversions of binary, hexadecimal, or octal string values.
  22086. *
  22087. * @private
  22088. * @param {*} value The value to process.
  22089. * @returns {number} Returns the number.
  22090. */
  22091. function baseToNumber(value) {
  22092. if (typeof value == 'number') {
  22093. return value;
  22094. }
  22095. if (isSymbol(value)) {
  22096. return NAN;
  22097. }
  22098. return +value;
  22099. }
  22100. /**
  22101. * The base implementation of `_.toString` which doesn't convert nullish
  22102. * values to empty strings.
  22103. *
  22104. * @private
  22105. * @param {*} value The value to process.
  22106. * @returns {string} Returns the string.
  22107. */
  22108. function baseToString(value) {
  22109. // Exit early for strings to avoid a performance hit in some environments.
  22110. if (typeof value == 'string') {
  22111. return value;
  22112. }
  22113. if (isArray(value)) {
  22114. // Recursively convert values (susceptible to call stack limits).
  22115. return arrayMap(value, baseToString) + '';
  22116. }
  22117. if (isSymbol(value)) {
  22118. return symbolToString ? symbolToString.call(value) : '';
  22119. }
  22120. var result = (value + '');
  22121. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22122. }
  22123. /**
  22124. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22125. *
  22126. * @private
  22127. * @param {Array} array The array to inspect.
  22128. * @param {Function} [iteratee] The iteratee invoked per element.
  22129. * @param {Function} [comparator] The comparator invoked per element.
  22130. * @returns {Array} Returns the new duplicate free array.
  22131. */
  22132. function baseUniq(array, iteratee, comparator) {
  22133. var index = -1,
  22134. includes = arrayIncludes,
  22135. length = array.length,
  22136. isCommon = true,
  22137. result = [],
  22138. seen = result;
  22139. if (comparator) {
  22140. isCommon = false;
  22141. includes = arrayIncludesWith;
  22142. }
  22143. else if (length >= LARGE_ARRAY_SIZE) {
  22144. var set = iteratee ? null : createSet(array);
  22145. if (set) {
  22146. return setToArray(set);
  22147. }
  22148. isCommon = false;
  22149. includes = cacheHas;
  22150. seen = new SetCache;
  22151. }
  22152. else {
  22153. seen = iteratee ? [] : result;
  22154. }
  22155. outer:
  22156. while (++index < length) {
  22157. var value = array[index],
  22158. computed = iteratee ? iteratee(value) : value;
  22159. value = (comparator || value !== 0) ? value : 0;
  22160. if (isCommon && computed === computed) {
  22161. var seenIndex = seen.length;
  22162. while (seenIndex--) {
  22163. if (seen[seenIndex] === computed) {
  22164. continue outer;
  22165. }
  22166. }
  22167. if (iteratee) {
  22168. seen.push(computed);
  22169. }
  22170. result.push(value);
  22171. }
  22172. else if (!includes(seen, computed, comparator)) {
  22173. if (seen !== result) {
  22174. seen.push(computed);
  22175. }
  22176. result.push(value);
  22177. }
  22178. }
  22179. return result;
  22180. }
  22181. /**
  22182. * The base implementation of `_.unset`.
  22183. *
  22184. * @private
  22185. * @param {Object} object The object to modify.
  22186. * @param {Array|string} path The property path to unset.
  22187. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22188. */
  22189. function baseUnset(object, path) {
  22190. path = castPath(path, object);
  22191. object = parent(object, path);
  22192. return object == null || delete object[toKey(last(path))];
  22193. }
  22194. /**
  22195. * The base implementation of `_.update`.
  22196. *
  22197. * @private
  22198. * @param {Object} object The object to modify.
  22199. * @param {Array|string} path The path of the property to update.
  22200. * @param {Function} updater The function to produce the updated value.
  22201. * @param {Function} [customizer] The function to customize path creation.
  22202. * @returns {Object} Returns `object`.
  22203. */
  22204. function baseUpdate(object, path, updater, customizer) {
  22205. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22206. }
  22207. /**
  22208. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22209. * without support for iteratee shorthands.
  22210. *
  22211. * @private
  22212. * @param {Array} array The array to query.
  22213. * @param {Function} predicate The function invoked per iteration.
  22214. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22215. * @param {boolean} [fromRight] Specify iterating from right to left.
  22216. * @returns {Array} Returns the slice of `array`.
  22217. */
  22218. function baseWhile(array, predicate, isDrop, fromRight) {
  22219. var length = array.length,
  22220. index = fromRight ? length : -1;
  22221. while ((fromRight ? index-- : ++index < length) &&
  22222. predicate(array[index], index, array)) {}
  22223. return isDrop
  22224. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22225. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22226. }
  22227. /**
  22228. * The base implementation of `wrapperValue` which returns the result of
  22229. * performing a sequence of actions on the unwrapped `value`, where each
  22230. * successive action is supplied the return value of the previous.
  22231. *
  22232. * @private
  22233. * @param {*} value The unwrapped value.
  22234. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22235. * @returns {*} Returns the resolved value.
  22236. */
  22237. function baseWrapperValue(value, actions) {
  22238. var result = value;
  22239. if (result instanceof LazyWrapper) {
  22240. result = result.value();
  22241. }
  22242. return arrayReduce(actions, function(result, action) {
  22243. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22244. }, result);
  22245. }
  22246. /**
  22247. * The base implementation of methods like `_.xor`, without support for
  22248. * iteratee shorthands, that accepts an array of arrays to inspect.
  22249. *
  22250. * @private
  22251. * @param {Array} arrays The arrays to inspect.
  22252. * @param {Function} [iteratee] The iteratee invoked per element.
  22253. * @param {Function} [comparator] The comparator invoked per element.
  22254. * @returns {Array} Returns the new array of values.
  22255. */
  22256. function baseXor(arrays, iteratee, comparator) {
  22257. var length = arrays.length;
  22258. if (length < 2) {
  22259. return length ? baseUniq(arrays[0]) : [];
  22260. }
  22261. var index = -1,
  22262. result = Array(length);
  22263. while (++index < length) {
  22264. var array = arrays[index],
  22265. othIndex = -1;
  22266. while (++othIndex < length) {
  22267. if (othIndex != index) {
  22268. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22269. }
  22270. }
  22271. }
  22272. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22273. }
  22274. /**
  22275. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22276. *
  22277. * @private
  22278. * @param {Array} props The property identifiers.
  22279. * @param {Array} values The property values.
  22280. * @param {Function} assignFunc The function to assign values.
  22281. * @returns {Object} Returns the new object.
  22282. */
  22283. function baseZipObject(props, values, assignFunc) {
  22284. var index = -1,
  22285. length = props.length,
  22286. valsLength = values.length,
  22287. result = {};
  22288. while (++index < length) {
  22289. var value = index < valsLength ? values[index] : undefined;
  22290. assignFunc(result, props[index], value);
  22291. }
  22292. return result;
  22293. }
  22294. /**
  22295. * Casts `value` to an empty array if it's not an array like object.
  22296. *
  22297. * @private
  22298. * @param {*} value The value to inspect.
  22299. * @returns {Array|Object} Returns the cast array-like object.
  22300. */
  22301. function castArrayLikeObject(value) {
  22302. return isArrayLikeObject(value) ? value : [];
  22303. }
  22304. /**
  22305. * Casts `value` to `identity` if it's not a function.
  22306. *
  22307. * @private
  22308. * @param {*} value The value to inspect.
  22309. * @returns {Function} Returns cast function.
  22310. */
  22311. function castFunction(value) {
  22312. return typeof value == 'function' ? value : identity;
  22313. }
  22314. /**
  22315. * Casts `value` to a path array if it's not one.
  22316. *
  22317. * @private
  22318. * @param {*} value The value to inspect.
  22319. * @param {Object} [object] The object to query keys on.
  22320. * @returns {Array} Returns the cast property path array.
  22321. */
  22322. function castPath(value, object) {
  22323. if (isArray(value)) {
  22324. return value;
  22325. }
  22326. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22327. }
  22328. /**
  22329. * A `baseRest` alias which can be replaced with `identity` by module
  22330. * replacement plugins.
  22331. *
  22332. * @private
  22333. * @type {Function}
  22334. * @param {Function} func The function to apply a rest parameter to.
  22335. * @returns {Function} Returns the new function.
  22336. */
  22337. var castRest = baseRest;
  22338. /**
  22339. * Casts `array` to a slice if it's needed.
  22340. *
  22341. * @private
  22342. * @param {Array} array The array to inspect.
  22343. * @param {number} start The start position.
  22344. * @param {number} [end=array.length] The end position.
  22345. * @returns {Array} Returns the cast slice.
  22346. */
  22347. function castSlice(array, start, end) {
  22348. var length = array.length;
  22349. end = end === undefined ? length : end;
  22350. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22351. }
  22352. /**
  22353. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22354. *
  22355. * @private
  22356. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22357. */
  22358. var clearTimeout = ctxClearTimeout || function(id) {
  22359. return root.clearTimeout(id);
  22360. };
  22361. /**
  22362. * Creates a clone of `buffer`.
  22363. *
  22364. * @private
  22365. * @param {Buffer} buffer The buffer to clone.
  22366. * @param {boolean} [isDeep] Specify a deep clone.
  22367. * @returns {Buffer} Returns the cloned buffer.
  22368. */
  22369. function cloneBuffer(buffer, isDeep) {
  22370. if (isDeep) {
  22371. return buffer.slice();
  22372. }
  22373. var length = buffer.length,
  22374. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22375. buffer.copy(result);
  22376. return result;
  22377. }
  22378. /**
  22379. * Creates a clone of `arrayBuffer`.
  22380. *
  22381. * @private
  22382. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22383. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22384. */
  22385. function cloneArrayBuffer(arrayBuffer) {
  22386. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22387. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22388. return result;
  22389. }
  22390. /**
  22391. * Creates a clone of `dataView`.
  22392. *
  22393. * @private
  22394. * @param {Object} dataView The data view to clone.
  22395. * @param {boolean} [isDeep] Specify a deep clone.
  22396. * @returns {Object} Returns the cloned data view.
  22397. */
  22398. function cloneDataView(dataView, isDeep) {
  22399. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22400. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22401. }
  22402. /**
  22403. * Creates a clone of `regexp`.
  22404. *
  22405. * @private
  22406. * @param {Object} regexp The regexp to clone.
  22407. * @returns {Object} Returns the cloned regexp.
  22408. */
  22409. function cloneRegExp(regexp) {
  22410. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22411. result.lastIndex = regexp.lastIndex;
  22412. return result;
  22413. }
  22414. /**
  22415. * Creates a clone of the `symbol` object.
  22416. *
  22417. * @private
  22418. * @param {Object} symbol The symbol object to clone.
  22419. * @returns {Object} Returns the cloned symbol object.
  22420. */
  22421. function cloneSymbol(symbol) {
  22422. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22423. }
  22424. /**
  22425. * Creates a clone of `typedArray`.
  22426. *
  22427. * @private
  22428. * @param {Object} typedArray The typed array to clone.
  22429. * @param {boolean} [isDeep] Specify a deep clone.
  22430. * @returns {Object} Returns the cloned typed array.
  22431. */
  22432. function cloneTypedArray(typedArray, isDeep) {
  22433. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22434. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22435. }
  22436. /**
  22437. * Compares values to sort them in ascending order.
  22438. *
  22439. * @private
  22440. * @param {*} value The value to compare.
  22441. * @param {*} other The other value to compare.
  22442. * @returns {number} Returns the sort order indicator for `value`.
  22443. */
  22444. function compareAscending(value, other) {
  22445. if (value !== other) {
  22446. var valIsDefined = value !== undefined,
  22447. valIsNull = value === null,
  22448. valIsReflexive = value === value,
  22449. valIsSymbol = isSymbol(value);
  22450. var othIsDefined = other !== undefined,
  22451. othIsNull = other === null,
  22452. othIsReflexive = other === other,
  22453. othIsSymbol = isSymbol(other);
  22454. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22455. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22456. (valIsNull && othIsDefined && othIsReflexive) ||
  22457. (!valIsDefined && othIsReflexive) ||
  22458. !valIsReflexive) {
  22459. return 1;
  22460. }
  22461. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22462. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22463. (othIsNull && valIsDefined && valIsReflexive) ||
  22464. (!othIsDefined && valIsReflexive) ||
  22465. !othIsReflexive) {
  22466. return -1;
  22467. }
  22468. }
  22469. return 0;
  22470. }
  22471. /**
  22472. * Used by `_.orderBy` to compare multiple properties of a value to another
  22473. * and stable sort them.
  22474. *
  22475. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22476. * specify an order of "desc" for descending or "asc" for ascending sort order
  22477. * of corresponding values.
  22478. *
  22479. * @private
  22480. * @param {Object} object The object to compare.
  22481. * @param {Object} other The other object to compare.
  22482. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22483. * @returns {number} Returns the sort order indicator for `object`.
  22484. */
  22485. function compareMultiple(object, other, orders) {
  22486. var index = -1,
  22487. objCriteria = object.criteria,
  22488. othCriteria = other.criteria,
  22489. length = objCriteria.length,
  22490. ordersLength = orders.length;
  22491. while (++index < length) {
  22492. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22493. if (result) {
  22494. if (index >= ordersLength) {
  22495. return result;
  22496. }
  22497. var order = orders[index];
  22498. return result * (order == 'desc' ? -1 : 1);
  22499. }
  22500. }
  22501. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22502. // that causes it, under certain circumstances, to provide the same value for
  22503. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22504. // for more details.
  22505. //
  22506. // This also ensures a stable sort in V8 and other engines.
  22507. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22508. return object.index - other.index;
  22509. }
  22510. /**
  22511. * Creates an array that is the composition of partially applied arguments,
  22512. * placeholders, and provided arguments into a single array of arguments.
  22513. *
  22514. * @private
  22515. * @param {Array} args The provided arguments.
  22516. * @param {Array} partials The arguments to prepend to those provided.
  22517. * @param {Array} holders The `partials` placeholder indexes.
  22518. * @params {boolean} [isCurried] Specify composing for a curried function.
  22519. * @returns {Array} Returns the new array of composed arguments.
  22520. */
  22521. function composeArgs(args, partials, holders, isCurried) {
  22522. var argsIndex = -1,
  22523. argsLength = args.length,
  22524. holdersLength = holders.length,
  22525. leftIndex = -1,
  22526. leftLength = partials.length,
  22527. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22528. result = Array(leftLength + rangeLength),
  22529. isUncurried = !isCurried;
  22530. while (++leftIndex < leftLength) {
  22531. result[leftIndex] = partials[leftIndex];
  22532. }
  22533. while (++argsIndex < holdersLength) {
  22534. if (isUncurried || argsIndex < argsLength) {
  22535. result[holders[argsIndex]] = args[argsIndex];
  22536. }
  22537. }
  22538. while (rangeLength--) {
  22539. result[leftIndex++] = args[argsIndex++];
  22540. }
  22541. return result;
  22542. }
  22543. /**
  22544. * This function is like `composeArgs` except that the arguments composition
  22545. * is tailored for `_.partialRight`.
  22546. *
  22547. * @private
  22548. * @param {Array} args The provided arguments.
  22549. * @param {Array} partials The arguments to append to those provided.
  22550. * @param {Array} holders The `partials` placeholder indexes.
  22551. * @params {boolean} [isCurried] Specify composing for a curried function.
  22552. * @returns {Array} Returns the new array of composed arguments.
  22553. */
  22554. function composeArgsRight(args, partials, holders, isCurried) {
  22555. var argsIndex = -1,
  22556. argsLength = args.length,
  22557. holdersIndex = -1,
  22558. holdersLength = holders.length,
  22559. rightIndex = -1,
  22560. rightLength = partials.length,
  22561. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22562. result = Array(rangeLength + rightLength),
  22563. isUncurried = !isCurried;
  22564. while (++argsIndex < rangeLength) {
  22565. result[argsIndex] = args[argsIndex];
  22566. }
  22567. var offset = argsIndex;
  22568. while (++rightIndex < rightLength) {
  22569. result[offset + rightIndex] = partials[rightIndex];
  22570. }
  22571. while (++holdersIndex < holdersLength) {
  22572. if (isUncurried || argsIndex < argsLength) {
  22573. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22574. }
  22575. }
  22576. return result;
  22577. }
  22578. /**
  22579. * Copies the values of `source` to `array`.
  22580. *
  22581. * @private
  22582. * @param {Array} source The array to copy values from.
  22583. * @param {Array} [array=[]] The array to copy values to.
  22584. * @returns {Array} Returns `array`.
  22585. */
  22586. function copyArray(source, array) {
  22587. var index = -1,
  22588. length = source.length;
  22589. array || (array = Array(length));
  22590. while (++index < length) {
  22591. array[index] = source[index];
  22592. }
  22593. return array;
  22594. }
  22595. /**
  22596. * Copies properties of `source` to `object`.
  22597. *
  22598. * @private
  22599. * @param {Object} source The object to copy properties from.
  22600. * @param {Array} props The property identifiers to copy.
  22601. * @param {Object} [object={}] The object to copy properties to.
  22602. * @param {Function} [customizer] The function to customize copied values.
  22603. * @returns {Object} Returns `object`.
  22604. */
  22605. function copyObject(source, props, object, customizer) {
  22606. var isNew = !object;
  22607. object || (object = {});
  22608. var index = -1,
  22609. length = props.length;
  22610. while (++index < length) {
  22611. var key = props[index];
  22612. var newValue = customizer
  22613. ? customizer(object[key], source[key], key, object, source)
  22614. : undefined;
  22615. if (newValue === undefined) {
  22616. newValue = source[key];
  22617. }
  22618. if (isNew) {
  22619. baseAssignValue(object, key, newValue);
  22620. } else {
  22621. assignValue(object, key, newValue);
  22622. }
  22623. }
  22624. return object;
  22625. }
  22626. /**
  22627. * Copies own symbols of `source` to `object`.
  22628. *
  22629. * @private
  22630. * @param {Object} source The object to copy symbols from.
  22631. * @param {Object} [object={}] The object to copy symbols to.
  22632. * @returns {Object} Returns `object`.
  22633. */
  22634. function copySymbols(source, object) {
  22635. return copyObject(source, getSymbols(source), object);
  22636. }
  22637. /**
  22638. * Copies own and inherited symbols of `source` to `object`.
  22639. *
  22640. * @private
  22641. * @param {Object} source The object to copy symbols from.
  22642. * @param {Object} [object={}] The object to copy symbols to.
  22643. * @returns {Object} Returns `object`.
  22644. */
  22645. function copySymbolsIn(source, object) {
  22646. return copyObject(source, getSymbolsIn(source), object);
  22647. }
  22648. /**
  22649. * Creates a function like `_.groupBy`.
  22650. *
  22651. * @private
  22652. * @param {Function} setter The function to set accumulator values.
  22653. * @param {Function} [initializer] The accumulator object initializer.
  22654. * @returns {Function} Returns the new aggregator function.
  22655. */
  22656. function createAggregator(setter, initializer) {
  22657. return function(collection, iteratee) {
  22658. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22659. accumulator = initializer ? initializer() : {};
  22660. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22661. };
  22662. }
  22663. /**
  22664. * Creates a function like `_.assign`.
  22665. *
  22666. * @private
  22667. * @param {Function} assigner The function to assign values.
  22668. * @returns {Function} Returns the new assigner function.
  22669. */
  22670. function createAssigner(assigner) {
  22671. return baseRest(function(object, sources) {
  22672. var index = -1,
  22673. length = sources.length,
  22674. customizer = length > 1 ? sources[length - 1] : undefined,
  22675. guard = length > 2 ? sources[2] : undefined;
  22676. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22677. ? (length--, customizer)
  22678. : undefined;
  22679. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22680. customizer = length < 3 ? undefined : customizer;
  22681. length = 1;
  22682. }
  22683. object = Object(object);
  22684. while (++index < length) {
  22685. var source = sources[index];
  22686. if (source) {
  22687. assigner(object, source, index, customizer);
  22688. }
  22689. }
  22690. return object;
  22691. });
  22692. }
  22693. /**
  22694. * Creates a `baseEach` or `baseEachRight` function.
  22695. *
  22696. * @private
  22697. * @param {Function} eachFunc The function to iterate over a collection.
  22698. * @param {boolean} [fromRight] Specify iterating from right to left.
  22699. * @returns {Function} Returns the new base function.
  22700. */
  22701. function createBaseEach(eachFunc, fromRight) {
  22702. return function(collection, iteratee) {
  22703. if (collection == null) {
  22704. return collection;
  22705. }
  22706. if (!isArrayLike(collection)) {
  22707. return eachFunc(collection, iteratee);
  22708. }
  22709. var length = collection.length,
  22710. index = fromRight ? length : -1,
  22711. iterable = Object(collection);
  22712. while ((fromRight ? index-- : ++index < length)) {
  22713. if (iteratee(iterable[index], index, iterable) === false) {
  22714. break;
  22715. }
  22716. }
  22717. return collection;
  22718. };
  22719. }
  22720. /**
  22721. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22722. *
  22723. * @private
  22724. * @param {boolean} [fromRight] Specify iterating from right to left.
  22725. * @returns {Function} Returns the new base function.
  22726. */
  22727. function createBaseFor(fromRight) {
  22728. return function(object, iteratee, keysFunc) {
  22729. var index = -1,
  22730. iterable = Object(object),
  22731. props = keysFunc(object),
  22732. length = props.length;
  22733. while (length--) {
  22734. var key = props[fromRight ? length : ++index];
  22735. if (iteratee(iterable[key], key, iterable) === false) {
  22736. break;
  22737. }
  22738. }
  22739. return object;
  22740. };
  22741. }
  22742. /**
  22743. * Creates a function that wraps `func` to invoke it with the optional `this`
  22744. * binding of `thisArg`.
  22745. *
  22746. * @private
  22747. * @param {Function} func The function to wrap.
  22748. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22749. * @param {*} [thisArg] The `this` binding of `func`.
  22750. * @returns {Function} Returns the new wrapped function.
  22751. */
  22752. function createBind(func, bitmask, thisArg) {
  22753. var isBind = bitmask & WRAP_BIND_FLAG,
  22754. Ctor = createCtor(func);
  22755. function wrapper() {
  22756. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22757. return fn.apply(isBind ? thisArg : this, arguments);
  22758. }
  22759. return wrapper;
  22760. }
  22761. /**
  22762. * Creates a function like `_.lowerFirst`.
  22763. *
  22764. * @private
  22765. * @param {string} methodName The name of the `String` case method to use.
  22766. * @returns {Function} Returns the new case function.
  22767. */
  22768. function createCaseFirst(methodName) {
  22769. return function(string) {
  22770. string = toString(string);
  22771. var strSymbols = hasUnicode(string)
  22772. ? stringToArray(string)
  22773. : undefined;
  22774. var chr = strSymbols
  22775. ? strSymbols[0]
  22776. : string.charAt(0);
  22777. var trailing = strSymbols
  22778. ? castSlice(strSymbols, 1).join('')
  22779. : string.slice(1);
  22780. return chr[methodName]() + trailing;
  22781. };
  22782. }
  22783. /**
  22784. * Creates a function like `_.camelCase`.
  22785. *
  22786. * @private
  22787. * @param {Function} callback The function to combine each word.
  22788. * @returns {Function} Returns the new compounder function.
  22789. */
  22790. function createCompounder(callback) {
  22791. return function(string) {
  22792. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22793. };
  22794. }
  22795. /**
  22796. * Creates a function that produces an instance of `Ctor` regardless of
  22797. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22798. *
  22799. * @private
  22800. * @param {Function} Ctor The constructor to wrap.
  22801. * @returns {Function} Returns the new wrapped function.
  22802. */
  22803. function createCtor(Ctor) {
  22804. return function() {
  22805. // Use a `switch` statement to work with class constructors. See
  22806. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22807. // for more details.
  22808. var args = arguments;
  22809. switch (args.length) {
  22810. case 0: return new Ctor;
  22811. case 1: return new Ctor(args[0]);
  22812. case 2: return new Ctor(args[0], args[1]);
  22813. case 3: return new Ctor(args[0], args[1], args[2]);
  22814. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22815. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22816. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22817. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22818. }
  22819. var thisBinding = baseCreate(Ctor.prototype),
  22820. result = Ctor.apply(thisBinding, args);
  22821. // Mimic the constructor's `return` behavior.
  22822. // See https://es5.github.io/#x13.2.2 for more details.
  22823. return isObject(result) ? result : thisBinding;
  22824. };
  22825. }
  22826. /**
  22827. * Creates a function that wraps `func` to enable currying.
  22828. *
  22829. * @private
  22830. * @param {Function} func The function to wrap.
  22831. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22832. * @param {number} arity The arity of `func`.
  22833. * @returns {Function} Returns the new wrapped function.
  22834. */
  22835. function createCurry(func, bitmask, arity) {
  22836. var Ctor = createCtor(func);
  22837. function wrapper() {
  22838. var length = arguments.length,
  22839. args = Array(length),
  22840. index = length,
  22841. placeholder = getHolder(wrapper);
  22842. while (index--) {
  22843. args[index] = arguments[index];
  22844. }
  22845. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22846. ? []
  22847. : replaceHolders(args, placeholder);
  22848. length -= holders.length;
  22849. if (length < arity) {
  22850. return createRecurry(
  22851. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22852. args, holders, undefined, undefined, arity - length);
  22853. }
  22854. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22855. return apply(fn, this, args);
  22856. }
  22857. return wrapper;
  22858. }
  22859. /**
  22860. * Creates a `_.find` or `_.findLast` function.
  22861. *
  22862. * @private
  22863. * @param {Function} findIndexFunc The function to find the collection index.
  22864. * @returns {Function} Returns the new find function.
  22865. */
  22866. function createFind(findIndexFunc) {
  22867. return function(collection, predicate, fromIndex) {
  22868. var iterable = Object(collection);
  22869. if (!isArrayLike(collection)) {
  22870. var iteratee = getIteratee(predicate, 3);
  22871. collection = keys(collection);
  22872. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22873. }
  22874. var index = findIndexFunc(collection, predicate, fromIndex);
  22875. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22876. };
  22877. }
  22878. /**
  22879. * Creates a `_.flow` or `_.flowRight` function.
  22880. *
  22881. * @private
  22882. * @param {boolean} [fromRight] Specify iterating from right to left.
  22883. * @returns {Function} Returns the new flow function.
  22884. */
  22885. function createFlow(fromRight) {
  22886. return flatRest(function(funcs) {
  22887. var length = funcs.length,
  22888. index = length,
  22889. prereq = LodashWrapper.prototype.thru;
  22890. if (fromRight) {
  22891. funcs.reverse();
  22892. }
  22893. while (index--) {
  22894. var func = funcs[index];
  22895. if (typeof func != 'function') {
  22896. throw new TypeError(FUNC_ERROR_TEXT);
  22897. }
  22898. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22899. var wrapper = new LodashWrapper([], true);
  22900. }
  22901. }
  22902. index = wrapper ? index : length;
  22903. while (++index < length) {
  22904. func = funcs[index];
  22905. var funcName = getFuncName(func),
  22906. data = funcName == 'wrapper' ? getData(func) : undefined;
  22907. if (data && isLaziable(data[0]) &&
  22908. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22909. !data[4].length && data[9] == 1
  22910. ) {
  22911. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22912. } else {
  22913. wrapper = (func.length == 1 && isLaziable(func))
  22914. ? wrapper[funcName]()
  22915. : wrapper.thru(func);
  22916. }
  22917. }
  22918. return function() {
  22919. var args = arguments,
  22920. value = args[0];
  22921. if (wrapper && args.length == 1 && isArray(value)) {
  22922. return wrapper.plant(value).value();
  22923. }
  22924. var index = 0,
  22925. result = length ? funcs[index].apply(this, args) : value;
  22926. while (++index < length) {
  22927. result = funcs[index].call(this, result);
  22928. }
  22929. return result;
  22930. };
  22931. });
  22932. }
  22933. /**
  22934. * Creates a function that wraps `func` to invoke it with optional `this`
  22935. * binding of `thisArg`, partial application, and currying.
  22936. *
  22937. * @private
  22938. * @param {Function|string} func The function or method name to wrap.
  22939. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22940. * @param {*} [thisArg] The `this` binding of `func`.
  22941. * @param {Array} [partials] The arguments to prepend to those provided to
  22942. * the new function.
  22943. * @param {Array} [holders] The `partials` placeholder indexes.
  22944. * @param {Array} [partialsRight] The arguments to append to those provided
  22945. * to the new function.
  22946. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22947. * @param {Array} [argPos] The argument positions of the new function.
  22948. * @param {number} [ary] The arity cap of `func`.
  22949. * @param {number} [arity] The arity of `func`.
  22950. * @returns {Function} Returns the new wrapped function.
  22951. */
  22952. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22953. var isAry = bitmask & WRAP_ARY_FLAG,
  22954. isBind = bitmask & WRAP_BIND_FLAG,
  22955. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22956. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22957. isFlip = bitmask & WRAP_FLIP_FLAG,
  22958. Ctor = isBindKey ? undefined : createCtor(func);
  22959. function wrapper() {
  22960. var length = arguments.length,
  22961. args = Array(length),
  22962. index = length;
  22963. while (index--) {
  22964. args[index] = arguments[index];
  22965. }
  22966. if (isCurried) {
  22967. var placeholder = getHolder(wrapper),
  22968. holdersCount = countHolders(args, placeholder);
  22969. }
  22970. if (partials) {
  22971. args = composeArgs(args, partials, holders, isCurried);
  22972. }
  22973. if (partialsRight) {
  22974. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22975. }
  22976. length -= holdersCount;
  22977. if (isCurried && length < arity) {
  22978. var newHolders = replaceHolders(args, placeholder);
  22979. return createRecurry(
  22980. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22981. args, newHolders, argPos, ary, arity - length
  22982. );
  22983. }
  22984. var thisBinding = isBind ? thisArg : this,
  22985. fn = isBindKey ? thisBinding[func] : func;
  22986. length = args.length;
  22987. if (argPos) {
  22988. args = reorder(args, argPos);
  22989. } else if (isFlip && length > 1) {
  22990. args.reverse();
  22991. }
  22992. if (isAry && ary < length) {
  22993. args.length = ary;
  22994. }
  22995. if (this && this !== root && this instanceof wrapper) {
  22996. fn = Ctor || createCtor(fn);
  22997. }
  22998. return fn.apply(thisBinding, args);
  22999. }
  23000. return wrapper;
  23001. }
  23002. /**
  23003. * Creates a function like `_.invertBy`.
  23004. *
  23005. * @private
  23006. * @param {Function} setter The function to set accumulator values.
  23007. * @param {Function} toIteratee The function to resolve iteratees.
  23008. * @returns {Function} Returns the new inverter function.
  23009. */
  23010. function createInverter(setter, toIteratee) {
  23011. return function(object, iteratee) {
  23012. return baseInverter(object, setter, toIteratee(iteratee), {});
  23013. };
  23014. }
  23015. /**
  23016. * Creates a function that performs a mathematical operation on two values.
  23017. *
  23018. * @private
  23019. * @param {Function} operator The function to perform the operation.
  23020. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23021. * @returns {Function} Returns the new mathematical operation function.
  23022. */
  23023. function createMathOperation(operator, defaultValue) {
  23024. return function(value, other) {
  23025. var result;
  23026. if (value === undefined && other === undefined) {
  23027. return defaultValue;
  23028. }
  23029. if (value !== undefined) {
  23030. result = value;
  23031. }
  23032. if (other !== undefined) {
  23033. if (result === undefined) {
  23034. return other;
  23035. }
  23036. if (typeof value == 'string' || typeof other == 'string') {
  23037. value = baseToString(value);
  23038. other = baseToString(other);
  23039. } else {
  23040. value = baseToNumber(value);
  23041. other = baseToNumber(other);
  23042. }
  23043. result = operator(value, other);
  23044. }
  23045. return result;
  23046. };
  23047. }
  23048. /**
  23049. * Creates a function like `_.over`.
  23050. *
  23051. * @private
  23052. * @param {Function} arrayFunc The function to iterate over iteratees.
  23053. * @returns {Function} Returns the new over function.
  23054. */
  23055. function createOver(arrayFunc) {
  23056. return flatRest(function(iteratees) {
  23057. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23058. return baseRest(function(args) {
  23059. var thisArg = this;
  23060. return arrayFunc(iteratees, function(iteratee) {
  23061. return apply(iteratee, thisArg, args);
  23062. });
  23063. });
  23064. });
  23065. }
  23066. /**
  23067. * Creates the padding for `string` based on `length`. The `chars` string
  23068. * is truncated if the number of characters exceeds `length`.
  23069. *
  23070. * @private
  23071. * @param {number} length The padding length.
  23072. * @param {string} [chars=' '] The string used as padding.
  23073. * @returns {string} Returns the padding for `string`.
  23074. */
  23075. function createPadding(length, chars) {
  23076. chars = chars === undefined ? ' ' : baseToString(chars);
  23077. var charsLength = chars.length;
  23078. if (charsLength < 2) {
  23079. return charsLength ? baseRepeat(chars, length) : chars;
  23080. }
  23081. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23082. return hasUnicode(chars)
  23083. ? castSlice(stringToArray(result), 0, length).join('')
  23084. : result.slice(0, length);
  23085. }
  23086. /**
  23087. * Creates a function that wraps `func` to invoke it with the `this` binding
  23088. * of `thisArg` and `partials` prepended to the arguments it receives.
  23089. *
  23090. * @private
  23091. * @param {Function} func The function to wrap.
  23092. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23093. * @param {*} thisArg The `this` binding of `func`.
  23094. * @param {Array} partials The arguments to prepend to those provided to
  23095. * the new function.
  23096. * @returns {Function} Returns the new wrapped function.
  23097. */
  23098. function createPartial(func, bitmask, thisArg, partials) {
  23099. var isBind = bitmask & WRAP_BIND_FLAG,
  23100. Ctor = createCtor(func);
  23101. function wrapper() {
  23102. var argsIndex = -1,
  23103. argsLength = arguments.length,
  23104. leftIndex = -1,
  23105. leftLength = partials.length,
  23106. args = Array(leftLength + argsLength),
  23107. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23108. while (++leftIndex < leftLength) {
  23109. args[leftIndex] = partials[leftIndex];
  23110. }
  23111. while (argsLength--) {
  23112. args[leftIndex++] = arguments[++argsIndex];
  23113. }
  23114. return apply(fn, isBind ? thisArg : this, args);
  23115. }
  23116. return wrapper;
  23117. }
  23118. /**
  23119. * Creates a `_.range` or `_.rangeRight` function.
  23120. *
  23121. * @private
  23122. * @param {boolean} [fromRight] Specify iterating from right to left.
  23123. * @returns {Function} Returns the new range function.
  23124. */
  23125. function createRange(fromRight) {
  23126. return function(start, end, step) {
  23127. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23128. end = step = undefined;
  23129. }
  23130. // Ensure the sign of `-0` is preserved.
  23131. start = toFinite(start);
  23132. if (end === undefined) {
  23133. end = start;
  23134. start = 0;
  23135. } else {
  23136. end = toFinite(end);
  23137. }
  23138. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23139. return baseRange(start, end, step, fromRight);
  23140. };
  23141. }
  23142. /**
  23143. * Creates a function that performs a relational operation on two values.
  23144. *
  23145. * @private
  23146. * @param {Function} operator The function to perform the operation.
  23147. * @returns {Function} Returns the new relational operation function.
  23148. */
  23149. function createRelationalOperation(operator) {
  23150. return function(value, other) {
  23151. if (!(typeof value == 'string' && typeof other == 'string')) {
  23152. value = toNumber(value);
  23153. other = toNumber(other);
  23154. }
  23155. return operator(value, other);
  23156. };
  23157. }
  23158. /**
  23159. * Creates a function that wraps `func` to continue currying.
  23160. *
  23161. * @private
  23162. * @param {Function} func The function to wrap.
  23163. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23164. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23165. * @param {*} placeholder The placeholder value.
  23166. * @param {*} [thisArg] The `this` binding of `func`.
  23167. * @param {Array} [partials] The arguments to prepend to those provided to
  23168. * the new function.
  23169. * @param {Array} [holders] The `partials` placeholder indexes.
  23170. * @param {Array} [argPos] The argument positions of the new function.
  23171. * @param {number} [ary] The arity cap of `func`.
  23172. * @param {number} [arity] The arity of `func`.
  23173. * @returns {Function} Returns the new wrapped function.
  23174. */
  23175. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23176. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23177. newHolders = isCurry ? holders : undefined,
  23178. newHoldersRight = isCurry ? undefined : holders,
  23179. newPartials = isCurry ? partials : undefined,
  23180. newPartialsRight = isCurry ? undefined : partials;
  23181. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23182. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23183. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23184. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23185. }
  23186. var newData = [
  23187. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23188. newHoldersRight, argPos, ary, arity
  23189. ];
  23190. var result = wrapFunc.apply(undefined, newData);
  23191. if (isLaziable(func)) {
  23192. setData(result, newData);
  23193. }
  23194. result.placeholder = placeholder;
  23195. return setWrapToString(result, func, bitmask);
  23196. }
  23197. /**
  23198. * Creates a function like `_.round`.
  23199. *
  23200. * @private
  23201. * @param {string} methodName The name of the `Math` method to use when rounding.
  23202. * @returns {Function} Returns the new round function.
  23203. */
  23204. function createRound(methodName) {
  23205. var func = Math[methodName];
  23206. return function(number, precision) {
  23207. number = toNumber(number);
  23208. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23209. if (precision && nativeIsFinite(number)) {
  23210. // Shift with exponential notation to avoid floating-point issues.
  23211. // See [MDN](https://mdn.io/round#Examples) for more details.
  23212. var pair = (toString(number) + 'e').split('e'),
  23213. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23214. pair = (toString(value) + 'e').split('e');
  23215. return +(pair[0] + 'e' + (+pair[1] - precision));
  23216. }
  23217. return func(number);
  23218. };
  23219. }
  23220. /**
  23221. * Creates a set object of `values`.
  23222. *
  23223. * @private
  23224. * @param {Array} values The values to add to the set.
  23225. * @returns {Object} Returns the new set.
  23226. */
  23227. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23228. return new Set(values);
  23229. };
  23230. /**
  23231. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23232. *
  23233. * @private
  23234. * @param {Function} keysFunc The function to get the keys of a given object.
  23235. * @returns {Function} Returns the new pairs function.
  23236. */
  23237. function createToPairs(keysFunc) {
  23238. return function(object) {
  23239. var tag = getTag(object);
  23240. if (tag == mapTag) {
  23241. return mapToArray(object);
  23242. }
  23243. if (tag == setTag) {
  23244. return setToPairs(object);
  23245. }
  23246. return baseToPairs(object, keysFunc(object));
  23247. };
  23248. }
  23249. /**
  23250. * Creates a function that either curries or invokes `func` with optional
  23251. * `this` binding and partially applied arguments.
  23252. *
  23253. * @private
  23254. * @param {Function|string} func The function or method name to wrap.
  23255. * @param {number} bitmask The bitmask flags.
  23256. * 1 - `_.bind`
  23257. * 2 - `_.bindKey`
  23258. * 4 - `_.curry` or `_.curryRight` of a bound function
  23259. * 8 - `_.curry`
  23260. * 16 - `_.curryRight`
  23261. * 32 - `_.partial`
  23262. * 64 - `_.partialRight`
  23263. * 128 - `_.rearg`
  23264. * 256 - `_.ary`
  23265. * 512 - `_.flip`
  23266. * @param {*} [thisArg] The `this` binding of `func`.
  23267. * @param {Array} [partials] The arguments to be partially applied.
  23268. * @param {Array} [holders] The `partials` placeholder indexes.
  23269. * @param {Array} [argPos] The argument positions of the new function.
  23270. * @param {number} [ary] The arity cap of `func`.
  23271. * @param {number} [arity] The arity of `func`.
  23272. * @returns {Function} Returns the new wrapped function.
  23273. */
  23274. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23275. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23276. if (!isBindKey && typeof func != 'function') {
  23277. throw new TypeError(FUNC_ERROR_TEXT);
  23278. }
  23279. var length = partials ? partials.length : 0;
  23280. if (!length) {
  23281. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23282. partials = holders = undefined;
  23283. }
  23284. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23285. arity = arity === undefined ? arity : toInteger(arity);
  23286. length -= holders ? holders.length : 0;
  23287. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23288. var partialsRight = partials,
  23289. holdersRight = holders;
  23290. partials = holders = undefined;
  23291. }
  23292. var data = isBindKey ? undefined : getData(func);
  23293. var newData = [
  23294. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23295. argPos, ary, arity
  23296. ];
  23297. if (data) {
  23298. mergeData(newData, data);
  23299. }
  23300. func = newData[0];
  23301. bitmask = newData[1];
  23302. thisArg = newData[2];
  23303. partials = newData[3];
  23304. holders = newData[4];
  23305. arity = newData[9] = newData[9] === undefined
  23306. ? (isBindKey ? 0 : func.length)
  23307. : nativeMax(newData[9] - length, 0);
  23308. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23309. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23310. }
  23311. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23312. var result = createBind(func, bitmask, thisArg);
  23313. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23314. result = createCurry(func, bitmask, arity);
  23315. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23316. result = createPartial(func, bitmask, thisArg, partials);
  23317. } else {
  23318. result = createHybrid.apply(undefined, newData);
  23319. }
  23320. var setter = data ? baseSetData : setData;
  23321. return setWrapToString(setter(result, newData), func, bitmask);
  23322. }
  23323. /**
  23324. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23325. * of source objects to the destination object for all destination properties
  23326. * that resolve to `undefined`.
  23327. *
  23328. * @private
  23329. * @param {*} objValue The destination value.
  23330. * @param {*} srcValue The source value.
  23331. * @param {string} key The key of the property to assign.
  23332. * @param {Object} object The parent object of `objValue`.
  23333. * @returns {*} Returns the value to assign.
  23334. */
  23335. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23336. if (objValue === undefined ||
  23337. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23338. return srcValue;
  23339. }
  23340. return objValue;
  23341. }
  23342. /**
  23343. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23344. * objects into destination objects that are passed thru.
  23345. *
  23346. * @private
  23347. * @param {*} objValue The destination value.
  23348. * @param {*} srcValue The source value.
  23349. * @param {string} key The key of the property to merge.
  23350. * @param {Object} object The parent object of `objValue`.
  23351. * @param {Object} source The parent object of `srcValue`.
  23352. * @param {Object} [stack] Tracks traversed source values and their merged
  23353. * counterparts.
  23354. * @returns {*} Returns the value to assign.
  23355. */
  23356. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23357. if (isObject(objValue) && isObject(srcValue)) {
  23358. // Recursively merge objects and arrays (susceptible to call stack limits).
  23359. stack.set(srcValue, objValue);
  23360. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23361. stack['delete'](srcValue);
  23362. }
  23363. return objValue;
  23364. }
  23365. /**
  23366. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23367. * objects.
  23368. *
  23369. * @private
  23370. * @param {*} value The value to inspect.
  23371. * @param {string} key The key of the property to inspect.
  23372. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23373. */
  23374. function customOmitClone(value) {
  23375. return isPlainObject(value) ? undefined : value;
  23376. }
  23377. /**
  23378. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23379. * partial deep comparisons.
  23380. *
  23381. * @private
  23382. * @param {Array} array The array to compare.
  23383. * @param {Array} other The other array to compare.
  23384. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23385. * @param {Function} customizer The function to customize comparisons.
  23386. * @param {Function} equalFunc The function to determine equivalents of values.
  23387. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23388. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23389. */
  23390. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23391. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23392. arrLength = array.length,
  23393. othLength = other.length;
  23394. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23395. return false;
  23396. }
  23397. // Assume cyclic values are equal.
  23398. var stacked = stack.get(array);
  23399. if (stacked && stack.get(other)) {
  23400. return stacked == other;
  23401. }
  23402. var index = -1,
  23403. result = true,
  23404. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23405. stack.set(array, other);
  23406. stack.set(other, array);
  23407. // Ignore non-index properties.
  23408. while (++index < arrLength) {
  23409. var arrValue = array[index],
  23410. othValue = other[index];
  23411. if (customizer) {
  23412. var compared = isPartial
  23413. ? customizer(othValue, arrValue, index, other, array, stack)
  23414. : customizer(arrValue, othValue, index, array, other, stack);
  23415. }
  23416. if (compared !== undefined) {
  23417. if (compared) {
  23418. continue;
  23419. }
  23420. result = false;
  23421. break;
  23422. }
  23423. // Recursively compare arrays (susceptible to call stack limits).
  23424. if (seen) {
  23425. if (!arraySome(other, function(othValue, othIndex) {
  23426. if (!cacheHas(seen, othIndex) &&
  23427. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23428. return seen.push(othIndex);
  23429. }
  23430. })) {
  23431. result = false;
  23432. break;
  23433. }
  23434. } else if (!(
  23435. arrValue === othValue ||
  23436. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23437. )) {
  23438. result = false;
  23439. break;
  23440. }
  23441. }
  23442. stack['delete'](array);
  23443. stack['delete'](other);
  23444. return result;
  23445. }
  23446. /**
  23447. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23448. * the same `toStringTag`.
  23449. *
  23450. * **Note:** This function only supports comparing values with tags of
  23451. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23452. *
  23453. * @private
  23454. * @param {Object} object The object to compare.
  23455. * @param {Object} other The other object to compare.
  23456. * @param {string} tag The `toStringTag` of the objects to compare.
  23457. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23458. * @param {Function} customizer The function to customize comparisons.
  23459. * @param {Function} equalFunc The function to determine equivalents of values.
  23460. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23461. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23462. */
  23463. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23464. switch (tag) {
  23465. case dataViewTag:
  23466. if ((object.byteLength != other.byteLength) ||
  23467. (object.byteOffset != other.byteOffset)) {
  23468. return false;
  23469. }
  23470. object = object.buffer;
  23471. other = other.buffer;
  23472. case arrayBufferTag:
  23473. if ((object.byteLength != other.byteLength) ||
  23474. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23475. return false;
  23476. }
  23477. return true;
  23478. case boolTag:
  23479. case dateTag:
  23480. case numberTag:
  23481. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23482. // Invalid dates are coerced to `NaN`.
  23483. return eq(+object, +other);
  23484. case errorTag:
  23485. return object.name == other.name && object.message == other.message;
  23486. case regexpTag:
  23487. case stringTag:
  23488. // Coerce regexes to strings and treat strings, primitives and objects,
  23489. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23490. // for more details.
  23491. return object == (other + '');
  23492. case mapTag:
  23493. var convert = mapToArray;
  23494. case setTag:
  23495. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23496. convert || (convert = setToArray);
  23497. if (object.size != other.size && !isPartial) {
  23498. return false;
  23499. }
  23500. // Assume cyclic values are equal.
  23501. var stacked = stack.get(object);
  23502. if (stacked) {
  23503. return stacked == other;
  23504. }
  23505. bitmask |= COMPARE_UNORDERED_FLAG;
  23506. // Recursively compare objects (susceptible to call stack limits).
  23507. stack.set(object, other);
  23508. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23509. stack['delete'](object);
  23510. return result;
  23511. case symbolTag:
  23512. if (symbolValueOf) {
  23513. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23514. }
  23515. }
  23516. return false;
  23517. }
  23518. /**
  23519. * A specialized version of `baseIsEqualDeep` for objects with support for
  23520. * partial deep comparisons.
  23521. *
  23522. * @private
  23523. * @param {Object} object The object to compare.
  23524. * @param {Object} other The other object to compare.
  23525. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23526. * @param {Function} customizer The function to customize comparisons.
  23527. * @param {Function} equalFunc The function to determine equivalents of values.
  23528. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23529. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23530. */
  23531. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23532. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23533. objProps = getAllKeys(object),
  23534. objLength = objProps.length,
  23535. othProps = getAllKeys(other),
  23536. othLength = othProps.length;
  23537. if (objLength != othLength && !isPartial) {
  23538. return false;
  23539. }
  23540. var index = objLength;
  23541. while (index--) {
  23542. var key = objProps[index];
  23543. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23544. return false;
  23545. }
  23546. }
  23547. // Assume cyclic values are equal.
  23548. var stacked = stack.get(object);
  23549. if (stacked && stack.get(other)) {
  23550. return stacked == other;
  23551. }
  23552. var result = true;
  23553. stack.set(object, other);
  23554. stack.set(other, object);
  23555. var skipCtor = isPartial;
  23556. while (++index < objLength) {
  23557. key = objProps[index];
  23558. var objValue = object[key],
  23559. othValue = other[key];
  23560. if (customizer) {
  23561. var compared = isPartial
  23562. ? customizer(othValue, objValue, key, other, object, stack)
  23563. : customizer(objValue, othValue, key, object, other, stack);
  23564. }
  23565. // Recursively compare objects (susceptible to call stack limits).
  23566. if (!(compared === undefined
  23567. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23568. : compared
  23569. )) {
  23570. result = false;
  23571. break;
  23572. }
  23573. skipCtor || (skipCtor = key == 'constructor');
  23574. }
  23575. if (result && !skipCtor) {
  23576. var objCtor = object.constructor,
  23577. othCtor = other.constructor;
  23578. // Non `Object` object instances with different constructors are not equal.
  23579. if (objCtor != othCtor &&
  23580. ('constructor' in object && 'constructor' in other) &&
  23581. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23582. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23583. result = false;
  23584. }
  23585. }
  23586. stack['delete'](object);
  23587. stack['delete'](other);
  23588. return result;
  23589. }
  23590. /**
  23591. * A specialized version of `baseRest` which flattens the rest array.
  23592. *
  23593. * @private
  23594. * @param {Function} func The function to apply a rest parameter to.
  23595. * @returns {Function} Returns the new function.
  23596. */
  23597. function flatRest(func) {
  23598. return setToString(overRest(func, undefined, flatten), func + '');
  23599. }
  23600. /**
  23601. * Creates an array of own enumerable property names and symbols of `object`.
  23602. *
  23603. * @private
  23604. * @param {Object} object The object to query.
  23605. * @returns {Array} Returns the array of property names and symbols.
  23606. */
  23607. function getAllKeys(object) {
  23608. return baseGetAllKeys(object, keys, getSymbols);
  23609. }
  23610. /**
  23611. * Creates an array of own and inherited enumerable property names and
  23612. * symbols of `object`.
  23613. *
  23614. * @private
  23615. * @param {Object} object The object to query.
  23616. * @returns {Array} Returns the array of property names and symbols.
  23617. */
  23618. function getAllKeysIn(object) {
  23619. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23620. }
  23621. /**
  23622. * Gets metadata for `func`.
  23623. *
  23624. * @private
  23625. * @param {Function} func The function to query.
  23626. * @returns {*} Returns the metadata for `func`.
  23627. */
  23628. var getData = !metaMap ? noop : function(func) {
  23629. return metaMap.get(func);
  23630. };
  23631. /**
  23632. * Gets the name of `func`.
  23633. *
  23634. * @private
  23635. * @param {Function} func The function to query.
  23636. * @returns {string} Returns the function name.
  23637. */
  23638. function getFuncName(func) {
  23639. var result = (func.name + ''),
  23640. array = realNames[result],
  23641. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23642. while (length--) {
  23643. var data = array[length],
  23644. otherFunc = data.func;
  23645. if (otherFunc == null || otherFunc == func) {
  23646. return data.name;
  23647. }
  23648. }
  23649. return result;
  23650. }
  23651. /**
  23652. * Gets the argument placeholder value for `func`.
  23653. *
  23654. * @private
  23655. * @param {Function} func The function to inspect.
  23656. * @returns {*} Returns the placeholder value.
  23657. */
  23658. function getHolder(func) {
  23659. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23660. return object.placeholder;
  23661. }
  23662. /**
  23663. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23664. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23665. * If arguments are provided, the chosen function is invoked with them and
  23666. * its result is returned.
  23667. *
  23668. * @private
  23669. * @param {*} [value] The value to convert to an iteratee.
  23670. * @param {number} [arity] The arity of the created iteratee.
  23671. * @returns {Function} Returns the chosen function or its result.
  23672. */
  23673. function getIteratee() {
  23674. var result = lodash.iteratee || iteratee;
  23675. result = result === iteratee ? baseIteratee : result;
  23676. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23677. }
  23678. /**
  23679. * Gets the data for `map`.
  23680. *
  23681. * @private
  23682. * @param {Object} map The map to query.
  23683. * @param {string} key The reference key.
  23684. * @returns {*} Returns the map data.
  23685. */
  23686. function getMapData(map, key) {
  23687. var data = map.__data__;
  23688. return isKeyable(key)
  23689. ? data[typeof key == 'string' ? 'string' : 'hash']
  23690. : data.map;
  23691. }
  23692. /**
  23693. * Gets the property names, values, and compare flags of `object`.
  23694. *
  23695. * @private
  23696. * @param {Object} object The object to query.
  23697. * @returns {Array} Returns the match data of `object`.
  23698. */
  23699. function getMatchData(object) {
  23700. var result = keys(object),
  23701. length = result.length;
  23702. while (length--) {
  23703. var key = result[length],
  23704. value = object[key];
  23705. result[length] = [key, value, isStrictComparable(value)];
  23706. }
  23707. return result;
  23708. }
  23709. /**
  23710. * Gets the native function at `key` of `object`.
  23711. *
  23712. * @private
  23713. * @param {Object} object The object to query.
  23714. * @param {string} key The key of the method to get.
  23715. * @returns {*} Returns the function if it's native, else `undefined`.
  23716. */
  23717. function getNative(object, key) {
  23718. var value = getValue(object, key);
  23719. return baseIsNative(value) ? value : undefined;
  23720. }
  23721. /**
  23722. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23723. *
  23724. * @private
  23725. * @param {*} value The value to query.
  23726. * @returns {string} Returns the raw `toStringTag`.
  23727. */
  23728. function getRawTag(value) {
  23729. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23730. tag = value[symToStringTag];
  23731. try {
  23732. value[symToStringTag] = undefined;
  23733. var unmasked = true;
  23734. } catch (e) {}
  23735. var result = nativeObjectToString.call(value);
  23736. if (unmasked) {
  23737. if (isOwn) {
  23738. value[symToStringTag] = tag;
  23739. } else {
  23740. delete value[symToStringTag];
  23741. }
  23742. }
  23743. return result;
  23744. }
  23745. /**
  23746. * Creates an array of the own enumerable symbols of `object`.
  23747. *
  23748. * @private
  23749. * @param {Object} object The object to query.
  23750. * @returns {Array} Returns the array of symbols.
  23751. */
  23752. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23753. if (object == null) {
  23754. return [];
  23755. }
  23756. object = Object(object);
  23757. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23758. return propertyIsEnumerable.call(object, symbol);
  23759. });
  23760. };
  23761. /**
  23762. * Creates an array of the own and inherited enumerable symbols of `object`.
  23763. *
  23764. * @private
  23765. * @param {Object} object The object to query.
  23766. * @returns {Array} Returns the array of symbols.
  23767. */
  23768. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23769. var result = [];
  23770. while (object) {
  23771. arrayPush(result, getSymbols(object));
  23772. object = getPrototype(object);
  23773. }
  23774. return result;
  23775. };
  23776. /**
  23777. * Gets the `toStringTag` of `value`.
  23778. *
  23779. * @private
  23780. * @param {*} value The value to query.
  23781. * @returns {string} Returns the `toStringTag`.
  23782. */
  23783. var getTag = baseGetTag;
  23784. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23785. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23786. (Map && getTag(new Map) != mapTag) ||
  23787. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23788. (Set && getTag(new Set) != setTag) ||
  23789. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23790. getTag = function(value) {
  23791. var result = baseGetTag(value),
  23792. Ctor = result == objectTag ? value.constructor : undefined,
  23793. ctorString = Ctor ? toSource(Ctor) : '';
  23794. if (ctorString) {
  23795. switch (ctorString) {
  23796. case dataViewCtorString: return dataViewTag;
  23797. case mapCtorString: return mapTag;
  23798. case promiseCtorString: return promiseTag;
  23799. case setCtorString: return setTag;
  23800. case weakMapCtorString: return weakMapTag;
  23801. }
  23802. }
  23803. return result;
  23804. };
  23805. }
  23806. /**
  23807. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23808. *
  23809. * @private
  23810. * @param {number} start The start of the view.
  23811. * @param {number} end The end of the view.
  23812. * @param {Array} transforms The transformations to apply to the view.
  23813. * @returns {Object} Returns an object containing the `start` and `end`
  23814. * positions of the view.
  23815. */
  23816. function getView(start, end, transforms) {
  23817. var index = -1,
  23818. length = transforms.length;
  23819. while (++index < length) {
  23820. var data = transforms[index],
  23821. size = data.size;
  23822. switch (data.type) {
  23823. case 'drop': start += size; break;
  23824. case 'dropRight': end -= size; break;
  23825. case 'take': end = nativeMin(end, start + size); break;
  23826. case 'takeRight': start = nativeMax(start, end - size); break;
  23827. }
  23828. }
  23829. return { 'start': start, 'end': end };
  23830. }
  23831. /**
  23832. * Extracts wrapper details from the `source` body comment.
  23833. *
  23834. * @private
  23835. * @param {string} source The source to inspect.
  23836. * @returns {Array} Returns the wrapper details.
  23837. */
  23838. function getWrapDetails(source) {
  23839. var match = source.match(reWrapDetails);
  23840. return match ? match[1].split(reSplitDetails) : [];
  23841. }
  23842. /**
  23843. * Checks if `path` exists on `object`.
  23844. *
  23845. * @private
  23846. * @param {Object} object The object to query.
  23847. * @param {Array|string} path The path to check.
  23848. * @param {Function} hasFunc The function to check properties.
  23849. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23850. */
  23851. function hasPath(object, path, hasFunc) {
  23852. path = castPath(path, object);
  23853. var index = -1,
  23854. length = path.length,
  23855. result = false;
  23856. while (++index < length) {
  23857. var key = toKey(path[index]);
  23858. if (!(result = object != null && hasFunc(object, key))) {
  23859. break;
  23860. }
  23861. object = object[key];
  23862. }
  23863. if (result || ++index != length) {
  23864. return result;
  23865. }
  23866. length = object == null ? 0 : object.length;
  23867. return !!length && isLength(length) && isIndex(key, length) &&
  23868. (isArray(object) || isArguments(object));
  23869. }
  23870. /**
  23871. * Initializes an array clone.
  23872. *
  23873. * @private
  23874. * @param {Array} array The array to clone.
  23875. * @returns {Array} Returns the initialized clone.
  23876. */
  23877. function initCloneArray(array) {
  23878. var length = array.length,
  23879. result = new array.constructor(length);
  23880. // Add properties assigned by `RegExp#exec`.
  23881. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23882. result.index = array.index;
  23883. result.input = array.input;
  23884. }
  23885. return result;
  23886. }
  23887. /**
  23888. * Initializes an object clone.
  23889. *
  23890. * @private
  23891. * @param {Object} object The object to clone.
  23892. * @returns {Object} Returns the initialized clone.
  23893. */
  23894. function initCloneObject(object) {
  23895. return (typeof object.constructor == 'function' && !isPrototype(object))
  23896. ? baseCreate(getPrototype(object))
  23897. : {};
  23898. }
  23899. /**
  23900. * Initializes an object clone based on its `toStringTag`.
  23901. *
  23902. * **Note:** This function only supports cloning values with tags of
  23903. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23904. *
  23905. * @private
  23906. * @param {Object} object The object to clone.
  23907. * @param {string} tag The `toStringTag` of the object to clone.
  23908. * @param {boolean} [isDeep] Specify a deep clone.
  23909. * @returns {Object} Returns the initialized clone.
  23910. */
  23911. function initCloneByTag(object, tag, isDeep) {
  23912. var Ctor = object.constructor;
  23913. switch (tag) {
  23914. case arrayBufferTag:
  23915. return cloneArrayBuffer(object);
  23916. case boolTag:
  23917. case dateTag:
  23918. return new Ctor(+object);
  23919. case dataViewTag:
  23920. return cloneDataView(object, isDeep);
  23921. case float32Tag: case float64Tag:
  23922. case int8Tag: case int16Tag: case int32Tag:
  23923. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23924. return cloneTypedArray(object, isDeep);
  23925. case mapTag:
  23926. return new Ctor;
  23927. case numberTag:
  23928. case stringTag:
  23929. return new Ctor(object);
  23930. case regexpTag:
  23931. return cloneRegExp(object);
  23932. case setTag:
  23933. return new Ctor;
  23934. case symbolTag:
  23935. return cloneSymbol(object);
  23936. }
  23937. }
  23938. /**
  23939. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23940. *
  23941. * @private
  23942. * @param {string} source The source to modify.
  23943. * @returns {Array} details The details to insert.
  23944. * @returns {string} Returns the modified source.
  23945. */
  23946. function insertWrapDetails(source, details) {
  23947. var length = details.length;
  23948. if (!length) {
  23949. return source;
  23950. }
  23951. var lastIndex = length - 1;
  23952. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23953. details = details.join(length > 2 ? ', ' : ' ');
  23954. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23955. }
  23956. /**
  23957. * Checks if `value` is a flattenable `arguments` object or array.
  23958. *
  23959. * @private
  23960. * @param {*} value The value to check.
  23961. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23962. */
  23963. function isFlattenable(value) {
  23964. return isArray(value) || isArguments(value) ||
  23965. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23966. }
  23967. /**
  23968. * Checks if `value` is a valid array-like index.
  23969. *
  23970. * @private
  23971. * @param {*} value The value to check.
  23972. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23973. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23974. */
  23975. function isIndex(value, length) {
  23976. var type = typeof value;
  23977. length = length == null ? MAX_SAFE_INTEGER : length;
  23978. return !!length &&
  23979. (type == 'number' ||
  23980. (type != 'symbol' && reIsUint.test(value))) &&
  23981. (value > -1 && value % 1 == 0 && value < length);
  23982. }
  23983. /**
  23984. * Checks if the given arguments are from an iteratee call.
  23985. *
  23986. * @private
  23987. * @param {*} value The potential iteratee value argument.
  23988. * @param {*} index The potential iteratee index or key argument.
  23989. * @param {*} object The potential iteratee object argument.
  23990. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23991. * else `false`.
  23992. */
  23993. function isIterateeCall(value, index, object) {
  23994. if (!isObject(object)) {
  23995. return false;
  23996. }
  23997. var type = typeof index;
  23998. if (type == 'number'
  23999. ? (isArrayLike(object) && isIndex(index, object.length))
  24000. : (type == 'string' && index in object)
  24001. ) {
  24002. return eq(object[index], value);
  24003. }
  24004. return false;
  24005. }
  24006. /**
  24007. * Checks if `value` is a property name and not a property path.
  24008. *
  24009. * @private
  24010. * @param {*} value The value to check.
  24011. * @param {Object} [object] The object to query keys on.
  24012. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24013. */
  24014. function isKey(value, object) {
  24015. if (isArray(value)) {
  24016. return false;
  24017. }
  24018. var type = typeof value;
  24019. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24020. value == null || isSymbol(value)) {
  24021. return true;
  24022. }
  24023. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24024. (object != null && value in Object(object));
  24025. }
  24026. /**
  24027. * Checks if `value` is suitable for use as unique object key.
  24028. *
  24029. * @private
  24030. * @param {*} value The value to check.
  24031. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24032. */
  24033. function isKeyable(value) {
  24034. var type = typeof value;
  24035. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24036. ? (value !== '__proto__')
  24037. : (value === null);
  24038. }
  24039. /**
  24040. * Checks if `func` has a lazy counterpart.
  24041. *
  24042. * @private
  24043. * @param {Function} func The function to check.
  24044. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24045. * else `false`.
  24046. */
  24047. function isLaziable(func) {
  24048. var funcName = getFuncName(func),
  24049. other = lodash[funcName];
  24050. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24051. return false;
  24052. }
  24053. if (func === other) {
  24054. return true;
  24055. }
  24056. var data = getData(other);
  24057. return !!data && func === data[0];
  24058. }
  24059. /**
  24060. * Checks if `func` has its source masked.
  24061. *
  24062. * @private
  24063. * @param {Function} func The function to check.
  24064. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24065. */
  24066. function isMasked(func) {
  24067. return !!maskSrcKey && (maskSrcKey in func);
  24068. }
  24069. /**
  24070. * Checks if `func` is capable of being masked.
  24071. *
  24072. * @private
  24073. * @param {*} value The value to check.
  24074. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24075. */
  24076. var isMaskable = coreJsData ? isFunction : stubFalse;
  24077. /**
  24078. * Checks if `value` is likely a prototype object.
  24079. *
  24080. * @private
  24081. * @param {*} value The value to check.
  24082. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24083. */
  24084. function isPrototype(value) {
  24085. var Ctor = value && value.constructor,
  24086. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24087. return value === proto;
  24088. }
  24089. /**
  24090. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24091. *
  24092. * @private
  24093. * @param {*} value The value to check.
  24094. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24095. * equality comparisons, else `false`.
  24096. */
  24097. function isStrictComparable(value) {
  24098. return value === value && !isObject(value);
  24099. }
  24100. /**
  24101. * A specialized version of `matchesProperty` for source values suitable
  24102. * for strict equality comparisons, i.e. `===`.
  24103. *
  24104. * @private
  24105. * @param {string} key The key of the property to get.
  24106. * @param {*} srcValue The value to match.
  24107. * @returns {Function} Returns the new spec function.
  24108. */
  24109. function matchesStrictComparable(key, srcValue) {
  24110. return function(object) {
  24111. if (object == null) {
  24112. return false;
  24113. }
  24114. return object[key] === srcValue &&
  24115. (srcValue !== undefined || (key in Object(object)));
  24116. };
  24117. }
  24118. /**
  24119. * A specialized version of `_.memoize` which clears the memoized function's
  24120. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24121. *
  24122. * @private
  24123. * @param {Function} func The function to have its output memoized.
  24124. * @returns {Function} Returns the new memoized function.
  24125. */
  24126. function memoizeCapped(func) {
  24127. var result = memoize(func, function(key) {
  24128. if (cache.size === MAX_MEMOIZE_SIZE) {
  24129. cache.clear();
  24130. }
  24131. return key;
  24132. });
  24133. var cache = result.cache;
  24134. return result;
  24135. }
  24136. /**
  24137. * Merges the function metadata of `source` into `data`.
  24138. *
  24139. * Merging metadata reduces the number of wrappers used to invoke a function.
  24140. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24141. * may be applied regardless of execution order. Methods like `_.ary` and
  24142. * `_.rearg` modify function arguments, making the order in which they are
  24143. * executed important, preventing the merging of metadata. However, we make
  24144. * an exception for a safe combined case where curried functions have `_.ary`
  24145. * and or `_.rearg` applied.
  24146. *
  24147. * @private
  24148. * @param {Array} data The destination metadata.
  24149. * @param {Array} source The source metadata.
  24150. * @returns {Array} Returns `data`.
  24151. */
  24152. function mergeData(data, source) {
  24153. var bitmask = data[1],
  24154. srcBitmask = source[1],
  24155. newBitmask = bitmask | srcBitmask,
  24156. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24157. var isCombo =
  24158. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24159. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24160. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24161. // Exit early if metadata can't be merged.
  24162. if (!(isCommon || isCombo)) {
  24163. return data;
  24164. }
  24165. // Use source `thisArg` if available.
  24166. if (srcBitmask & WRAP_BIND_FLAG) {
  24167. data[2] = source[2];
  24168. // Set when currying a bound function.
  24169. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24170. }
  24171. // Compose partial arguments.
  24172. var value = source[3];
  24173. if (value) {
  24174. var partials = data[3];
  24175. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24176. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24177. }
  24178. // Compose partial right arguments.
  24179. value = source[5];
  24180. if (value) {
  24181. partials = data[5];
  24182. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24183. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24184. }
  24185. // Use source `argPos` if available.
  24186. value = source[7];
  24187. if (value) {
  24188. data[7] = value;
  24189. }
  24190. // Use source `ary` if it's smaller.
  24191. if (srcBitmask & WRAP_ARY_FLAG) {
  24192. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24193. }
  24194. // Use source `arity` if one is not provided.
  24195. if (data[9] == null) {
  24196. data[9] = source[9];
  24197. }
  24198. // Use source `func` and merge bitmasks.
  24199. data[0] = source[0];
  24200. data[1] = newBitmask;
  24201. return data;
  24202. }
  24203. /**
  24204. * This function is like
  24205. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24206. * except that it includes inherited enumerable properties.
  24207. *
  24208. * @private
  24209. * @param {Object} object The object to query.
  24210. * @returns {Array} Returns the array of property names.
  24211. */
  24212. function nativeKeysIn(object) {
  24213. var result = [];
  24214. if (object != null) {
  24215. for (var key in Object(object)) {
  24216. result.push(key);
  24217. }
  24218. }
  24219. return result;
  24220. }
  24221. /**
  24222. * Converts `value` to a string using `Object.prototype.toString`.
  24223. *
  24224. * @private
  24225. * @param {*} value The value to convert.
  24226. * @returns {string} Returns the converted string.
  24227. */
  24228. function objectToString(value) {
  24229. return nativeObjectToString.call(value);
  24230. }
  24231. /**
  24232. * A specialized version of `baseRest` which transforms the rest array.
  24233. *
  24234. * @private
  24235. * @param {Function} func The function to apply a rest parameter to.
  24236. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24237. * @param {Function} transform The rest array transform.
  24238. * @returns {Function} Returns the new function.
  24239. */
  24240. function overRest(func, start, transform) {
  24241. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24242. return function() {
  24243. var args = arguments,
  24244. index = -1,
  24245. length = nativeMax(args.length - start, 0),
  24246. array = Array(length);
  24247. while (++index < length) {
  24248. array[index] = args[start + index];
  24249. }
  24250. index = -1;
  24251. var otherArgs = Array(start + 1);
  24252. while (++index < start) {
  24253. otherArgs[index] = args[index];
  24254. }
  24255. otherArgs[start] = transform(array);
  24256. return apply(func, this, otherArgs);
  24257. };
  24258. }
  24259. /**
  24260. * Gets the parent value at `path` of `object`.
  24261. *
  24262. * @private
  24263. * @param {Object} object The object to query.
  24264. * @param {Array} path The path to get the parent value of.
  24265. * @returns {*} Returns the parent value.
  24266. */
  24267. function parent(object, path) {
  24268. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24269. }
  24270. /**
  24271. * Reorder `array` according to the specified indexes where the element at
  24272. * the first index is assigned as the first element, the element at
  24273. * the second index is assigned as the second element, and so on.
  24274. *
  24275. * @private
  24276. * @param {Array} array The array to reorder.
  24277. * @param {Array} indexes The arranged array indexes.
  24278. * @returns {Array} Returns `array`.
  24279. */
  24280. function reorder(array, indexes) {
  24281. var arrLength = array.length,
  24282. length = nativeMin(indexes.length, arrLength),
  24283. oldArray = copyArray(array);
  24284. while (length--) {
  24285. var index = indexes[length];
  24286. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24287. }
  24288. return array;
  24289. }
  24290. /**
  24291. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24292. *
  24293. * @private
  24294. * @param {Object} object The object to query.
  24295. * @param {string} key The key of the property to get.
  24296. * @returns {*} Returns the property value.
  24297. */
  24298. function safeGet(object, key) {
  24299. if (key === 'constructor' && typeof object[key] === 'function') {
  24300. return;
  24301. }
  24302. if (key == '__proto__') {
  24303. return;
  24304. }
  24305. return object[key];
  24306. }
  24307. /**
  24308. * Sets metadata for `func`.
  24309. *
  24310. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24311. * period of time, it will trip its breaker and transition to an identity
  24312. * function to avoid garbage collection pauses in V8. See
  24313. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24314. * for more details.
  24315. *
  24316. * @private
  24317. * @param {Function} func The function to associate metadata with.
  24318. * @param {*} data The metadata.
  24319. * @returns {Function} Returns `func`.
  24320. */
  24321. var setData = shortOut(baseSetData);
  24322. /**
  24323. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24324. *
  24325. * @private
  24326. * @param {Function} func The function to delay.
  24327. * @param {number} wait The number of milliseconds to delay invocation.
  24328. * @returns {number|Object} Returns the timer id or timeout object.
  24329. */
  24330. var setTimeout = ctxSetTimeout || function(func, wait) {
  24331. return root.setTimeout(func, wait);
  24332. };
  24333. /**
  24334. * Sets the `toString` method of `func` to return `string`.
  24335. *
  24336. * @private
  24337. * @param {Function} func The function to modify.
  24338. * @param {Function} string The `toString` result.
  24339. * @returns {Function} Returns `func`.
  24340. */
  24341. var setToString = shortOut(baseSetToString);
  24342. /**
  24343. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24344. * with wrapper details in a comment at the top of the source body.
  24345. *
  24346. * @private
  24347. * @param {Function} wrapper The function to modify.
  24348. * @param {Function} reference The reference function.
  24349. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24350. * @returns {Function} Returns `wrapper`.
  24351. */
  24352. function setWrapToString(wrapper, reference, bitmask) {
  24353. var source = (reference + '');
  24354. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24355. }
  24356. /**
  24357. * Creates a function that'll short out and invoke `identity` instead
  24358. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24359. * milliseconds.
  24360. *
  24361. * @private
  24362. * @param {Function} func The function to restrict.
  24363. * @returns {Function} Returns the new shortable function.
  24364. */
  24365. function shortOut(func) {
  24366. var count = 0,
  24367. lastCalled = 0;
  24368. return function() {
  24369. var stamp = nativeNow(),
  24370. remaining = HOT_SPAN - (stamp - lastCalled);
  24371. lastCalled = stamp;
  24372. if (remaining > 0) {
  24373. if (++count >= HOT_COUNT) {
  24374. return arguments[0];
  24375. }
  24376. } else {
  24377. count = 0;
  24378. }
  24379. return func.apply(undefined, arguments);
  24380. };
  24381. }
  24382. /**
  24383. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24384. *
  24385. * @private
  24386. * @param {Array} array The array to shuffle.
  24387. * @param {number} [size=array.length] The size of `array`.
  24388. * @returns {Array} Returns `array`.
  24389. */
  24390. function shuffleSelf(array, size) {
  24391. var index = -1,
  24392. length = array.length,
  24393. lastIndex = length - 1;
  24394. size = size === undefined ? length : size;
  24395. while (++index < size) {
  24396. var rand = baseRandom(index, lastIndex),
  24397. value = array[rand];
  24398. array[rand] = array[index];
  24399. array[index] = value;
  24400. }
  24401. array.length = size;
  24402. return array;
  24403. }
  24404. /**
  24405. * Converts `string` to a property path array.
  24406. *
  24407. * @private
  24408. * @param {string} string The string to convert.
  24409. * @returns {Array} Returns the property path array.
  24410. */
  24411. var stringToPath = memoizeCapped(function(string) {
  24412. var result = [];
  24413. if (string.charCodeAt(0) === 46 /* . */) {
  24414. result.push('');
  24415. }
  24416. string.replace(rePropName, function(match, number, quote, subString) {
  24417. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24418. });
  24419. return result;
  24420. });
  24421. /**
  24422. * Converts `value` to a string key if it's not a string or symbol.
  24423. *
  24424. * @private
  24425. * @param {*} value The value to inspect.
  24426. * @returns {string|symbol} Returns the key.
  24427. */
  24428. function toKey(value) {
  24429. if (typeof value == 'string' || isSymbol(value)) {
  24430. return value;
  24431. }
  24432. var result = (value + '');
  24433. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24434. }
  24435. /**
  24436. * Converts `func` to its source code.
  24437. *
  24438. * @private
  24439. * @param {Function} func The function to convert.
  24440. * @returns {string} Returns the source code.
  24441. */
  24442. function toSource(func) {
  24443. if (func != null) {
  24444. try {
  24445. return funcToString.call(func);
  24446. } catch (e) {}
  24447. try {
  24448. return (func + '');
  24449. } catch (e) {}
  24450. }
  24451. return '';
  24452. }
  24453. /**
  24454. * Updates wrapper `details` based on `bitmask` flags.
  24455. *
  24456. * @private
  24457. * @returns {Array} details The details to modify.
  24458. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24459. * @returns {Array} Returns `details`.
  24460. */
  24461. function updateWrapDetails(details, bitmask) {
  24462. arrayEach(wrapFlags, function(pair) {
  24463. var value = '_.' + pair[0];
  24464. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24465. details.push(value);
  24466. }
  24467. });
  24468. return details.sort();
  24469. }
  24470. /**
  24471. * Creates a clone of `wrapper`.
  24472. *
  24473. * @private
  24474. * @param {Object} wrapper The wrapper to clone.
  24475. * @returns {Object} Returns the cloned wrapper.
  24476. */
  24477. function wrapperClone(wrapper) {
  24478. if (wrapper instanceof LazyWrapper) {
  24479. return wrapper.clone();
  24480. }
  24481. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24482. result.__actions__ = copyArray(wrapper.__actions__);
  24483. result.__index__ = wrapper.__index__;
  24484. result.__values__ = wrapper.__values__;
  24485. return result;
  24486. }
  24487. /*------------------------------------------------------------------------*/
  24488. /**
  24489. * Creates an array of elements split into groups the length of `size`.
  24490. * If `array` can't be split evenly, the final chunk will be the remaining
  24491. * elements.
  24492. *
  24493. * @static
  24494. * @memberOf _
  24495. * @since 3.0.0
  24496. * @category Array
  24497. * @param {Array} array The array to process.
  24498. * @param {number} [size=1] The length of each chunk
  24499. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24500. * @returns {Array} Returns the new array of chunks.
  24501. * @example
  24502. *
  24503. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24504. * // => [['a', 'b'], ['c', 'd']]
  24505. *
  24506. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24507. * // => [['a', 'b', 'c'], ['d']]
  24508. */
  24509. function chunk(array, size, guard) {
  24510. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24511. size = 1;
  24512. } else {
  24513. size = nativeMax(toInteger(size), 0);
  24514. }
  24515. var length = array == null ? 0 : array.length;
  24516. if (!length || size < 1) {
  24517. return [];
  24518. }
  24519. var index = 0,
  24520. resIndex = 0,
  24521. result = Array(nativeCeil(length / size));
  24522. while (index < length) {
  24523. result[resIndex++] = baseSlice(array, index, (index += size));
  24524. }
  24525. return result;
  24526. }
  24527. /**
  24528. * Creates an array with all falsey values removed. The values `false`, `null`,
  24529. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24530. *
  24531. * @static
  24532. * @memberOf _
  24533. * @since 0.1.0
  24534. * @category Array
  24535. * @param {Array} array The array to compact.
  24536. * @returns {Array} Returns the new array of filtered values.
  24537. * @example
  24538. *
  24539. * _.compact([0, 1, false, 2, '', 3]);
  24540. * // => [1, 2, 3]
  24541. */
  24542. function compact(array) {
  24543. var index = -1,
  24544. length = array == null ? 0 : array.length,
  24545. resIndex = 0,
  24546. result = [];
  24547. while (++index < length) {
  24548. var value = array[index];
  24549. if (value) {
  24550. result[resIndex++] = value;
  24551. }
  24552. }
  24553. return result;
  24554. }
  24555. /**
  24556. * Creates a new array concatenating `array` with any additional arrays
  24557. * and/or values.
  24558. *
  24559. * @static
  24560. * @memberOf _
  24561. * @since 4.0.0
  24562. * @category Array
  24563. * @param {Array} array The array to concatenate.
  24564. * @param {...*} [values] The values to concatenate.
  24565. * @returns {Array} Returns the new concatenated array.
  24566. * @example
  24567. *
  24568. * var array = [1];
  24569. * var other = _.concat(array, 2, [3], [[4]]);
  24570. *
  24571. * console.log(other);
  24572. * // => [1, 2, 3, [4]]
  24573. *
  24574. * console.log(array);
  24575. * // => [1]
  24576. */
  24577. function concat() {
  24578. var length = arguments.length;
  24579. if (!length) {
  24580. return [];
  24581. }
  24582. var args = Array(length - 1),
  24583. array = arguments[0],
  24584. index = length;
  24585. while (index--) {
  24586. args[index - 1] = arguments[index];
  24587. }
  24588. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24589. }
  24590. /**
  24591. * Creates an array of `array` values not included in the other given arrays
  24592. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24593. * for equality comparisons. The order and references of result values are
  24594. * determined by the first array.
  24595. *
  24596. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24597. *
  24598. * @static
  24599. * @memberOf _
  24600. * @since 0.1.0
  24601. * @category Array
  24602. * @param {Array} array The array to inspect.
  24603. * @param {...Array} [values] The values to exclude.
  24604. * @returns {Array} Returns the new array of filtered values.
  24605. * @see _.without, _.xor
  24606. * @example
  24607. *
  24608. * _.difference([2, 1], [2, 3]);
  24609. * // => [1]
  24610. */
  24611. var difference = baseRest(function(array, values) {
  24612. return isArrayLikeObject(array)
  24613. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24614. : [];
  24615. });
  24616. /**
  24617. * This method is like `_.difference` except that it accepts `iteratee` which
  24618. * is invoked for each element of `array` and `values` to generate the criterion
  24619. * by which they're compared. The order and references of result values are
  24620. * determined by the first array. The iteratee is invoked with one argument:
  24621. * (value).
  24622. *
  24623. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24624. *
  24625. * @static
  24626. * @memberOf _
  24627. * @since 4.0.0
  24628. * @category Array
  24629. * @param {Array} array The array to inspect.
  24630. * @param {...Array} [values] The values to exclude.
  24631. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24632. * @returns {Array} Returns the new array of filtered values.
  24633. * @example
  24634. *
  24635. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24636. * // => [1.2]
  24637. *
  24638. * // The `_.property` iteratee shorthand.
  24639. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24640. * // => [{ 'x': 2 }]
  24641. */
  24642. var differenceBy = baseRest(function(array, values) {
  24643. var iteratee = last(values);
  24644. if (isArrayLikeObject(iteratee)) {
  24645. iteratee = undefined;
  24646. }
  24647. return isArrayLikeObject(array)
  24648. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24649. : [];
  24650. });
  24651. /**
  24652. * This method is like `_.difference` except that it accepts `comparator`
  24653. * which is invoked to compare elements of `array` to `values`. The order and
  24654. * references of result values are determined by the first array. The comparator
  24655. * is invoked with two arguments: (arrVal, othVal).
  24656. *
  24657. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24658. *
  24659. * @static
  24660. * @memberOf _
  24661. * @since 4.0.0
  24662. * @category Array
  24663. * @param {Array} array The array to inspect.
  24664. * @param {...Array} [values] The values to exclude.
  24665. * @param {Function} [comparator] The comparator invoked per element.
  24666. * @returns {Array} Returns the new array of filtered values.
  24667. * @example
  24668. *
  24669. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24670. *
  24671. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24672. * // => [{ 'x': 2, 'y': 1 }]
  24673. */
  24674. var differenceWith = baseRest(function(array, values) {
  24675. var comparator = last(values);
  24676. if (isArrayLikeObject(comparator)) {
  24677. comparator = undefined;
  24678. }
  24679. return isArrayLikeObject(array)
  24680. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24681. : [];
  24682. });
  24683. /**
  24684. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24685. *
  24686. * @static
  24687. * @memberOf _
  24688. * @since 0.5.0
  24689. * @category Array
  24690. * @param {Array} array The array to query.
  24691. * @param {number} [n=1] The number of elements to drop.
  24692. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24693. * @returns {Array} Returns the slice of `array`.
  24694. * @example
  24695. *
  24696. * _.drop([1, 2, 3]);
  24697. * // => [2, 3]
  24698. *
  24699. * _.drop([1, 2, 3], 2);
  24700. * // => [3]
  24701. *
  24702. * _.drop([1, 2, 3], 5);
  24703. * // => []
  24704. *
  24705. * _.drop([1, 2, 3], 0);
  24706. * // => [1, 2, 3]
  24707. */
  24708. function drop(array, n, guard) {
  24709. var length = array == null ? 0 : array.length;
  24710. if (!length) {
  24711. return [];
  24712. }
  24713. n = (guard || n === undefined) ? 1 : toInteger(n);
  24714. return baseSlice(array, n < 0 ? 0 : n, length);
  24715. }
  24716. /**
  24717. * Creates a slice of `array` with `n` elements dropped from the end.
  24718. *
  24719. * @static
  24720. * @memberOf _
  24721. * @since 3.0.0
  24722. * @category Array
  24723. * @param {Array} array The array to query.
  24724. * @param {number} [n=1] The number of elements to drop.
  24725. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24726. * @returns {Array} Returns the slice of `array`.
  24727. * @example
  24728. *
  24729. * _.dropRight([1, 2, 3]);
  24730. * // => [1, 2]
  24731. *
  24732. * _.dropRight([1, 2, 3], 2);
  24733. * // => [1]
  24734. *
  24735. * _.dropRight([1, 2, 3], 5);
  24736. * // => []
  24737. *
  24738. * _.dropRight([1, 2, 3], 0);
  24739. * // => [1, 2, 3]
  24740. */
  24741. function dropRight(array, n, guard) {
  24742. var length = array == null ? 0 : array.length;
  24743. if (!length) {
  24744. return [];
  24745. }
  24746. n = (guard || n === undefined) ? 1 : toInteger(n);
  24747. n = length - n;
  24748. return baseSlice(array, 0, n < 0 ? 0 : n);
  24749. }
  24750. /**
  24751. * Creates a slice of `array` excluding elements dropped from the end.
  24752. * Elements are dropped until `predicate` returns falsey. The predicate is
  24753. * invoked with three arguments: (value, index, array).
  24754. *
  24755. * @static
  24756. * @memberOf _
  24757. * @since 3.0.0
  24758. * @category Array
  24759. * @param {Array} array The array to query.
  24760. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24761. * @returns {Array} Returns the slice of `array`.
  24762. * @example
  24763. *
  24764. * var users = [
  24765. * { 'user': 'barney', 'active': true },
  24766. * { 'user': 'fred', 'active': false },
  24767. * { 'user': 'pebbles', 'active': false }
  24768. * ];
  24769. *
  24770. * _.dropRightWhile(users, function(o) { return !o.active; });
  24771. * // => objects for ['barney']
  24772. *
  24773. * // The `_.matches` iteratee shorthand.
  24774. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24775. * // => objects for ['barney', 'fred']
  24776. *
  24777. * // The `_.matchesProperty` iteratee shorthand.
  24778. * _.dropRightWhile(users, ['active', false]);
  24779. * // => objects for ['barney']
  24780. *
  24781. * // The `_.property` iteratee shorthand.
  24782. * _.dropRightWhile(users, 'active');
  24783. * // => objects for ['barney', 'fred', 'pebbles']
  24784. */
  24785. function dropRightWhile(array, predicate) {
  24786. return (array && array.length)
  24787. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24788. : [];
  24789. }
  24790. /**
  24791. * Creates a slice of `array` excluding elements dropped from the beginning.
  24792. * Elements are dropped until `predicate` returns falsey. The predicate is
  24793. * invoked with three arguments: (value, index, array).
  24794. *
  24795. * @static
  24796. * @memberOf _
  24797. * @since 3.0.0
  24798. * @category Array
  24799. * @param {Array} array The array to query.
  24800. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24801. * @returns {Array} Returns the slice of `array`.
  24802. * @example
  24803. *
  24804. * var users = [
  24805. * { 'user': 'barney', 'active': false },
  24806. * { 'user': 'fred', 'active': false },
  24807. * { 'user': 'pebbles', 'active': true }
  24808. * ];
  24809. *
  24810. * _.dropWhile(users, function(o) { return !o.active; });
  24811. * // => objects for ['pebbles']
  24812. *
  24813. * // The `_.matches` iteratee shorthand.
  24814. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24815. * // => objects for ['fred', 'pebbles']
  24816. *
  24817. * // The `_.matchesProperty` iteratee shorthand.
  24818. * _.dropWhile(users, ['active', false]);
  24819. * // => objects for ['pebbles']
  24820. *
  24821. * // The `_.property` iteratee shorthand.
  24822. * _.dropWhile(users, 'active');
  24823. * // => objects for ['barney', 'fred', 'pebbles']
  24824. */
  24825. function dropWhile(array, predicate) {
  24826. return (array && array.length)
  24827. ? baseWhile(array, getIteratee(predicate, 3), true)
  24828. : [];
  24829. }
  24830. /**
  24831. * Fills elements of `array` with `value` from `start` up to, but not
  24832. * including, `end`.
  24833. *
  24834. * **Note:** This method mutates `array`.
  24835. *
  24836. * @static
  24837. * @memberOf _
  24838. * @since 3.2.0
  24839. * @category Array
  24840. * @param {Array} array The array to fill.
  24841. * @param {*} value The value to fill `array` with.
  24842. * @param {number} [start=0] The start position.
  24843. * @param {number} [end=array.length] The end position.
  24844. * @returns {Array} Returns `array`.
  24845. * @example
  24846. *
  24847. * var array = [1, 2, 3];
  24848. *
  24849. * _.fill(array, 'a');
  24850. * console.log(array);
  24851. * // => ['a', 'a', 'a']
  24852. *
  24853. * _.fill(Array(3), 2);
  24854. * // => [2, 2, 2]
  24855. *
  24856. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24857. * // => [4, '*', '*', 10]
  24858. */
  24859. function fill(array, value, start, end) {
  24860. var length = array == null ? 0 : array.length;
  24861. if (!length) {
  24862. return [];
  24863. }
  24864. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24865. start = 0;
  24866. end = length;
  24867. }
  24868. return baseFill(array, value, start, end);
  24869. }
  24870. /**
  24871. * This method is like `_.find` except that it returns the index of the first
  24872. * element `predicate` returns truthy for instead of the element itself.
  24873. *
  24874. * @static
  24875. * @memberOf _
  24876. * @since 1.1.0
  24877. * @category Array
  24878. * @param {Array} array The array to inspect.
  24879. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24880. * @param {number} [fromIndex=0] The index to search from.
  24881. * @returns {number} Returns the index of the found element, else `-1`.
  24882. * @example
  24883. *
  24884. * var users = [
  24885. * { 'user': 'barney', 'active': false },
  24886. * { 'user': 'fred', 'active': false },
  24887. * { 'user': 'pebbles', 'active': true }
  24888. * ];
  24889. *
  24890. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24891. * // => 0
  24892. *
  24893. * // The `_.matches` iteratee shorthand.
  24894. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24895. * // => 1
  24896. *
  24897. * // The `_.matchesProperty` iteratee shorthand.
  24898. * _.findIndex(users, ['active', false]);
  24899. * // => 0
  24900. *
  24901. * // The `_.property` iteratee shorthand.
  24902. * _.findIndex(users, 'active');
  24903. * // => 2
  24904. */
  24905. function findIndex(array, predicate, fromIndex) {
  24906. var length = array == null ? 0 : array.length;
  24907. if (!length) {
  24908. return -1;
  24909. }
  24910. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24911. if (index < 0) {
  24912. index = nativeMax(length + index, 0);
  24913. }
  24914. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24915. }
  24916. /**
  24917. * This method is like `_.findIndex` except that it iterates over elements
  24918. * of `collection` from right to left.
  24919. *
  24920. * @static
  24921. * @memberOf _
  24922. * @since 2.0.0
  24923. * @category Array
  24924. * @param {Array} array The array to inspect.
  24925. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24926. * @param {number} [fromIndex=array.length-1] The index to search from.
  24927. * @returns {number} Returns the index of the found element, else `-1`.
  24928. * @example
  24929. *
  24930. * var users = [
  24931. * { 'user': 'barney', 'active': true },
  24932. * { 'user': 'fred', 'active': false },
  24933. * { 'user': 'pebbles', 'active': false }
  24934. * ];
  24935. *
  24936. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24937. * // => 2
  24938. *
  24939. * // The `_.matches` iteratee shorthand.
  24940. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24941. * // => 0
  24942. *
  24943. * // The `_.matchesProperty` iteratee shorthand.
  24944. * _.findLastIndex(users, ['active', false]);
  24945. * // => 2
  24946. *
  24947. * // The `_.property` iteratee shorthand.
  24948. * _.findLastIndex(users, 'active');
  24949. * // => 0
  24950. */
  24951. function findLastIndex(array, predicate, fromIndex) {
  24952. var length = array == null ? 0 : array.length;
  24953. if (!length) {
  24954. return -1;
  24955. }
  24956. var index = length - 1;
  24957. if (fromIndex !== undefined) {
  24958. index = toInteger(fromIndex);
  24959. index = fromIndex < 0
  24960. ? nativeMax(length + index, 0)
  24961. : nativeMin(index, length - 1);
  24962. }
  24963. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24964. }
  24965. /**
  24966. * Flattens `array` a single level deep.
  24967. *
  24968. * @static
  24969. * @memberOf _
  24970. * @since 0.1.0
  24971. * @category Array
  24972. * @param {Array} array The array to flatten.
  24973. * @returns {Array} Returns the new flattened array.
  24974. * @example
  24975. *
  24976. * _.flatten([1, [2, [3, [4]], 5]]);
  24977. * // => [1, 2, [3, [4]], 5]
  24978. */
  24979. function flatten(array) {
  24980. var length = array == null ? 0 : array.length;
  24981. return length ? baseFlatten(array, 1) : [];
  24982. }
  24983. /**
  24984. * Recursively flattens `array`.
  24985. *
  24986. * @static
  24987. * @memberOf _
  24988. * @since 3.0.0
  24989. * @category Array
  24990. * @param {Array} array The array to flatten.
  24991. * @returns {Array} Returns the new flattened array.
  24992. * @example
  24993. *
  24994. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24995. * // => [1, 2, 3, 4, 5]
  24996. */
  24997. function flattenDeep(array) {
  24998. var length = array == null ? 0 : array.length;
  24999. return length ? baseFlatten(array, INFINITY) : [];
  25000. }
  25001. /**
  25002. * Recursively flatten `array` up to `depth` times.
  25003. *
  25004. * @static
  25005. * @memberOf _
  25006. * @since 4.4.0
  25007. * @category Array
  25008. * @param {Array} array The array to flatten.
  25009. * @param {number} [depth=1] The maximum recursion depth.
  25010. * @returns {Array} Returns the new flattened array.
  25011. * @example
  25012. *
  25013. * var array = [1, [2, [3, [4]], 5]];
  25014. *
  25015. * _.flattenDepth(array, 1);
  25016. * // => [1, 2, [3, [4]], 5]
  25017. *
  25018. * _.flattenDepth(array, 2);
  25019. * // => [1, 2, 3, [4], 5]
  25020. */
  25021. function flattenDepth(array, depth) {
  25022. var length = array == null ? 0 : array.length;
  25023. if (!length) {
  25024. return [];
  25025. }
  25026. depth = depth === undefined ? 1 : toInteger(depth);
  25027. return baseFlatten(array, depth);
  25028. }
  25029. /**
  25030. * The inverse of `_.toPairs`; this method returns an object composed
  25031. * from key-value `pairs`.
  25032. *
  25033. * @static
  25034. * @memberOf _
  25035. * @since 4.0.0
  25036. * @category Array
  25037. * @param {Array} pairs The key-value pairs.
  25038. * @returns {Object} Returns the new object.
  25039. * @example
  25040. *
  25041. * _.fromPairs([['a', 1], ['b', 2]]);
  25042. * // => { 'a': 1, 'b': 2 }
  25043. */
  25044. function fromPairs(pairs) {
  25045. var index = -1,
  25046. length = pairs == null ? 0 : pairs.length,
  25047. result = {};
  25048. while (++index < length) {
  25049. var pair = pairs[index];
  25050. result[pair[0]] = pair[1];
  25051. }
  25052. return result;
  25053. }
  25054. /**
  25055. * Gets the first element of `array`.
  25056. *
  25057. * @static
  25058. * @memberOf _
  25059. * @since 0.1.0
  25060. * @alias first
  25061. * @category Array
  25062. * @param {Array} array The array to query.
  25063. * @returns {*} Returns the first element of `array`.
  25064. * @example
  25065. *
  25066. * _.head([1, 2, 3]);
  25067. * // => 1
  25068. *
  25069. * _.head([]);
  25070. * // => undefined
  25071. */
  25072. function head(array) {
  25073. return (array && array.length) ? array[0] : undefined;
  25074. }
  25075. /**
  25076. * Gets the index at which the first occurrence of `value` is found in `array`
  25077. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25078. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25079. * offset from the end of `array`.
  25080. *
  25081. * @static
  25082. * @memberOf _
  25083. * @since 0.1.0
  25084. * @category Array
  25085. * @param {Array} array The array to inspect.
  25086. * @param {*} value The value to search for.
  25087. * @param {number} [fromIndex=0] The index to search from.
  25088. * @returns {number} Returns the index of the matched value, else `-1`.
  25089. * @example
  25090. *
  25091. * _.indexOf([1, 2, 1, 2], 2);
  25092. * // => 1
  25093. *
  25094. * // Search from the `fromIndex`.
  25095. * _.indexOf([1, 2, 1, 2], 2, 2);
  25096. * // => 3
  25097. */
  25098. function indexOf(array, value, fromIndex) {
  25099. var length = array == null ? 0 : array.length;
  25100. if (!length) {
  25101. return -1;
  25102. }
  25103. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25104. if (index < 0) {
  25105. index = nativeMax(length + index, 0);
  25106. }
  25107. return baseIndexOf(array, value, index);
  25108. }
  25109. /**
  25110. * Gets all but the last element of `array`.
  25111. *
  25112. * @static
  25113. * @memberOf _
  25114. * @since 0.1.0
  25115. * @category Array
  25116. * @param {Array} array The array to query.
  25117. * @returns {Array} Returns the slice of `array`.
  25118. * @example
  25119. *
  25120. * _.initial([1, 2, 3]);
  25121. * // => [1, 2]
  25122. */
  25123. function initial(array) {
  25124. var length = array == null ? 0 : array.length;
  25125. return length ? baseSlice(array, 0, -1) : [];
  25126. }
  25127. /**
  25128. * Creates an array of unique values that are included in all given arrays
  25129. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25130. * for equality comparisons. The order and references of result values are
  25131. * determined by the first array.
  25132. *
  25133. * @static
  25134. * @memberOf _
  25135. * @since 0.1.0
  25136. * @category Array
  25137. * @param {...Array} [arrays] The arrays to inspect.
  25138. * @returns {Array} Returns the new array of intersecting values.
  25139. * @example
  25140. *
  25141. * _.intersection([2, 1], [2, 3]);
  25142. * // => [2]
  25143. */
  25144. var intersection = baseRest(function(arrays) {
  25145. var mapped = arrayMap(arrays, castArrayLikeObject);
  25146. return (mapped.length && mapped[0] === arrays[0])
  25147. ? baseIntersection(mapped)
  25148. : [];
  25149. });
  25150. /**
  25151. * This method is like `_.intersection` except that it accepts `iteratee`
  25152. * which is invoked for each element of each `arrays` to generate the criterion
  25153. * by which they're compared. The order and references of result values are
  25154. * determined by the first array. The iteratee is invoked with one argument:
  25155. * (value).
  25156. *
  25157. * @static
  25158. * @memberOf _
  25159. * @since 4.0.0
  25160. * @category Array
  25161. * @param {...Array} [arrays] The arrays to inspect.
  25162. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25163. * @returns {Array} Returns the new array of intersecting values.
  25164. * @example
  25165. *
  25166. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25167. * // => [2.1]
  25168. *
  25169. * // The `_.property` iteratee shorthand.
  25170. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25171. * // => [{ 'x': 1 }]
  25172. */
  25173. var intersectionBy = baseRest(function(arrays) {
  25174. var iteratee = last(arrays),
  25175. mapped = arrayMap(arrays, castArrayLikeObject);
  25176. if (iteratee === last(mapped)) {
  25177. iteratee = undefined;
  25178. } else {
  25179. mapped.pop();
  25180. }
  25181. return (mapped.length && mapped[0] === arrays[0])
  25182. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25183. : [];
  25184. });
  25185. /**
  25186. * This method is like `_.intersection` except that it accepts `comparator`
  25187. * which is invoked to compare elements of `arrays`. The order and references
  25188. * of result values are determined by the first array. The comparator is
  25189. * invoked with two arguments: (arrVal, othVal).
  25190. *
  25191. * @static
  25192. * @memberOf _
  25193. * @since 4.0.0
  25194. * @category Array
  25195. * @param {...Array} [arrays] The arrays to inspect.
  25196. * @param {Function} [comparator] The comparator invoked per element.
  25197. * @returns {Array} Returns the new array of intersecting values.
  25198. * @example
  25199. *
  25200. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25201. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25202. *
  25203. * _.intersectionWith(objects, others, _.isEqual);
  25204. * // => [{ 'x': 1, 'y': 2 }]
  25205. */
  25206. var intersectionWith = baseRest(function(arrays) {
  25207. var comparator = last(arrays),
  25208. mapped = arrayMap(arrays, castArrayLikeObject);
  25209. comparator = typeof comparator == 'function' ? comparator : undefined;
  25210. if (comparator) {
  25211. mapped.pop();
  25212. }
  25213. return (mapped.length && mapped[0] === arrays[0])
  25214. ? baseIntersection(mapped, undefined, comparator)
  25215. : [];
  25216. });
  25217. /**
  25218. * Converts all elements in `array` into a string separated by `separator`.
  25219. *
  25220. * @static
  25221. * @memberOf _
  25222. * @since 4.0.0
  25223. * @category Array
  25224. * @param {Array} array The array to convert.
  25225. * @param {string} [separator=','] The element separator.
  25226. * @returns {string} Returns the joined string.
  25227. * @example
  25228. *
  25229. * _.join(['a', 'b', 'c'], '~');
  25230. * // => 'a~b~c'
  25231. */
  25232. function join(array, separator) {
  25233. return array == null ? '' : nativeJoin.call(array, separator);
  25234. }
  25235. /**
  25236. * Gets the last element of `array`.
  25237. *
  25238. * @static
  25239. * @memberOf _
  25240. * @since 0.1.0
  25241. * @category Array
  25242. * @param {Array} array The array to query.
  25243. * @returns {*} Returns the last element of `array`.
  25244. * @example
  25245. *
  25246. * _.last([1, 2, 3]);
  25247. * // => 3
  25248. */
  25249. function last(array) {
  25250. var length = array == null ? 0 : array.length;
  25251. return length ? array[length - 1] : undefined;
  25252. }
  25253. /**
  25254. * This method is like `_.indexOf` except that it iterates over elements of
  25255. * `array` from right to left.
  25256. *
  25257. * @static
  25258. * @memberOf _
  25259. * @since 0.1.0
  25260. * @category Array
  25261. * @param {Array} array The array to inspect.
  25262. * @param {*} value The value to search for.
  25263. * @param {number} [fromIndex=array.length-1] The index to search from.
  25264. * @returns {number} Returns the index of the matched value, else `-1`.
  25265. * @example
  25266. *
  25267. * _.lastIndexOf([1, 2, 1, 2], 2);
  25268. * // => 3
  25269. *
  25270. * // Search from the `fromIndex`.
  25271. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25272. * // => 1
  25273. */
  25274. function lastIndexOf(array, value, fromIndex) {
  25275. var length = array == null ? 0 : array.length;
  25276. if (!length) {
  25277. return -1;
  25278. }
  25279. var index = length;
  25280. if (fromIndex !== undefined) {
  25281. index = toInteger(fromIndex);
  25282. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25283. }
  25284. return value === value
  25285. ? strictLastIndexOf(array, value, index)
  25286. : baseFindIndex(array, baseIsNaN, index, true);
  25287. }
  25288. /**
  25289. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25290. * element from the end is returned.
  25291. *
  25292. * @static
  25293. * @memberOf _
  25294. * @since 4.11.0
  25295. * @category Array
  25296. * @param {Array} array The array to query.
  25297. * @param {number} [n=0] The index of the element to return.
  25298. * @returns {*} Returns the nth element of `array`.
  25299. * @example
  25300. *
  25301. * var array = ['a', 'b', 'c', 'd'];
  25302. *
  25303. * _.nth(array, 1);
  25304. * // => 'b'
  25305. *
  25306. * _.nth(array, -2);
  25307. * // => 'c';
  25308. */
  25309. function nth(array, n) {
  25310. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25311. }
  25312. /**
  25313. * Removes all given values from `array` using
  25314. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25315. * for equality comparisons.
  25316. *
  25317. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25318. * to remove elements from an array by predicate.
  25319. *
  25320. * @static
  25321. * @memberOf _
  25322. * @since 2.0.0
  25323. * @category Array
  25324. * @param {Array} array The array to modify.
  25325. * @param {...*} [values] The values to remove.
  25326. * @returns {Array} Returns `array`.
  25327. * @example
  25328. *
  25329. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25330. *
  25331. * _.pull(array, 'a', 'c');
  25332. * console.log(array);
  25333. * // => ['b', 'b']
  25334. */
  25335. var pull = baseRest(pullAll);
  25336. /**
  25337. * This method is like `_.pull` except that it accepts an array of values to remove.
  25338. *
  25339. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25340. *
  25341. * @static
  25342. * @memberOf _
  25343. * @since 4.0.0
  25344. * @category Array
  25345. * @param {Array} array The array to modify.
  25346. * @param {Array} values The values to remove.
  25347. * @returns {Array} Returns `array`.
  25348. * @example
  25349. *
  25350. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25351. *
  25352. * _.pullAll(array, ['a', 'c']);
  25353. * console.log(array);
  25354. * // => ['b', 'b']
  25355. */
  25356. function pullAll(array, values) {
  25357. return (array && array.length && values && values.length)
  25358. ? basePullAll(array, values)
  25359. : array;
  25360. }
  25361. /**
  25362. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25363. * invoked for each element of `array` and `values` to generate the criterion
  25364. * by which they're compared. The iteratee is invoked with one argument: (value).
  25365. *
  25366. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25367. *
  25368. * @static
  25369. * @memberOf _
  25370. * @since 4.0.0
  25371. * @category Array
  25372. * @param {Array} array The array to modify.
  25373. * @param {Array} values The values to remove.
  25374. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25375. * @returns {Array} Returns `array`.
  25376. * @example
  25377. *
  25378. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25379. *
  25380. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25381. * console.log(array);
  25382. * // => [{ 'x': 2 }]
  25383. */
  25384. function pullAllBy(array, values, iteratee) {
  25385. return (array && array.length && values && values.length)
  25386. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25387. : array;
  25388. }
  25389. /**
  25390. * This method is like `_.pullAll` except that it accepts `comparator` which
  25391. * is invoked to compare elements of `array` to `values`. The comparator is
  25392. * invoked with two arguments: (arrVal, othVal).
  25393. *
  25394. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25395. *
  25396. * @static
  25397. * @memberOf _
  25398. * @since 4.6.0
  25399. * @category Array
  25400. * @param {Array} array The array to modify.
  25401. * @param {Array} values The values to remove.
  25402. * @param {Function} [comparator] The comparator invoked per element.
  25403. * @returns {Array} Returns `array`.
  25404. * @example
  25405. *
  25406. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25407. *
  25408. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25409. * console.log(array);
  25410. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25411. */
  25412. function pullAllWith(array, values, comparator) {
  25413. return (array && array.length && values && values.length)
  25414. ? basePullAll(array, values, undefined, comparator)
  25415. : array;
  25416. }
  25417. /**
  25418. * Removes elements from `array` corresponding to `indexes` and returns an
  25419. * array of removed elements.
  25420. *
  25421. * **Note:** Unlike `_.at`, this method mutates `array`.
  25422. *
  25423. * @static
  25424. * @memberOf _
  25425. * @since 3.0.0
  25426. * @category Array
  25427. * @param {Array} array The array to modify.
  25428. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25429. * @returns {Array} Returns the new array of removed elements.
  25430. * @example
  25431. *
  25432. * var array = ['a', 'b', 'c', 'd'];
  25433. * var pulled = _.pullAt(array, [1, 3]);
  25434. *
  25435. * console.log(array);
  25436. * // => ['a', 'c']
  25437. *
  25438. * console.log(pulled);
  25439. * // => ['b', 'd']
  25440. */
  25441. var pullAt = flatRest(function(array, indexes) {
  25442. var length = array == null ? 0 : array.length,
  25443. result = baseAt(array, indexes);
  25444. basePullAt(array, arrayMap(indexes, function(index) {
  25445. return isIndex(index, length) ? +index : index;
  25446. }).sort(compareAscending));
  25447. return result;
  25448. });
  25449. /**
  25450. * Removes all elements from `array` that `predicate` returns truthy for
  25451. * and returns an array of the removed elements. The predicate is invoked
  25452. * with three arguments: (value, index, array).
  25453. *
  25454. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25455. * to pull elements from an array by value.
  25456. *
  25457. * @static
  25458. * @memberOf _
  25459. * @since 2.0.0
  25460. * @category Array
  25461. * @param {Array} array The array to modify.
  25462. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25463. * @returns {Array} Returns the new array of removed elements.
  25464. * @example
  25465. *
  25466. * var array = [1, 2, 3, 4];
  25467. * var evens = _.remove(array, function(n) {
  25468. * return n % 2 == 0;
  25469. * });
  25470. *
  25471. * console.log(array);
  25472. * // => [1, 3]
  25473. *
  25474. * console.log(evens);
  25475. * // => [2, 4]
  25476. */
  25477. function remove(array, predicate) {
  25478. var result = [];
  25479. if (!(array && array.length)) {
  25480. return result;
  25481. }
  25482. var index = -1,
  25483. indexes = [],
  25484. length = array.length;
  25485. predicate = getIteratee(predicate, 3);
  25486. while (++index < length) {
  25487. var value = array[index];
  25488. if (predicate(value, index, array)) {
  25489. result.push(value);
  25490. indexes.push(index);
  25491. }
  25492. }
  25493. basePullAt(array, indexes);
  25494. return result;
  25495. }
  25496. /**
  25497. * Reverses `array` so that the first element becomes the last, the second
  25498. * element becomes the second to last, and so on.
  25499. *
  25500. * **Note:** This method mutates `array` and is based on
  25501. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25502. *
  25503. * @static
  25504. * @memberOf _
  25505. * @since 4.0.0
  25506. * @category Array
  25507. * @param {Array} array The array to modify.
  25508. * @returns {Array} Returns `array`.
  25509. * @example
  25510. *
  25511. * var array = [1, 2, 3];
  25512. *
  25513. * _.reverse(array);
  25514. * // => [3, 2, 1]
  25515. *
  25516. * console.log(array);
  25517. * // => [3, 2, 1]
  25518. */
  25519. function reverse(array) {
  25520. return array == null ? array : nativeReverse.call(array);
  25521. }
  25522. /**
  25523. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25524. *
  25525. * **Note:** This method is used instead of
  25526. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25527. * returned.
  25528. *
  25529. * @static
  25530. * @memberOf _
  25531. * @since 3.0.0
  25532. * @category Array
  25533. * @param {Array} array The array to slice.
  25534. * @param {number} [start=0] The start position.
  25535. * @param {number} [end=array.length] The end position.
  25536. * @returns {Array} Returns the slice of `array`.
  25537. */
  25538. function slice(array, start, end) {
  25539. var length = array == null ? 0 : array.length;
  25540. if (!length) {
  25541. return [];
  25542. }
  25543. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25544. start = 0;
  25545. end = length;
  25546. }
  25547. else {
  25548. start = start == null ? 0 : toInteger(start);
  25549. end = end === undefined ? length : toInteger(end);
  25550. }
  25551. return baseSlice(array, start, end);
  25552. }
  25553. /**
  25554. * Uses a binary search to determine the lowest index at which `value`
  25555. * should be inserted into `array` in order to maintain its sort order.
  25556. *
  25557. * @static
  25558. * @memberOf _
  25559. * @since 0.1.0
  25560. * @category Array
  25561. * @param {Array} array The sorted array to inspect.
  25562. * @param {*} value The value to evaluate.
  25563. * @returns {number} Returns the index at which `value` should be inserted
  25564. * into `array`.
  25565. * @example
  25566. *
  25567. * _.sortedIndex([30, 50], 40);
  25568. * // => 1
  25569. */
  25570. function sortedIndex(array, value) {
  25571. return baseSortedIndex(array, value);
  25572. }
  25573. /**
  25574. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25575. * which is invoked for `value` and each element of `array` to compute their
  25576. * sort ranking. The iteratee is invoked with one argument: (value).
  25577. *
  25578. * @static
  25579. * @memberOf _
  25580. * @since 4.0.0
  25581. * @category Array
  25582. * @param {Array} array The sorted array to inspect.
  25583. * @param {*} value The value to evaluate.
  25584. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25585. * @returns {number} Returns the index at which `value` should be inserted
  25586. * into `array`.
  25587. * @example
  25588. *
  25589. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25590. *
  25591. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25592. * // => 0
  25593. *
  25594. * // The `_.property` iteratee shorthand.
  25595. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25596. * // => 0
  25597. */
  25598. function sortedIndexBy(array, value, iteratee) {
  25599. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25600. }
  25601. /**
  25602. * This method is like `_.indexOf` except that it performs a binary
  25603. * search on a sorted `array`.
  25604. *
  25605. * @static
  25606. * @memberOf _
  25607. * @since 4.0.0
  25608. * @category Array
  25609. * @param {Array} array The array to inspect.
  25610. * @param {*} value The value to search for.
  25611. * @returns {number} Returns the index of the matched value, else `-1`.
  25612. * @example
  25613. *
  25614. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25615. * // => 1
  25616. */
  25617. function sortedIndexOf(array, value) {
  25618. var length = array == null ? 0 : array.length;
  25619. if (length) {
  25620. var index = baseSortedIndex(array, value);
  25621. if (index < length && eq(array[index], value)) {
  25622. return index;
  25623. }
  25624. }
  25625. return -1;
  25626. }
  25627. /**
  25628. * This method is like `_.sortedIndex` except that it returns the highest
  25629. * index at which `value` should be inserted into `array` in order to
  25630. * maintain its sort order.
  25631. *
  25632. * @static
  25633. * @memberOf _
  25634. * @since 3.0.0
  25635. * @category Array
  25636. * @param {Array} array The sorted array to inspect.
  25637. * @param {*} value The value to evaluate.
  25638. * @returns {number} Returns the index at which `value` should be inserted
  25639. * into `array`.
  25640. * @example
  25641. *
  25642. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25643. * // => 4
  25644. */
  25645. function sortedLastIndex(array, value) {
  25646. return baseSortedIndex(array, value, true);
  25647. }
  25648. /**
  25649. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25650. * which is invoked for `value` and each element of `array` to compute their
  25651. * sort ranking. The iteratee is invoked with one argument: (value).
  25652. *
  25653. * @static
  25654. * @memberOf _
  25655. * @since 4.0.0
  25656. * @category Array
  25657. * @param {Array} array The sorted array to inspect.
  25658. * @param {*} value The value to evaluate.
  25659. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25660. * @returns {number} Returns the index at which `value` should be inserted
  25661. * into `array`.
  25662. * @example
  25663. *
  25664. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25665. *
  25666. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25667. * // => 1
  25668. *
  25669. * // The `_.property` iteratee shorthand.
  25670. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25671. * // => 1
  25672. */
  25673. function sortedLastIndexBy(array, value, iteratee) {
  25674. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25675. }
  25676. /**
  25677. * This method is like `_.lastIndexOf` except that it performs a binary
  25678. * search on a sorted `array`.
  25679. *
  25680. * @static
  25681. * @memberOf _
  25682. * @since 4.0.0
  25683. * @category Array
  25684. * @param {Array} array The array to inspect.
  25685. * @param {*} value The value to search for.
  25686. * @returns {number} Returns the index of the matched value, else `-1`.
  25687. * @example
  25688. *
  25689. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25690. * // => 3
  25691. */
  25692. function sortedLastIndexOf(array, value) {
  25693. var length = array == null ? 0 : array.length;
  25694. if (length) {
  25695. var index = baseSortedIndex(array, value, true) - 1;
  25696. if (eq(array[index], value)) {
  25697. return index;
  25698. }
  25699. }
  25700. return -1;
  25701. }
  25702. /**
  25703. * This method is like `_.uniq` except that it's designed and optimized
  25704. * for sorted arrays.
  25705. *
  25706. * @static
  25707. * @memberOf _
  25708. * @since 4.0.0
  25709. * @category Array
  25710. * @param {Array} array The array to inspect.
  25711. * @returns {Array} Returns the new duplicate free array.
  25712. * @example
  25713. *
  25714. * _.sortedUniq([1, 1, 2]);
  25715. * // => [1, 2]
  25716. */
  25717. function sortedUniq(array) {
  25718. return (array && array.length)
  25719. ? baseSortedUniq(array)
  25720. : [];
  25721. }
  25722. /**
  25723. * This method is like `_.uniqBy` except that it's designed and optimized
  25724. * for sorted arrays.
  25725. *
  25726. * @static
  25727. * @memberOf _
  25728. * @since 4.0.0
  25729. * @category Array
  25730. * @param {Array} array The array to inspect.
  25731. * @param {Function} [iteratee] The iteratee invoked per element.
  25732. * @returns {Array} Returns the new duplicate free array.
  25733. * @example
  25734. *
  25735. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25736. * // => [1.1, 2.3]
  25737. */
  25738. function sortedUniqBy(array, iteratee) {
  25739. return (array && array.length)
  25740. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25741. : [];
  25742. }
  25743. /**
  25744. * Gets all but the first element of `array`.
  25745. *
  25746. * @static
  25747. * @memberOf _
  25748. * @since 4.0.0
  25749. * @category Array
  25750. * @param {Array} array The array to query.
  25751. * @returns {Array} Returns the slice of `array`.
  25752. * @example
  25753. *
  25754. * _.tail([1, 2, 3]);
  25755. * // => [2, 3]
  25756. */
  25757. function tail(array) {
  25758. var length = array == null ? 0 : array.length;
  25759. return length ? baseSlice(array, 1, length) : [];
  25760. }
  25761. /**
  25762. * Creates a slice of `array` with `n` elements taken from the beginning.
  25763. *
  25764. * @static
  25765. * @memberOf _
  25766. * @since 0.1.0
  25767. * @category Array
  25768. * @param {Array} array The array to query.
  25769. * @param {number} [n=1] The number of elements to take.
  25770. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25771. * @returns {Array} Returns the slice of `array`.
  25772. * @example
  25773. *
  25774. * _.take([1, 2, 3]);
  25775. * // => [1]
  25776. *
  25777. * _.take([1, 2, 3], 2);
  25778. * // => [1, 2]
  25779. *
  25780. * _.take([1, 2, 3], 5);
  25781. * // => [1, 2, 3]
  25782. *
  25783. * _.take([1, 2, 3], 0);
  25784. * // => []
  25785. */
  25786. function take(array, n, guard) {
  25787. if (!(array && array.length)) {
  25788. return [];
  25789. }
  25790. n = (guard || n === undefined) ? 1 : toInteger(n);
  25791. return baseSlice(array, 0, n < 0 ? 0 : n);
  25792. }
  25793. /**
  25794. * Creates a slice of `array` with `n` elements taken from the end.
  25795. *
  25796. * @static
  25797. * @memberOf _
  25798. * @since 3.0.0
  25799. * @category Array
  25800. * @param {Array} array The array to query.
  25801. * @param {number} [n=1] The number of elements to take.
  25802. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25803. * @returns {Array} Returns the slice of `array`.
  25804. * @example
  25805. *
  25806. * _.takeRight([1, 2, 3]);
  25807. * // => [3]
  25808. *
  25809. * _.takeRight([1, 2, 3], 2);
  25810. * // => [2, 3]
  25811. *
  25812. * _.takeRight([1, 2, 3], 5);
  25813. * // => [1, 2, 3]
  25814. *
  25815. * _.takeRight([1, 2, 3], 0);
  25816. * // => []
  25817. */
  25818. function takeRight(array, n, guard) {
  25819. var length = array == null ? 0 : array.length;
  25820. if (!length) {
  25821. return [];
  25822. }
  25823. n = (guard || n === undefined) ? 1 : toInteger(n);
  25824. n = length - n;
  25825. return baseSlice(array, n < 0 ? 0 : n, length);
  25826. }
  25827. /**
  25828. * Creates a slice of `array` with elements taken from the end. Elements are
  25829. * taken until `predicate` returns falsey. The predicate is invoked with
  25830. * three arguments: (value, index, array).
  25831. *
  25832. * @static
  25833. * @memberOf _
  25834. * @since 3.0.0
  25835. * @category Array
  25836. * @param {Array} array The array to query.
  25837. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25838. * @returns {Array} Returns the slice of `array`.
  25839. * @example
  25840. *
  25841. * var users = [
  25842. * { 'user': 'barney', 'active': true },
  25843. * { 'user': 'fred', 'active': false },
  25844. * { 'user': 'pebbles', 'active': false }
  25845. * ];
  25846. *
  25847. * _.takeRightWhile(users, function(o) { return !o.active; });
  25848. * // => objects for ['fred', 'pebbles']
  25849. *
  25850. * // The `_.matches` iteratee shorthand.
  25851. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25852. * // => objects for ['pebbles']
  25853. *
  25854. * // The `_.matchesProperty` iteratee shorthand.
  25855. * _.takeRightWhile(users, ['active', false]);
  25856. * // => objects for ['fred', 'pebbles']
  25857. *
  25858. * // The `_.property` iteratee shorthand.
  25859. * _.takeRightWhile(users, 'active');
  25860. * // => []
  25861. */
  25862. function takeRightWhile(array, predicate) {
  25863. return (array && array.length)
  25864. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25865. : [];
  25866. }
  25867. /**
  25868. * Creates a slice of `array` with elements taken from the beginning. Elements
  25869. * are taken until `predicate` returns falsey. The predicate is invoked with
  25870. * three arguments: (value, index, array).
  25871. *
  25872. * @static
  25873. * @memberOf _
  25874. * @since 3.0.0
  25875. * @category Array
  25876. * @param {Array} array The array to query.
  25877. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25878. * @returns {Array} Returns the slice of `array`.
  25879. * @example
  25880. *
  25881. * var users = [
  25882. * { 'user': 'barney', 'active': false },
  25883. * { 'user': 'fred', 'active': false },
  25884. * { 'user': 'pebbles', 'active': true }
  25885. * ];
  25886. *
  25887. * _.takeWhile(users, function(o) { return !o.active; });
  25888. * // => objects for ['barney', 'fred']
  25889. *
  25890. * // The `_.matches` iteratee shorthand.
  25891. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25892. * // => objects for ['barney']
  25893. *
  25894. * // The `_.matchesProperty` iteratee shorthand.
  25895. * _.takeWhile(users, ['active', false]);
  25896. * // => objects for ['barney', 'fred']
  25897. *
  25898. * // The `_.property` iteratee shorthand.
  25899. * _.takeWhile(users, 'active');
  25900. * // => []
  25901. */
  25902. function takeWhile(array, predicate) {
  25903. return (array && array.length)
  25904. ? baseWhile(array, getIteratee(predicate, 3))
  25905. : [];
  25906. }
  25907. /**
  25908. * Creates an array of unique values, in order, from all given arrays using
  25909. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25910. * for equality comparisons.
  25911. *
  25912. * @static
  25913. * @memberOf _
  25914. * @since 0.1.0
  25915. * @category Array
  25916. * @param {...Array} [arrays] The arrays to inspect.
  25917. * @returns {Array} Returns the new array of combined values.
  25918. * @example
  25919. *
  25920. * _.union([2], [1, 2]);
  25921. * // => [2, 1]
  25922. */
  25923. var union = baseRest(function(arrays) {
  25924. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25925. });
  25926. /**
  25927. * This method is like `_.union` except that it accepts `iteratee` which is
  25928. * invoked for each element of each `arrays` to generate the criterion by
  25929. * which uniqueness is computed. Result values are chosen from the first
  25930. * array in which the value occurs. The iteratee is invoked with one argument:
  25931. * (value).
  25932. *
  25933. * @static
  25934. * @memberOf _
  25935. * @since 4.0.0
  25936. * @category Array
  25937. * @param {...Array} [arrays] The arrays to inspect.
  25938. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25939. * @returns {Array} Returns the new array of combined values.
  25940. * @example
  25941. *
  25942. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25943. * // => [2.1, 1.2]
  25944. *
  25945. * // The `_.property` iteratee shorthand.
  25946. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25947. * // => [{ 'x': 1 }, { 'x': 2 }]
  25948. */
  25949. var unionBy = baseRest(function(arrays) {
  25950. var iteratee = last(arrays);
  25951. if (isArrayLikeObject(iteratee)) {
  25952. iteratee = undefined;
  25953. }
  25954. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25955. });
  25956. /**
  25957. * This method is like `_.union` except that it accepts `comparator` which
  25958. * is invoked to compare elements of `arrays`. Result values are chosen from
  25959. * the first array in which the value occurs. The comparator is invoked
  25960. * with two arguments: (arrVal, othVal).
  25961. *
  25962. * @static
  25963. * @memberOf _
  25964. * @since 4.0.0
  25965. * @category Array
  25966. * @param {...Array} [arrays] The arrays to inspect.
  25967. * @param {Function} [comparator] The comparator invoked per element.
  25968. * @returns {Array} Returns the new array of combined values.
  25969. * @example
  25970. *
  25971. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25972. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25973. *
  25974. * _.unionWith(objects, others, _.isEqual);
  25975. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25976. */
  25977. var unionWith = baseRest(function(arrays) {
  25978. var comparator = last(arrays);
  25979. comparator = typeof comparator == 'function' ? comparator : undefined;
  25980. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25981. });
  25982. /**
  25983. * Creates a duplicate-free version of an array, using
  25984. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25985. * for equality comparisons, in which only the first occurrence of each element
  25986. * is kept. The order of result values is determined by the order they occur
  25987. * in the array.
  25988. *
  25989. * @static
  25990. * @memberOf _
  25991. * @since 0.1.0
  25992. * @category Array
  25993. * @param {Array} array The array to inspect.
  25994. * @returns {Array} Returns the new duplicate free array.
  25995. * @example
  25996. *
  25997. * _.uniq([2, 1, 2]);
  25998. * // => [2, 1]
  25999. */
  26000. function uniq(array) {
  26001. return (array && array.length) ? baseUniq(array) : [];
  26002. }
  26003. /**
  26004. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26005. * invoked for each element in `array` to generate the criterion by which
  26006. * uniqueness is computed. The order of result values is determined by the
  26007. * order they occur in the array. The iteratee is invoked with one argument:
  26008. * (value).
  26009. *
  26010. * @static
  26011. * @memberOf _
  26012. * @since 4.0.0
  26013. * @category Array
  26014. * @param {Array} array The array to inspect.
  26015. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26016. * @returns {Array} Returns the new duplicate free array.
  26017. * @example
  26018. *
  26019. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26020. * // => [2.1, 1.2]
  26021. *
  26022. * // The `_.property` iteratee shorthand.
  26023. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26024. * // => [{ 'x': 1 }, { 'x': 2 }]
  26025. */
  26026. function uniqBy(array, iteratee) {
  26027. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26028. }
  26029. /**
  26030. * This method is like `_.uniq` except that it accepts `comparator` which
  26031. * is invoked to compare elements of `array`. The order of result values is
  26032. * determined by the order they occur in the array.The comparator is invoked
  26033. * with two arguments: (arrVal, othVal).
  26034. *
  26035. * @static
  26036. * @memberOf _
  26037. * @since 4.0.0
  26038. * @category Array
  26039. * @param {Array} array The array to inspect.
  26040. * @param {Function} [comparator] The comparator invoked per element.
  26041. * @returns {Array} Returns the new duplicate free array.
  26042. * @example
  26043. *
  26044. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26045. *
  26046. * _.uniqWith(objects, _.isEqual);
  26047. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26048. */
  26049. function uniqWith(array, comparator) {
  26050. comparator = typeof comparator == 'function' ? comparator : undefined;
  26051. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26052. }
  26053. /**
  26054. * This method is like `_.zip` except that it accepts an array of grouped
  26055. * elements and creates an array regrouping the elements to their pre-zip
  26056. * configuration.
  26057. *
  26058. * @static
  26059. * @memberOf _
  26060. * @since 1.2.0
  26061. * @category Array
  26062. * @param {Array} array The array of grouped elements to process.
  26063. * @returns {Array} Returns the new array of regrouped elements.
  26064. * @example
  26065. *
  26066. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26067. * // => [['a', 1, true], ['b', 2, false]]
  26068. *
  26069. * _.unzip(zipped);
  26070. * // => [['a', 'b'], [1, 2], [true, false]]
  26071. */
  26072. function unzip(array) {
  26073. if (!(array && array.length)) {
  26074. return [];
  26075. }
  26076. var length = 0;
  26077. array = arrayFilter(array, function(group) {
  26078. if (isArrayLikeObject(group)) {
  26079. length = nativeMax(group.length, length);
  26080. return true;
  26081. }
  26082. });
  26083. return baseTimes(length, function(index) {
  26084. return arrayMap(array, baseProperty(index));
  26085. });
  26086. }
  26087. /**
  26088. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26089. * how regrouped values should be combined. The iteratee is invoked with the
  26090. * elements of each group: (...group).
  26091. *
  26092. * @static
  26093. * @memberOf _
  26094. * @since 3.8.0
  26095. * @category Array
  26096. * @param {Array} array The array of grouped elements to process.
  26097. * @param {Function} [iteratee=_.identity] The function to combine
  26098. * regrouped values.
  26099. * @returns {Array} Returns the new array of regrouped elements.
  26100. * @example
  26101. *
  26102. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26103. * // => [[1, 10, 100], [2, 20, 200]]
  26104. *
  26105. * _.unzipWith(zipped, _.add);
  26106. * // => [3, 30, 300]
  26107. */
  26108. function unzipWith(array, iteratee) {
  26109. if (!(array && array.length)) {
  26110. return [];
  26111. }
  26112. var result = unzip(array);
  26113. if (iteratee == null) {
  26114. return result;
  26115. }
  26116. return arrayMap(result, function(group) {
  26117. return apply(iteratee, undefined, group);
  26118. });
  26119. }
  26120. /**
  26121. * Creates an array excluding all given values using
  26122. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26123. * for equality comparisons.
  26124. *
  26125. * **Note:** Unlike `_.pull`, this method returns a new array.
  26126. *
  26127. * @static
  26128. * @memberOf _
  26129. * @since 0.1.0
  26130. * @category Array
  26131. * @param {Array} array The array to inspect.
  26132. * @param {...*} [values] The values to exclude.
  26133. * @returns {Array} Returns the new array of filtered values.
  26134. * @see _.difference, _.xor
  26135. * @example
  26136. *
  26137. * _.without([2, 1, 2, 3], 1, 2);
  26138. * // => [3]
  26139. */
  26140. var without = baseRest(function(array, values) {
  26141. return isArrayLikeObject(array)
  26142. ? baseDifference(array, values)
  26143. : [];
  26144. });
  26145. /**
  26146. * Creates an array of unique values that is the
  26147. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26148. * of the given arrays. The order of result values is determined by the order
  26149. * they occur in the arrays.
  26150. *
  26151. * @static
  26152. * @memberOf _
  26153. * @since 2.4.0
  26154. * @category Array
  26155. * @param {...Array} [arrays] The arrays to inspect.
  26156. * @returns {Array} Returns the new array of filtered values.
  26157. * @see _.difference, _.without
  26158. * @example
  26159. *
  26160. * _.xor([2, 1], [2, 3]);
  26161. * // => [1, 3]
  26162. */
  26163. var xor = baseRest(function(arrays) {
  26164. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26165. });
  26166. /**
  26167. * This method is like `_.xor` except that it accepts `iteratee` which is
  26168. * invoked for each element of each `arrays` to generate the criterion by
  26169. * which by which they're compared. The order of result values is determined
  26170. * by the order they occur in the arrays. The iteratee is invoked with one
  26171. * argument: (value).
  26172. *
  26173. * @static
  26174. * @memberOf _
  26175. * @since 4.0.0
  26176. * @category Array
  26177. * @param {...Array} [arrays] The arrays to inspect.
  26178. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26179. * @returns {Array} Returns the new array of filtered values.
  26180. * @example
  26181. *
  26182. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26183. * // => [1.2, 3.4]
  26184. *
  26185. * // The `_.property` iteratee shorthand.
  26186. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26187. * // => [{ 'x': 2 }]
  26188. */
  26189. var xorBy = baseRest(function(arrays) {
  26190. var iteratee = last(arrays);
  26191. if (isArrayLikeObject(iteratee)) {
  26192. iteratee = undefined;
  26193. }
  26194. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26195. });
  26196. /**
  26197. * This method is like `_.xor` except that it accepts `comparator` which is
  26198. * invoked to compare elements of `arrays`. The order of result values is
  26199. * determined by the order they occur in the arrays. The comparator is invoked
  26200. * with two arguments: (arrVal, othVal).
  26201. *
  26202. * @static
  26203. * @memberOf _
  26204. * @since 4.0.0
  26205. * @category Array
  26206. * @param {...Array} [arrays] The arrays to inspect.
  26207. * @param {Function} [comparator] The comparator invoked per element.
  26208. * @returns {Array} Returns the new array of filtered values.
  26209. * @example
  26210. *
  26211. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26212. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26213. *
  26214. * _.xorWith(objects, others, _.isEqual);
  26215. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26216. */
  26217. var xorWith = baseRest(function(arrays) {
  26218. var comparator = last(arrays);
  26219. comparator = typeof comparator == 'function' ? comparator : undefined;
  26220. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26221. });
  26222. /**
  26223. * Creates an array of grouped elements, the first of which contains the
  26224. * first elements of the given arrays, the second of which contains the
  26225. * second elements of the given arrays, and so on.
  26226. *
  26227. * @static
  26228. * @memberOf _
  26229. * @since 0.1.0
  26230. * @category Array
  26231. * @param {...Array} [arrays] The arrays to process.
  26232. * @returns {Array} Returns the new array of grouped elements.
  26233. * @example
  26234. *
  26235. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26236. * // => [['a', 1, true], ['b', 2, false]]
  26237. */
  26238. var zip = baseRest(unzip);
  26239. /**
  26240. * This method is like `_.fromPairs` except that it accepts two arrays,
  26241. * one of property identifiers and one of corresponding values.
  26242. *
  26243. * @static
  26244. * @memberOf _
  26245. * @since 0.4.0
  26246. * @category Array
  26247. * @param {Array} [props=[]] The property identifiers.
  26248. * @param {Array} [values=[]] The property values.
  26249. * @returns {Object} Returns the new object.
  26250. * @example
  26251. *
  26252. * _.zipObject(['a', 'b'], [1, 2]);
  26253. * // => { 'a': 1, 'b': 2 }
  26254. */
  26255. function zipObject(props, values) {
  26256. return baseZipObject(props || [], values || [], assignValue);
  26257. }
  26258. /**
  26259. * This method is like `_.zipObject` except that it supports property paths.
  26260. *
  26261. * @static
  26262. * @memberOf _
  26263. * @since 4.1.0
  26264. * @category Array
  26265. * @param {Array} [props=[]] The property identifiers.
  26266. * @param {Array} [values=[]] The property values.
  26267. * @returns {Object} Returns the new object.
  26268. * @example
  26269. *
  26270. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26271. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26272. */
  26273. function zipObjectDeep(props, values) {
  26274. return baseZipObject(props || [], values || [], baseSet);
  26275. }
  26276. /**
  26277. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26278. * how grouped values should be combined. The iteratee is invoked with the
  26279. * elements of each group: (...group).
  26280. *
  26281. * @static
  26282. * @memberOf _
  26283. * @since 3.8.0
  26284. * @category Array
  26285. * @param {...Array} [arrays] The arrays to process.
  26286. * @param {Function} [iteratee=_.identity] The function to combine
  26287. * grouped values.
  26288. * @returns {Array} Returns the new array of grouped elements.
  26289. * @example
  26290. *
  26291. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26292. * return a + b + c;
  26293. * });
  26294. * // => [111, 222]
  26295. */
  26296. var zipWith = baseRest(function(arrays) {
  26297. var length = arrays.length,
  26298. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26299. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26300. return unzipWith(arrays, iteratee);
  26301. });
  26302. /*------------------------------------------------------------------------*/
  26303. /**
  26304. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26305. * chain sequences enabled. The result of such sequences must be unwrapped
  26306. * with `_#value`.
  26307. *
  26308. * @static
  26309. * @memberOf _
  26310. * @since 1.3.0
  26311. * @category Seq
  26312. * @param {*} value The value to wrap.
  26313. * @returns {Object} Returns the new `lodash` wrapper instance.
  26314. * @example
  26315. *
  26316. * var users = [
  26317. * { 'user': 'barney', 'age': 36 },
  26318. * { 'user': 'fred', 'age': 40 },
  26319. * { 'user': 'pebbles', 'age': 1 }
  26320. * ];
  26321. *
  26322. * var youngest = _
  26323. * .chain(users)
  26324. * .sortBy('age')
  26325. * .map(function(o) {
  26326. * return o.user + ' is ' + o.age;
  26327. * })
  26328. * .head()
  26329. * .value();
  26330. * // => 'pebbles is 1'
  26331. */
  26332. function chain(value) {
  26333. var result = lodash(value);
  26334. result.__chain__ = true;
  26335. return result;
  26336. }
  26337. /**
  26338. * This method invokes `interceptor` and returns `value`. The interceptor
  26339. * is invoked with one argument; (value). The purpose of this method is to
  26340. * "tap into" a method chain sequence in order to modify intermediate results.
  26341. *
  26342. * @static
  26343. * @memberOf _
  26344. * @since 0.1.0
  26345. * @category Seq
  26346. * @param {*} value The value to provide to `interceptor`.
  26347. * @param {Function} interceptor The function to invoke.
  26348. * @returns {*} Returns `value`.
  26349. * @example
  26350. *
  26351. * _([1, 2, 3])
  26352. * .tap(function(array) {
  26353. * // Mutate input array.
  26354. * array.pop();
  26355. * })
  26356. * .reverse()
  26357. * .value();
  26358. * // => [2, 1]
  26359. */
  26360. function tap(value, interceptor) {
  26361. interceptor(value);
  26362. return value;
  26363. }
  26364. /**
  26365. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26366. * The purpose of this method is to "pass thru" values replacing intermediate
  26367. * results in a method chain sequence.
  26368. *
  26369. * @static
  26370. * @memberOf _
  26371. * @since 3.0.0
  26372. * @category Seq
  26373. * @param {*} value The value to provide to `interceptor`.
  26374. * @param {Function} interceptor The function to invoke.
  26375. * @returns {*} Returns the result of `interceptor`.
  26376. * @example
  26377. *
  26378. * _(' abc ')
  26379. * .chain()
  26380. * .trim()
  26381. * .thru(function(value) {
  26382. * return [value];
  26383. * })
  26384. * .value();
  26385. * // => ['abc']
  26386. */
  26387. function thru(value, interceptor) {
  26388. return interceptor(value);
  26389. }
  26390. /**
  26391. * This method is the wrapper version of `_.at`.
  26392. *
  26393. * @name at
  26394. * @memberOf _
  26395. * @since 1.0.0
  26396. * @category Seq
  26397. * @param {...(string|string[])} [paths] The property paths to pick.
  26398. * @returns {Object} Returns the new `lodash` wrapper instance.
  26399. * @example
  26400. *
  26401. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26402. *
  26403. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26404. * // => [3, 4]
  26405. */
  26406. var wrapperAt = flatRest(function(paths) {
  26407. var length = paths.length,
  26408. start = length ? paths[0] : 0,
  26409. value = this.__wrapped__,
  26410. interceptor = function(object) { return baseAt(object, paths); };
  26411. if (length > 1 || this.__actions__.length ||
  26412. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26413. return this.thru(interceptor);
  26414. }
  26415. value = value.slice(start, +start + (length ? 1 : 0));
  26416. value.__actions__.push({
  26417. 'func': thru,
  26418. 'args': [interceptor],
  26419. 'thisArg': undefined
  26420. });
  26421. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26422. if (length && !array.length) {
  26423. array.push(undefined);
  26424. }
  26425. return array;
  26426. });
  26427. });
  26428. /**
  26429. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26430. *
  26431. * @name chain
  26432. * @memberOf _
  26433. * @since 0.1.0
  26434. * @category Seq
  26435. * @returns {Object} Returns the new `lodash` wrapper instance.
  26436. * @example
  26437. *
  26438. * var users = [
  26439. * { 'user': 'barney', 'age': 36 },
  26440. * { 'user': 'fred', 'age': 40 }
  26441. * ];
  26442. *
  26443. * // A sequence without explicit chaining.
  26444. * _(users).head();
  26445. * // => { 'user': 'barney', 'age': 36 }
  26446. *
  26447. * // A sequence with explicit chaining.
  26448. * _(users)
  26449. * .chain()
  26450. * .head()
  26451. * .pick('user')
  26452. * .value();
  26453. * // => { 'user': 'barney' }
  26454. */
  26455. function wrapperChain() {
  26456. return chain(this);
  26457. }
  26458. /**
  26459. * Executes the chain sequence and returns the wrapped result.
  26460. *
  26461. * @name commit
  26462. * @memberOf _
  26463. * @since 3.2.0
  26464. * @category Seq
  26465. * @returns {Object} Returns the new `lodash` wrapper instance.
  26466. * @example
  26467. *
  26468. * var array = [1, 2];
  26469. * var wrapped = _(array).push(3);
  26470. *
  26471. * console.log(array);
  26472. * // => [1, 2]
  26473. *
  26474. * wrapped = wrapped.commit();
  26475. * console.log(array);
  26476. * // => [1, 2, 3]
  26477. *
  26478. * wrapped.last();
  26479. * // => 3
  26480. *
  26481. * console.log(array);
  26482. * // => [1, 2, 3]
  26483. */
  26484. function wrapperCommit() {
  26485. return new LodashWrapper(this.value(), this.__chain__);
  26486. }
  26487. /**
  26488. * Gets the next value on a wrapped object following the
  26489. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26490. *
  26491. * @name next
  26492. * @memberOf _
  26493. * @since 4.0.0
  26494. * @category Seq
  26495. * @returns {Object} Returns the next iterator value.
  26496. * @example
  26497. *
  26498. * var wrapped = _([1, 2]);
  26499. *
  26500. * wrapped.next();
  26501. * // => { 'done': false, 'value': 1 }
  26502. *
  26503. * wrapped.next();
  26504. * // => { 'done': false, 'value': 2 }
  26505. *
  26506. * wrapped.next();
  26507. * // => { 'done': true, 'value': undefined }
  26508. */
  26509. function wrapperNext() {
  26510. if (this.__values__ === undefined) {
  26511. this.__values__ = toArray(this.value());
  26512. }
  26513. var done = this.__index__ >= this.__values__.length,
  26514. value = done ? undefined : this.__values__[this.__index__++];
  26515. return { 'done': done, 'value': value };
  26516. }
  26517. /**
  26518. * Enables the wrapper to be iterable.
  26519. *
  26520. * @name Symbol.iterator
  26521. * @memberOf _
  26522. * @since 4.0.0
  26523. * @category Seq
  26524. * @returns {Object} Returns the wrapper object.
  26525. * @example
  26526. *
  26527. * var wrapped = _([1, 2]);
  26528. *
  26529. * wrapped[Symbol.iterator]() === wrapped;
  26530. * // => true
  26531. *
  26532. * Array.from(wrapped);
  26533. * // => [1, 2]
  26534. */
  26535. function wrapperToIterator() {
  26536. return this;
  26537. }
  26538. /**
  26539. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26540. *
  26541. * @name plant
  26542. * @memberOf _
  26543. * @since 3.2.0
  26544. * @category Seq
  26545. * @param {*} value The value to plant.
  26546. * @returns {Object} Returns the new `lodash` wrapper instance.
  26547. * @example
  26548. *
  26549. * function square(n) {
  26550. * return n * n;
  26551. * }
  26552. *
  26553. * var wrapped = _([1, 2]).map(square);
  26554. * var other = wrapped.plant([3, 4]);
  26555. *
  26556. * other.value();
  26557. * // => [9, 16]
  26558. *
  26559. * wrapped.value();
  26560. * // => [1, 4]
  26561. */
  26562. function wrapperPlant(value) {
  26563. var result,
  26564. parent = this;
  26565. while (parent instanceof baseLodash) {
  26566. var clone = wrapperClone(parent);
  26567. clone.__index__ = 0;
  26568. clone.__values__ = undefined;
  26569. if (result) {
  26570. previous.__wrapped__ = clone;
  26571. } else {
  26572. result = clone;
  26573. }
  26574. var previous = clone;
  26575. parent = parent.__wrapped__;
  26576. }
  26577. previous.__wrapped__ = value;
  26578. return result;
  26579. }
  26580. /**
  26581. * This method is the wrapper version of `_.reverse`.
  26582. *
  26583. * **Note:** This method mutates the wrapped array.
  26584. *
  26585. * @name reverse
  26586. * @memberOf _
  26587. * @since 0.1.0
  26588. * @category Seq
  26589. * @returns {Object} Returns the new `lodash` wrapper instance.
  26590. * @example
  26591. *
  26592. * var array = [1, 2, 3];
  26593. *
  26594. * _(array).reverse().value()
  26595. * // => [3, 2, 1]
  26596. *
  26597. * console.log(array);
  26598. * // => [3, 2, 1]
  26599. */
  26600. function wrapperReverse() {
  26601. var value = this.__wrapped__;
  26602. if (value instanceof LazyWrapper) {
  26603. var wrapped = value;
  26604. if (this.__actions__.length) {
  26605. wrapped = new LazyWrapper(this);
  26606. }
  26607. wrapped = wrapped.reverse();
  26608. wrapped.__actions__.push({
  26609. 'func': thru,
  26610. 'args': [reverse],
  26611. 'thisArg': undefined
  26612. });
  26613. return new LodashWrapper(wrapped, this.__chain__);
  26614. }
  26615. return this.thru(reverse);
  26616. }
  26617. /**
  26618. * Executes the chain sequence to resolve the unwrapped value.
  26619. *
  26620. * @name value
  26621. * @memberOf _
  26622. * @since 0.1.0
  26623. * @alias toJSON, valueOf
  26624. * @category Seq
  26625. * @returns {*} Returns the resolved unwrapped value.
  26626. * @example
  26627. *
  26628. * _([1, 2, 3]).value();
  26629. * // => [1, 2, 3]
  26630. */
  26631. function wrapperValue() {
  26632. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26633. }
  26634. /*------------------------------------------------------------------------*/
  26635. /**
  26636. * Creates an object composed of keys generated from the results of running
  26637. * each element of `collection` thru `iteratee`. The corresponding value of
  26638. * each key is the number of times the key was returned by `iteratee`. The
  26639. * iteratee is invoked with one argument: (value).
  26640. *
  26641. * @static
  26642. * @memberOf _
  26643. * @since 0.5.0
  26644. * @category Collection
  26645. * @param {Array|Object} collection The collection to iterate over.
  26646. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26647. * @returns {Object} Returns the composed aggregate object.
  26648. * @example
  26649. *
  26650. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26651. * // => { '4': 1, '6': 2 }
  26652. *
  26653. * // The `_.property` iteratee shorthand.
  26654. * _.countBy(['one', 'two', 'three'], 'length');
  26655. * // => { '3': 2, '5': 1 }
  26656. */
  26657. var countBy = createAggregator(function(result, value, key) {
  26658. if (hasOwnProperty.call(result, key)) {
  26659. ++result[key];
  26660. } else {
  26661. baseAssignValue(result, key, 1);
  26662. }
  26663. });
  26664. /**
  26665. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26666. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26667. * invoked with three arguments: (value, index|key, collection).
  26668. *
  26669. * **Note:** This method returns `true` for
  26670. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26671. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26672. * elements of empty collections.
  26673. *
  26674. * @static
  26675. * @memberOf _
  26676. * @since 0.1.0
  26677. * @category Collection
  26678. * @param {Array|Object} collection The collection to iterate over.
  26679. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26680. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26681. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26682. * else `false`.
  26683. * @example
  26684. *
  26685. * _.every([true, 1, null, 'yes'], Boolean);
  26686. * // => false
  26687. *
  26688. * var users = [
  26689. * { 'user': 'barney', 'age': 36, 'active': false },
  26690. * { 'user': 'fred', 'age': 40, 'active': false }
  26691. * ];
  26692. *
  26693. * // The `_.matches` iteratee shorthand.
  26694. * _.every(users, { 'user': 'barney', 'active': false });
  26695. * // => false
  26696. *
  26697. * // The `_.matchesProperty` iteratee shorthand.
  26698. * _.every(users, ['active', false]);
  26699. * // => true
  26700. *
  26701. * // The `_.property` iteratee shorthand.
  26702. * _.every(users, 'active');
  26703. * // => false
  26704. */
  26705. function every(collection, predicate, guard) {
  26706. var func = isArray(collection) ? arrayEvery : baseEvery;
  26707. if (guard && isIterateeCall(collection, predicate, guard)) {
  26708. predicate = undefined;
  26709. }
  26710. return func(collection, getIteratee(predicate, 3));
  26711. }
  26712. /**
  26713. * Iterates over elements of `collection`, returning an array of all elements
  26714. * `predicate` returns truthy for. The predicate is invoked with three
  26715. * arguments: (value, index|key, collection).
  26716. *
  26717. * **Note:** Unlike `_.remove`, this method returns a new array.
  26718. *
  26719. * @static
  26720. * @memberOf _
  26721. * @since 0.1.0
  26722. * @category Collection
  26723. * @param {Array|Object} collection The collection to iterate over.
  26724. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26725. * @returns {Array} Returns the new filtered array.
  26726. * @see _.reject
  26727. * @example
  26728. *
  26729. * var users = [
  26730. * { 'user': 'barney', 'age': 36, 'active': true },
  26731. * { 'user': 'fred', 'age': 40, 'active': false }
  26732. * ];
  26733. *
  26734. * _.filter(users, function(o) { return !o.active; });
  26735. * // => objects for ['fred']
  26736. *
  26737. * // The `_.matches` iteratee shorthand.
  26738. * _.filter(users, { 'age': 36, 'active': true });
  26739. * // => objects for ['barney']
  26740. *
  26741. * // The `_.matchesProperty` iteratee shorthand.
  26742. * _.filter(users, ['active', false]);
  26743. * // => objects for ['fred']
  26744. *
  26745. * // The `_.property` iteratee shorthand.
  26746. * _.filter(users, 'active');
  26747. * // => objects for ['barney']
  26748. */
  26749. function filter(collection, predicate) {
  26750. var func = isArray(collection) ? arrayFilter : baseFilter;
  26751. return func(collection, getIteratee(predicate, 3));
  26752. }
  26753. /**
  26754. * Iterates over elements of `collection`, returning the first element
  26755. * `predicate` returns truthy for. The predicate is invoked with three
  26756. * arguments: (value, index|key, collection).
  26757. *
  26758. * @static
  26759. * @memberOf _
  26760. * @since 0.1.0
  26761. * @category Collection
  26762. * @param {Array|Object} collection The collection to inspect.
  26763. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26764. * @param {number} [fromIndex=0] The index to search from.
  26765. * @returns {*} Returns the matched element, else `undefined`.
  26766. * @example
  26767. *
  26768. * var users = [
  26769. * { 'user': 'barney', 'age': 36, 'active': true },
  26770. * { 'user': 'fred', 'age': 40, 'active': false },
  26771. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26772. * ];
  26773. *
  26774. * _.find(users, function(o) { return o.age < 40; });
  26775. * // => object for 'barney'
  26776. *
  26777. * // The `_.matches` iteratee shorthand.
  26778. * _.find(users, { 'age': 1, 'active': true });
  26779. * // => object for 'pebbles'
  26780. *
  26781. * // The `_.matchesProperty` iteratee shorthand.
  26782. * _.find(users, ['active', false]);
  26783. * // => object for 'fred'
  26784. *
  26785. * // The `_.property` iteratee shorthand.
  26786. * _.find(users, 'active');
  26787. * // => object for 'barney'
  26788. */
  26789. var find = createFind(findIndex);
  26790. /**
  26791. * This method is like `_.find` except that it iterates over elements of
  26792. * `collection` from right to left.
  26793. *
  26794. * @static
  26795. * @memberOf _
  26796. * @since 2.0.0
  26797. * @category Collection
  26798. * @param {Array|Object} collection The collection to inspect.
  26799. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26800. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26801. * @returns {*} Returns the matched element, else `undefined`.
  26802. * @example
  26803. *
  26804. * _.findLast([1, 2, 3, 4], function(n) {
  26805. * return n % 2 == 1;
  26806. * });
  26807. * // => 3
  26808. */
  26809. var findLast = createFind(findLastIndex);
  26810. /**
  26811. * Creates a flattened array of values by running each element in `collection`
  26812. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26813. * with three arguments: (value, index|key, collection).
  26814. *
  26815. * @static
  26816. * @memberOf _
  26817. * @since 4.0.0
  26818. * @category Collection
  26819. * @param {Array|Object} collection The collection to iterate over.
  26820. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26821. * @returns {Array} Returns the new flattened array.
  26822. * @example
  26823. *
  26824. * function duplicate(n) {
  26825. * return [n, n];
  26826. * }
  26827. *
  26828. * _.flatMap([1, 2], duplicate);
  26829. * // => [1, 1, 2, 2]
  26830. */
  26831. function flatMap(collection, iteratee) {
  26832. return baseFlatten(map(collection, iteratee), 1);
  26833. }
  26834. /**
  26835. * This method is like `_.flatMap` except that it recursively flattens the
  26836. * mapped results.
  26837. *
  26838. * @static
  26839. * @memberOf _
  26840. * @since 4.7.0
  26841. * @category Collection
  26842. * @param {Array|Object} collection The collection to iterate over.
  26843. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26844. * @returns {Array} Returns the new flattened array.
  26845. * @example
  26846. *
  26847. * function duplicate(n) {
  26848. * return [[[n, n]]];
  26849. * }
  26850. *
  26851. * _.flatMapDeep([1, 2], duplicate);
  26852. * // => [1, 1, 2, 2]
  26853. */
  26854. function flatMapDeep(collection, iteratee) {
  26855. return baseFlatten(map(collection, iteratee), INFINITY);
  26856. }
  26857. /**
  26858. * This method is like `_.flatMap` except that it recursively flattens the
  26859. * mapped results up to `depth` times.
  26860. *
  26861. * @static
  26862. * @memberOf _
  26863. * @since 4.7.0
  26864. * @category Collection
  26865. * @param {Array|Object} collection The collection to iterate over.
  26866. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26867. * @param {number} [depth=1] The maximum recursion depth.
  26868. * @returns {Array} Returns the new flattened array.
  26869. * @example
  26870. *
  26871. * function duplicate(n) {
  26872. * return [[[n, n]]];
  26873. * }
  26874. *
  26875. * _.flatMapDepth([1, 2], duplicate, 2);
  26876. * // => [[1, 1], [2, 2]]
  26877. */
  26878. function flatMapDepth(collection, iteratee, depth) {
  26879. depth = depth === undefined ? 1 : toInteger(depth);
  26880. return baseFlatten(map(collection, iteratee), depth);
  26881. }
  26882. /**
  26883. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26884. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26885. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26886. *
  26887. * **Note:** As with other "Collections" methods, objects with a "length"
  26888. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26889. * or `_.forOwn` for object iteration.
  26890. *
  26891. * @static
  26892. * @memberOf _
  26893. * @since 0.1.0
  26894. * @alias each
  26895. * @category Collection
  26896. * @param {Array|Object} collection The collection to iterate over.
  26897. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26898. * @returns {Array|Object} Returns `collection`.
  26899. * @see _.forEachRight
  26900. * @example
  26901. *
  26902. * _.forEach([1, 2], function(value) {
  26903. * console.log(value);
  26904. * });
  26905. * // => Logs `1` then `2`.
  26906. *
  26907. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26908. * console.log(key);
  26909. * });
  26910. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26911. */
  26912. function forEach(collection, iteratee) {
  26913. var func = isArray(collection) ? arrayEach : baseEach;
  26914. return func(collection, getIteratee(iteratee, 3));
  26915. }
  26916. /**
  26917. * This method is like `_.forEach` except that it iterates over elements of
  26918. * `collection` from right to left.
  26919. *
  26920. * @static
  26921. * @memberOf _
  26922. * @since 2.0.0
  26923. * @alias eachRight
  26924. * @category Collection
  26925. * @param {Array|Object} collection The collection to iterate over.
  26926. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26927. * @returns {Array|Object} Returns `collection`.
  26928. * @see _.forEach
  26929. * @example
  26930. *
  26931. * _.forEachRight([1, 2], function(value) {
  26932. * console.log(value);
  26933. * });
  26934. * // => Logs `2` then `1`.
  26935. */
  26936. function forEachRight(collection, iteratee) {
  26937. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26938. return func(collection, getIteratee(iteratee, 3));
  26939. }
  26940. /**
  26941. * Creates an object composed of keys generated from the results of running
  26942. * each element of `collection` thru `iteratee`. The order of grouped values
  26943. * is determined by the order they occur in `collection`. The corresponding
  26944. * value of each key is an array of elements responsible for generating the
  26945. * key. The iteratee is invoked with one argument: (value).
  26946. *
  26947. * @static
  26948. * @memberOf _
  26949. * @since 0.1.0
  26950. * @category Collection
  26951. * @param {Array|Object} collection The collection to iterate over.
  26952. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26953. * @returns {Object} Returns the composed aggregate object.
  26954. * @example
  26955. *
  26956. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26957. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26958. *
  26959. * // The `_.property` iteratee shorthand.
  26960. * _.groupBy(['one', 'two', 'three'], 'length');
  26961. * // => { '3': ['one', 'two'], '5': ['three'] }
  26962. */
  26963. var groupBy = createAggregator(function(result, value, key) {
  26964. if (hasOwnProperty.call(result, key)) {
  26965. result[key].push(value);
  26966. } else {
  26967. baseAssignValue(result, key, [value]);
  26968. }
  26969. });
  26970. /**
  26971. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26972. * checked for a substring of `value`, otherwise
  26973. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26974. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26975. * the offset from the end of `collection`.
  26976. *
  26977. * @static
  26978. * @memberOf _
  26979. * @since 0.1.0
  26980. * @category Collection
  26981. * @param {Array|Object|string} collection The collection to inspect.
  26982. * @param {*} value The value to search for.
  26983. * @param {number} [fromIndex=0] The index to search from.
  26984. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26985. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26986. * @example
  26987. *
  26988. * _.includes([1, 2, 3], 1);
  26989. * // => true
  26990. *
  26991. * _.includes([1, 2, 3], 1, 2);
  26992. * // => false
  26993. *
  26994. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26995. * // => true
  26996. *
  26997. * _.includes('abcd', 'bc');
  26998. * // => true
  26999. */
  27000. function includes(collection, value, fromIndex, guard) {
  27001. collection = isArrayLike(collection) ? collection : values(collection);
  27002. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27003. var length = collection.length;
  27004. if (fromIndex < 0) {
  27005. fromIndex = nativeMax(length + fromIndex, 0);
  27006. }
  27007. return isString(collection)
  27008. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27009. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27010. }
  27011. /**
  27012. * Invokes the method at `path` of each element in `collection`, returning
  27013. * an array of the results of each invoked method. Any additional arguments
  27014. * are provided to each invoked method. If `path` is a function, it's invoked
  27015. * for, and `this` bound to, each element in `collection`.
  27016. *
  27017. * @static
  27018. * @memberOf _
  27019. * @since 4.0.0
  27020. * @category Collection
  27021. * @param {Array|Object} collection The collection to iterate over.
  27022. * @param {Array|Function|string} path The path of the method to invoke or
  27023. * the function invoked per iteration.
  27024. * @param {...*} [args] The arguments to invoke each method with.
  27025. * @returns {Array} Returns the array of results.
  27026. * @example
  27027. *
  27028. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27029. * // => [[1, 5, 7], [1, 2, 3]]
  27030. *
  27031. * _.invokeMap([123, 456], String.prototype.split, '');
  27032. * // => [['1', '2', '3'], ['4', '5', '6']]
  27033. */
  27034. var invokeMap = baseRest(function(collection, path, args) {
  27035. var index = -1,
  27036. isFunc = typeof path == 'function',
  27037. result = isArrayLike(collection) ? Array(collection.length) : [];
  27038. baseEach(collection, function(value) {
  27039. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27040. });
  27041. return result;
  27042. });
  27043. /**
  27044. * Creates an object composed of keys generated from the results of running
  27045. * each element of `collection` thru `iteratee`. The corresponding value of
  27046. * each key is the last element responsible for generating the key. The
  27047. * iteratee is invoked with one argument: (value).
  27048. *
  27049. * @static
  27050. * @memberOf _
  27051. * @since 4.0.0
  27052. * @category Collection
  27053. * @param {Array|Object} collection The collection to iterate over.
  27054. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27055. * @returns {Object} Returns the composed aggregate object.
  27056. * @example
  27057. *
  27058. * var array = [
  27059. * { 'dir': 'left', 'code': 97 },
  27060. * { 'dir': 'right', 'code': 100 }
  27061. * ];
  27062. *
  27063. * _.keyBy(array, function(o) {
  27064. * return String.fromCharCode(o.code);
  27065. * });
  27066. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27067. *
  27068. * _.keyBy(array, 'dir');
  27069. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27070. */
  27071. var keyBy = createAggregator(function(result, value, key) {
  27072. baseAssignValue(result, key, value);
  27073. });
  27074. /**
  27075. * Creates an array of values by running each element in `collection` thru
  27076. * `iteratee`. The iteratee is invoked with three arguments:
  27077. * (value, index|key, collection).
  27078. *
  27079. * Many lodash methods are guarded to work as iteratees for methods like
  27080. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27081. *
  27082. * The guarded methods are:
  27083. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27084. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27085. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27086. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27087. *
  27088. * @static
  27089. * @memberOf _
  27090. * @since 0.1.0
  27091. * @category Collection
  27092. * @param {Array|Object} collection The collection to iterate over.
  27093. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27094. * @returns {Array} Returns the new mapped array.
  27095. * @example
  27096. *
  27097. * function square(n) {
  27098. * return n * n;
  27099. * }
  27100. *
  27101. * _.map([4, 8], square);
  27102. * // => [16, 64]
  27103. *
  27104. * _.map({ 'a': 4, 'b': 8 }, square);
  27105. * // => [16, 64] (iteration order is not guaranteed)
  27106. *
  27107. * var users = [
  27108. * { 'user': 'barney' },
  27109. * { 'user': 'fred' }
  27110. * ];
  27111. *
  27112. * // The `_.property` iteratee shorthand.
  27113. * _.map(users, 'user');
  27114. * // => ['barney', 'fred']
  27115. */
  27116. function map(collection, iteratee) {
  27117. var func = isArray(collection) ? arrayMap : baseMap;
  27118. return func(collection, getIteratee(iteratee, 3));
  27119. }
  27120. /**
  27121. * This method is like `_.sortBy` except that it allows specifying the sort
  27122. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27123. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27124. * descending or "asc" for ascending sort order of corresponding values.
  27125. *
  27126. * @static
  27127. * @memberOf _
  27128. * @since 4.0.0
  27129. * @category Collection
  27130. * @param {Array|Object} collection The collection to iterate over.
  27131. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27132. * The iteratees to sort by.
  27133. * @param {string[]} [orders] The sort orders of `iteratees`.
  27134. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27135. * @returns {Array} Returns the new sorted array.
  27136. * @example
  27137. *
  27138. * var users = [
  27139. * { 'user': 'fred', 'age': 48 },
  27140. * { 'user': 'barney', 'age': 34 },
  27141. * { 'user': 'fred', 'age': 40 },
  27142. * { 'user': 'barney', 'age': 36 }
  27143. * ];
  27144. *
  27145. * // Sort by `user` in ascending order and by `age` in descending order.
  27146. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27147. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27148. */
  27149. function orderBy(collection, iteratees, orders, guard) {
  27150. if (collection == null) {
  27151. return [];
  27152. }
  27153. if (!isArray(iteratees)) {
  27154. iteratees = iteratees == null ? [] : [iteratees];
  27155. }
  27156. orders = guard ? undefined : orders;
  27157. if (!isArray(orders)) {
  27158. orders = orders == null ? [] : [orders];
  27159. }
  27160. return baseOrderBy(collection, iteratees, orders);
  27161. }
  27162. /**
  27163. * Creates an array of elements split into two groups, the first of which
  27164. * contains elements `predicate` returns truthy for, the second of which
  27165. * contains elements `predicate` returns falsey for. The predicate is
  27166. * invoked with one argument: (value).
  27167. *
  27168. * @static
  27169. * @memberOf _
  27170. * @since 3.0.0
  27171. * @category Collection
  27172. * @param {Array|Object} collection The collection to iterate over.
  27173. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27174. * @returns {Array} Returns the array of grouped elements.
  27175. * @example
  27176. *
  27177. * var users = [
  27178. * { 'user': 'barney', 'age': 36, 'active': false },
  27179. * { 'user': 'fred', 'age': 40, 'active': true },
  27180. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27181. * ];
  27182. *
  27183. * _.partition(users, function(o) { return o.active; });
  27184. * // => objects for [['fred'], ['barney', 'pebbles']]
  27185. *
  27186. * // The `_.matches` iteratee shorthand.
  27187. * _.partition(users, { 'age': 1, 'active': false });
  27188. * // => objects for [['pebbles'], ['barney', 'fred']]
  27189. *
  27190. * // The `_.matchesProperty` iteratee shorthand.
  27191. * _.partition(users, ['active', false]);
  27192. * // => objects for [['barney', 'pebbles'], ['fred']]
  27193. *
  27194. * // The `_.property` iteratee shorthand.
  27195. * _.partition(users, 'active');
  27196. * // => objects for [['fred'], ['barney', 'pebbles']]
  27197. */
  27198. var partition = createAggregator(function(result, value, key) {
  27199. result[key ? 0 : 1].push(value);
  27200. }, function() { return [[], []]; });
  27201. /**
  27202. * Reduces `collection` to a value which is the accumulated result of running
  27203. * each element in `collection` thru `iteratee`, where each successive
  27204. * invocation is supplied the return value of the previous. If `accumulator`
  27205. * is not given, the first element of `collection` is used as the initial
  27206. * value. The iteratee is invoked with four arguments:
  27207. * (accumulator, value, index|key, collection).
  27208. *
  27209. * Many lodash methods are guarded to work as iteratees for methods like
  27210. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27211. *
  27212. * The guarded methods are:
  27213. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27214. * and `sortBy`
  27215. *
  27216. * @static
  27217. * @memberOf _
  27218. * @since 0.1.0
  27219. * @category Collection
  27220. * @param {Array|Object} collection The collection to iterate over.
  27221. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27222. * @param {*} [accumulator] The initial value.
  27223. * @returns {*} Returns the accumulated value.
  27224. * @see _.reduceRight
  27225. * @example
  27226. *
  27227. * _.reduce([1, 2], function(sum, n) {
  27228. * return sum + n;
  27229. * }, 0);
  27230. * // => 3
  27231. *
  27232. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27233. * (result[value] || (result[value] = [])).push(key);
  27234. * return result;
  27235. * }, {});
  27236. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27237. */
  27238. function reduce(collection, iteratee, accumulator) {
  27239. var func = isArray(collection) ? arrayReduce : baseReduce,
  27240. initAccum = arguments.length < 3;
  27241. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27242. }
  27243. /**
  27244. * This method is like `_.reduce` except that it iterates over elements of
  27245. * `collection` from right to left.
  27246. *
  27247. * @static
  27248. * @memberOf _
  27249. * @since 0.1.0
  27250. * @category Collection
  27251. * @param {Array|Object} collection The collection to iterate over.
  27252. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27253. * @param {*} [accumulator] The initial value.
  27254. * @returns {*} Returns the accumulated value.
  27255. * @see _.reduce
  27256. * @example
  27257. *
  27258. * var array = [[0, 1], [2, 3], [4, 5]];
  27259. *
  27260. * _.reduceRight(array, function(flattened, other) {
  27261. * return flattened.concat(other);
  27262. * }, []);
  27263. * // => [4, 5, 2, 3, 0, 1]
  27264. */
  27265. function reduceRight(collection, iteratee, accumulator) {
  27266. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27267. initAccum = arguments.length < 3;
  27268. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27269. }
  27270. /**
  27271. * The opposite of `_.filter`; this method returns the elements of `collection`
  27272. * that `predicate` does **not** return truthy for.
  27273. *
  27274. * @static
  27275. * @memberOf _
  27276. * @since 0.1.0
  27277. * @category Collection
  27278. * @param {Array|Object} collection The collection to iterate over.
  27279. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27280. * @returns {Array} Returns the new filtered array.
  27281. * @see _.filter
  27282. * @example
  27283. *
  27284. * var users = [
  27285. * { 'user': 'barney', 'age': 36, 'active': false },
  27286. * { 'user': 'fred', 'age': 40, 'active': true }
  27287. * ];
  27288. *
  27289. * _.reject(users, function(o) { return !o.active; });
  27290. * // => objects for ['fred']
  27291. *
  27292. * // The `_.matches` iteratee shorthand.
  27293. * _.reject(users, { 'age': 40, 'active': true });
  27294. * // => objects for ['barney']
  27295. *
  27296. * // The `_.matchesProperty` iteratee shorthand.
  27297. * _.reject(users, ['active', false]);
  27298. * // => objects for ['fred']
  27299. *
  27300. * // The `_.property` iteratee shorthand.
  27301. * _.reject(users, 'active');
  27302. * // => objects for ['barney']
  27303. */
  27304. function reject(collection, predicate) {
  27305. var func = isArray(collection) ? arrayFilter : baseFilter;
  27306. return func(collection, negate(getIteratee(predicate, 3)));
  27307. }
  27308. /**
  27309. * Gets a random element from `collection`.
  27310. *
  27311. * @static
  27312. * @memberOf _
  27313. * @since 2.0.0
  27314. * @category Collection
  27315. * @param {Array|Object} collection The collection to sample.
  27316. * @returns {*} Returns the random element.
  27317. * @example
  27318. *
  27319. * _.sample([1, 2, 3, 4]);
  27320. * // => 2
  27321. */
  27322. function sample(collection) {
  27323. var func = isArray(collection) ? arraySample : baseSample;
  27324. return func(collection);
  27325. }
  27326. /**
  27327. * Gets `n` random elements at unique keys from `collection` up to the
  27328. * size of `collection`.
  27329. *
  27330. * @static
  27331. * @memberOf _
  27332. * @since 4.0.0
  27333. * @category Collection
  27334. * @param {Array|Object} collection The collection to sample.
  27335. * @param {number} [n=1] The number of elements to sample.
  27336. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27337. * @returns {Array} Returns the random elements.
  27338. * @example
  27339. *
  27340. * _.sampleSize([1, 2, 3], 2);
  27341. * // => [3, 1]
  27342. *
  27343. * _.sampleSize([1, 2, 3], 4);
  27344. * // => [2, 3, 1]
  27345. */
  27346. function sampleSize(collection, n, guard) {
  27347. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27348. n = 1;
  27349. } else {
  27350. n = toInteger(n);
  27351. }
  27352. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27353. return func(collection, n);
  27354. }
  27355. /**
  27356. * Creates an array of shuffled values, using a version of the
  27357. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27358. *
  27359. * @static
  27360. * @memberOf _
  27361. * @since 0.1.0
  27362. * @category Collection
  27363. * @param {Array|Object} collection The collection to shuffle.
  27364. * @returns {Array} Returns the new shuffled array.
  27365. * @example
  27366. *
  27367. * _.shuffle([1, 2, 3, 4]);
  27368. * // => [4, 1, 3, 2]
  27369. */
  27370. function shuffle(collection) {
  27371. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27372. return func(collection);
  27373. }
  27374. /**
  27375. * Gets the size of `collection` by returning its length for array-like
  27376. * values or the number of own enumerable string keyed properties for objects.
  27377. *
  27378. * @static
  27379. * @memberOf _
  27380. * @since 0.1.0
  27381. * @category Collection
  27382. * @param {Array|Object|string} collection The collection to inspect.
  27383. * @returns {number} Returns the collection size.
  27384. * @example
  27385. *
  27386. * _.size([1, 2, 3]);
  27387. * // => 3
  27388. *
  27389. * _.size({ 'a': 1, 'b': 2 });
  27390. * // => 2
  27391. *
  27392. * _.size('pebbles');
  27393. * // => 7
  27394. */
  27395. function size(collection) {
  27396. if (collection == null) {
  27397. return 0;
  27398. }
  27399. if (isArrayLike(collection)) {
  27400. return isString(collection) ? stringSize(collection) : collection.length;
  27401. }
  27402. var tag = getTag(collection);
  27403. if (tag == mapTag || tag == setTag) {
  27404. return collection.size;
  27405. }
  27406. return baseKeys(collection).length;
  27407. }
  27408. /**
  27409. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27410. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27411. * invoked with three arguments: (value, index|key, collection).
  27412. *
  27413. * @static
  27414. * @memberOf _
  27415. * @since 0.1.0
  27416. * @category Collection
  27417. * @param {Array|Object} collection The collection to iterate over.
  27418. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27419. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27420. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27421. * else `false`.
  27422. * @example
  27423. *
  27424. * _.some([null, 0, 'yes', false], Boolean);
  27425. * // => true
  27426. *
  27427. * var users = [
  27428. * { 'user': 'barney', 'active': true },
  27429. * { 'user': 'fred', 'active': false }
  27430. * ];
  27431. *
  27432. * // The `_.matches` iteratee shorthand.
  27433. * _.some(users, { 'user': 'barney', 'active': false });
  27434. * // => false
  27435. *
  27436. * // The `_.matchesProperty` iteratee shorthand.
  27437. * _.some(users, ['active', false]);
  27438. * // => true
  27439. *
  27440. * // The `_.property` iteratee shorthand.
  27441. * _.some(users, 'active');
  27442. * // => true
  27443. */
  27444. function some(collection, predicate, guard) {
  27445. var func = isArray(collection) ? arraySome : baseSome;
  27446. if (guard && isIterateeCall(collection, predicate, guard)) {
  27447. predicate = undefined;
  27448. }
  27449. return func(collection, getIteratee(predicate, 3));
  27450. }
  27451. /**
  27452. * Creates an array of elements, sorted in ascending order by the results of
  27453. * running each element in a collection thru each iteratee. This method
  27454. * performs a stable sort, that is, it preserves the original sort order of
  27455. * equal elements. The iteratees are invoked with one argument: (value).
  27456. *
  27457. * @static
  27458. * @memberOf _
  27459. * @since 0.1.0
  27460. * @category Collection
  27461. * @param {Array|Object} collection The collection to iterate over.
  27462. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27463. * The iteratees to sort by.
  27464. * @returns {Array} Returns the new sorted array.
  27465. * @example
  27466. *
  27467. * var users = [
  27468. * { 'user': 'fred', 'age': 48 },
  27469. * { 'user': 'barney', 'age': 36 },
  27470. * { 'user': 'fred', 'age': 40 },
  27471. * { 'user': 'barney', 'age': 34 }
  27472. * ];
  27473. *
  27474. * _.sortBy(users, [function(o) { return o.user; }]);
  27475. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27476. *
  27477. * _.sortBy(users, ['user', 'age']);
  27478. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27479. */
  27480. var sortBy = baseRest(function(collection, iteratees) {
  27481. if (collection == null) {
  27482. return [];
  27483. }
  27484. var length = iteratees.length;
  27485. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27486. iteratees = [];
  27487. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27488. iteratees = [iteratees[0]];
  27489. }
  27490. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27491. });
  27492. /*------------------------------------------------------------------------*/
  27493. /**
  27494. * Gets the timestamp of the number of milliseconds that have elapsed since
  27495. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27496. *
  27497. * @static
  27498. * @memberOf _
  27499. * @since 2.4.0
  27500. * @category Date
  27501. * @returns {number} Returns the timestamp.
  27502. * @example
  27503. *
  27504. * _.defer(function(stamp) {
  27505. * console.log(_.now() - stamp);
  27506. * }, _.now());
  27507. * // => Logs the number of milliseconds it took for the deferred invocation.
  27508. */
  27509. var now = ctxNow || function() {
  27510. return root.Date.now();
  27511. };
  27512. /*------------------------------------------------------------------------*/
  27513. /**
  27514. * The opposite of `_.before`; this method creates a function that invokes
  27515. * `func` once it's called `n` or more times.
  27516. *
  27517. * @static
  27518. * @memberOf _
  27519. * @since 0.1.0
  27520. * @category Function
  27521. * @param {number} n The number of calls before `func` is invoked.
  27522. * @param {Function} func The function to restrict.
  27523. * @returns {Function} Returns the new restricted function.
  27524. * @example
  27525. *
  27526. * var saves = ['profile', 'settings'];
  27527. *
  27528. * var done = _.after(saves.length, function() {
  27529. * console.log('done saving!');
  27530. * });
  27531. *
  27532. * _.forEach(saves, function(type) {
  27533. * asyncSave({ 'type': type, 'complete': done });
  27534. * });
  27535. * // => Logs 'done saving!' after the two async saves have completed.
  27536. */
  27537. function after(n, func) {
  27538. if (typeof func != 'function') {
  27539. throw new TypeError(FUNC_ERROR_TEXT);
  27540. }
  27541. n = toInteger(n);
  27542. return function() {
  27543. if (--n < 1) {
  27544. return func.apply(this, arguments);
  27545. }
  27546. };
  27547. }
  27548. /**
  27549. * Creates a function that invokes `func`, with up to `n` arguments,
  27550. * ignoring any additional arguments.
  27551. *
  27552. * @static
  27553. * @memberOf _
  27554. * @since 3.0.0
  27555. * @category Function
  27556. * @param {Function} func The function to cap arguments for.
  27557. * @param {number} [n=func.length] The arity cap.
  27558. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27559. * @returns {Function} Returns the new capped function.
  27560. * @example
  27561. *
  27562. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27563. * // => [6, 8, 10]
  27564. */
  27565. function ary(func, n, guard) {
  27566. n = guard ? undefined : n;
  27567. n = (func && n == null) ? func.length : n;
  27568. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27569. }
  27570. /**
  27571. * Creates a function that invokes `func`, with the `this` binding and arguments
  27572. * of the created function, while it's called less than `n` times. Subsequent
  27573. * calls to the created function return the result of the last `func` invocation.
  27574. *
  27575. * @static
  27576. * @memberOf _
  27577. * @since 3.0.0
  27578. * @category Function
  27579. * @param {number} n The number of calls at which `func` is no longer invoked.
  27580. * @param {Function} func The function to restrict.
  27581. * @returns {Function} Returns the new restricted function.
  27582. * @example
  27583. *
  27584. * jQuery(element).on('click', _.before(5, addContactToList));
  27585. * // => Allows adding up to 4 contacts to the list.
  27586. */
  27587. function before(n, func) {
  27588. var result;
  27589. if (typeof func != 'function') {
  27590. throw new TypeError(FUNC_ERROR_TEXT);
  27591. }
  27592. n = toInteger(n);
  27593. return function() {
  27594. if (--n > 0) {
  27595. result = func.apply(this, arguments);
  27596. }
  27597. if (n <= 1) {
  27598. func = undefined;
  27599. }
  27600. return result;
  27601. };
  27602. }
  27603. /**
  27604. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27605. * and `partials` prepended to the arguments it receives.
  27606. *
  27607. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27608. * may be used as a placeholder for partially applied arguments.
  27609. *
  27610. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27611. * property of bound functions.
  27612. *
  27613. * @static
  27614. * @memberOf _
  27615. * @since 0.1.0
  27616. * @category Function
  27617. * @param {Function} func The function to bind.
  27618. * @param {*} thisArg The `this` binding of `func`.
  27619. * @param {...*} [partials] The arguments to be partially applied.
  27620. * @returns {Function} Returns the new bound function.
  27621. * @example
  27622. *
  27623. * function greet(greeting, punctuation) {
  27624. * return greeting + ' ' + this.user + punctuation;
  27625. * }
  27626. *
  27627. * var object = { 'user': 'fred' };
  27628. *
  27629. * var bound = _.bind(greet, object, 'hi');
  27630. * bound('!');
  27631. * // => 'hi fred!'
  27632. *
  27633. * // Bound with placeholders.
  27634. * var bound = _.bind(greet, object, _, '!');
  27635. * bound('hi');
  27636. * // => 'hi fred!'
  27637. */
  27638. var bind = baseRest(function(func, thisArg, partials) {
  27639. var bitmask = WRAP_BIND_FLAG;
  27640. if (partials.length) {
  27641. var holders = replaceHolders(partials, getHolder(bind));
  27642. bitmask |= WRAP_PARTIAL_FLAG;
  27643. }
  27644. return createWrap(func, bitmask, thisArg, partials, holders);
  27645. });
  27646. /**
  27647. * Creates a function that invokes the method at `object[key]` with `partials`
  27648. * prepended to the arguments it receives.
  27649. *
  27650. * This method differs from `_.bind` by allowing bound functions to reference
  27651. * methods that may be redefined or don't yet exist. See
  27652. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27653. * for more details.
  27654. *
  27655. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27656. * builds, may be used as a placeholder for partially applied arguments.
  27657. *
  27658. * @static
  27659. * @memberOf _
  27660. * @since 0.10.0
  27661. * @category Function
  27662. * @param {Object} object The object to invoke the method on.
  27663. * @param {string} key The key of the method.
  27664. * @param {...*} [partials] The arguments to be partially applied.
  27665. * @returns {Function} Returns the new bound function.
  27666. * @example
  27667. *
  27668. * var object = {
  27669. * 'user': 'fred',
  27670. * 'greet': function(greeting, punctuation) {
  27671. * return greeting + ' ' + this.user + punctuation;
  27672. * }
  27673. * };
  27674. *
  27675. * var bound = _.bindKey(object, 'greet', 'hi');
  27676. * bound('!');
  27677. * // => 'hi fred!'
  27678. *
  27679. * object.greet = function(greeting, punctuation) {
  27680. * return greeting + 'ya ' + this.user + punctuation;
  27681. * };
  27682. *
  27683. * bound('!');
  27684. * // => 'hiya fred!'
  27685. *
  27686. * // Bound with placeholders.
  27687. * var bound = _.bindKey(object, 'greet', _, '!');
  27688. * bound('hi');
  27689. * // => 'hiya fred!'
  27690. */
  27691. var bindKey = baseRest(function(object, key, partials) {
  27692. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27693. if (partials.length) {
  27694. var holders = replaceHolders(partials, getHolder(bindKey));
  27695. bitmask |= WRAP_PARTIAL_FLAG;
  27696. }
  27697. return createWrap(key, bitmask, object, partials, holders);
  27698. });
  27699. /**
  27700. * Creates a function that accepts arguments of `func` and either invokes
  27701. * `func` returning its result, if at least `arity` number of arguments have
  27702. * been provided, or returns a function that accepts the remaining `func`
  27703. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27704. * is not sufficient.
  27705. *
  27706. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27707. * may be used as a placeholder for provided arguments.
  27708. *
  27709. * **Note:** This method doesn't set the "length" property of curried functions.
  27710. *
  27711. * @static
  27712. * @memberOf _
  27713. * @since 2.0.0
  27714. * @category Function
  27715. * @param {Function} func The function to curry.
  27716. * @param {number} [arity=func.length] The arity of `func`.
  27717. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27718. * @returns {Function} Returns the new curried function.
  27719. * @example
  27720. *
  27721. * var abc = function(a, b, c) {
  27722. * return [a, b, c];
  27723. * };
  27724. *
  27725. * var curried = _.curry(abc);
  27726. *
  27727. * curried(1)(2)(3);
  27728. * // => [1, 2, 3]
  27729. *
  27730. * curried(1, 2)(3);
  27731. * // => [1, 2, 3]
  27732. *
  27733. * curried(1, 2, 3);
  27734. * // => [1, 2, 3]
  27735. *
  27736. * // Curried with placeholders.
  27737. * curried(1)(_, 3)(2);
  27738. * // => [1, 2, 3]
  27739. */
  27740. function curry(func, arity, guard) {
  27741. arity = guard ? undefined : arity;
  27742. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27743. result.placeholder = curry.placeholder;
  27744. return result;
  27745. }
  27746. /**
  27747. * This method is like `_.curry` except that arguments are applied to `func`
  27748. * in the manner of `_.partialRight` instead of `_.partial`.
  27749. *
  27750. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27751. * builds, may be used as a placeholder for provided arguments.
  27752. *
  27753. * **Note:** This method doesn't set the "length" property of curried functions.
  27754. *
  27755. * @static
  27756. * @memberOf _
  27757. * @since 3.0.0
  27758. * @category Function
  27759. * @param {Function} func The function to curry.
  27760. * @param {number} [arity=func.length] The arity of `func`.
  27761. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27762. * @returns {Function} Returns the new curried function.
  27763. * @example
  27764. *
  27765. * var abc = function(a, b, c) {
  27766. * return [a, b, c];
  27767. * };
  27768. *
  27769. * var curried = _.curryRight(abc);
  27770. *
  27771. * curried(3)(2)(1);
  27772. * // => [1, 2, 3]
  27773. *
  27774. * curried(2, 3)(1);
  27775. * // => [1, 2, 3]
  27776. *
  27777. * curried(1, 2, 3);
  27778. * // => [1, 2, 3]
  27779. *
  27780. * // Curried with placeholders.
  27781. * curried(3)(1, _)(2);
  27782. * // => [1, 2, 3]
  27783. */
  27784. function curryRight(func, arity, guard) {
  27785. arity = guard ? undefined : arity;
  27786. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27787. result.placeholder = curryRight.placeholder;
  27788. return result;
  27789. }
  27790. /**
  27791. * Creates a debounced function that delays invoking `func` until after `wait`
  27792. * milliseconds have elapsed since the last time the debounced function was
  27793. * invoked. The debounced function comes with a `cancel` method to cancel
  27794. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27795. * Provide `options` to indicate whether `func` should be invoked on the
  27796. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27797. * with the last arguments provided to the debounced function. Subsequent
  27798. * calls to the debounced function return the result of the last `func`
  27799. * invocation.
  27800. *
  27801. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27802. * invoked on the trailing edge of the timeout only if the debounced function
  27803. * is invoked more than once during the `wait` timeout.
  27804. *
  27805. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27806. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27807. *
  27808. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27809. * for details over the differences between `_.debounce` and `_.throttle`.
  27810. *
  27811. * @static
  27812. * @memberOf _
  27813. * @since 0.1.0
  27814. * @category Function
  27815. * @param {Function} func The function to debounce.
  27816. * @param {number} [wait=0] The number of milliseconds to delay.
  27817. * @param {Object} [options={}] The options object.
  27818. * @param {boolean} [options.leading=false]
  27819. * Specify invoking on the leading edge of the timeout.
  27820. * @param {number} [options.maxWait]
  27821. * The maximum time `func` is allowed to be delayed before it's invoked.
  27822. * @param {boolean} [options.trailing=true]
  27823. * Specify invoking on the trailing edge of the timeout.
  27824. * @returns {Function} Returns the new debounced function.
  27825. * @example
  27826. *
  27827. * // Avoid costly calculations while the window size is in flux.
  27828. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27829. *
  27830. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27831. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27832. * 'leading': true,
  27833. * 'trailing': false
  27834. * }));
  27835. *
  27836. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27837. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27838. * var source = new EventSource('/stream');
  27839. * jQuery(source).on('message', debounced);
  27840. *
  27841. * // Cancel the trailing debounced invocation.
  27842. * jQuery(window).on('popstate', debounced.cancel);
  27843. */
  27844. function debounce(func, wait, options) {
  27845. var lastArgs,
  27846. lastThis,
  27847. maxWait,
  27848. result,
  27849. timerId,
  27850. lastCallTime,
  27851. lastInvokeTime = 0,
  27852. leading = false,
  27853. maxing = false,
  27854. trailing = true;
  27855. if (typeof func != 'function') {
  27856. throw new TypeError(FUNC_ERROR_TEXT);
  27857. }
  27858. wait = toNumber(wait) || 0;
  27859. if (isObject(options)) {
  27860. leading = !!options.leading;
  27861. maxing = 'maxWait' in options;
  27862. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27863. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27864. }
  27865. function invokeFunc(time) {
  27866. var args = lastArgs,
  27867. thisArg = lastThis;
  27868. lastArgs = lastThis = undefined;
  27869. lastInvokeTime = time;
  27870. result = func.apply(thisArg, args);
  27871. return result;
  27872. }
  27873. function leadingEdge(time) {
  27874. // Reset any `maxWait` timer.
  27875. lastInvokeTime = time;
  27876. // Start the timer for the trailing edge.
  27877. timerId = setTimeout(timerExpired, wait);
  27878. // Invoke the leading edge.
  27879. return leading ? invokeFunc(time) : result;
  27880. }
  27881. function remainingWait(time) {
  27882. var timeSinceLastCall = time - lastCallTime,
  27883. timeSinceLastInvoke = time - lastInvokeTime,
  27884. timeWaiting = wait - timeSinceLastCall;
  27885. return maxing
  27886. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27887. : timeWaiting;
  27888. }
  27889. function shouldInvoke(time) {
  27890. var timeSinceLastCall = time - lastCallTime,
  27891. timeSinceLastInvoke = time - lastInvokeTime;
  27892. // Either this is the first call, activity has stopped and we're at the
  27893. // trailing edge, the system time has gone backwards and we're treating
  27894. // it as the trailing edge, or we've hit the `maxWait` limit.
  27895. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27896. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27897. }
  27898. function timerExpired() {
  27899. var time = now();
  27900. if (shouldInvoke(time)) {
  27901. return trailingEdge(time);
  27902. }
  27903. // Restart the timer.
  27904. timerId = setTimeout(timerExpired, remainingWait(time));
  27905. }
  27906. function trailingEdge(time) {
  27907. timerId = undefined;
  27908. // Only invoke if we have `lastArgs` which means `func` has been
  27909. // debounced at least once.
  27910. if (trailing && lastArgs) {
  27911. return invokeFunc(time);
  27912. }
  27913. lastArgs = lastThis = undefined;
  27914. return result;
  27915. }
  27916. function cancel() {
  27917. if (timerId !== undefined) {
  27918. clearTimeout(timerId);
  27919. }
  27920. lastInvokeTime = 0;
  27921. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27922. }
  27923. function flush() {
  27924. return timerId === undefined ? result : trailingEdge(now());
  27925. }
  27926. function debounced() {
  27927. var time = now(),
  27928. isInvoking = shouldInvoke(time);
  27929. lastArgs = arguments;
  27930. lastThis = this;
  27931. lastCallTime = time;
  27932. if (isInvoking) {
  27933. if (timerId === undefined) {
  27934. return leadingEdge(lastCallTime);
  27935. }
  27936. if (maxing) {
  27937. // Handle invocations in a tight loop.
  27938. clearTimeout(timerId);
  27939. timerId = setTimeout(timerExpired, wait);
  27940. return invokeFunc(lastCallTime);
  27941. }
  27942. }
  27943. if (timerId === undefined) {
  27944. timerId = setTimeout(timerExpired, wait);
  27945. }
  27946. return result;
  27947. }
  27948. debounced.cancel = cancel;
  27949. debounced.flush = flush;
  27950. return debounced;
  27951. }
  27952. /**
  27953. * Defers invoking the `func` until the current call stack has cleared. Any
  27954. * additional arguments are provided to `func` when it's invoked.
  27955. *
  27956. * @static
  27957. * @memberOf _
  27958. * @since 0.1.0
  27959. * @category Function
  27960. * @param {Function} func The function to defer.
  27961. * @param {...*} [args] The arguments to invoke `func` with.
  27962. * @returns {number} Returns the timer id.
  27963. * @example
  27964. *
  27965. * _.defer(function(text) {
  27966. * console.log(text);
  27967. * }, 'deferred');
  27968. * // => Logs 'deferred' after one millisecond.
  27969. */
  27970. var defer = baseRest(function(func, args) {
  27971. return baseDelay(func, 1, args);
  27972. });
  27973. /**
  27974. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27975. * 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 delay.
  27982. * @param {number} wait The number of milliseconds to delay invocation.
  27983. * @param {...*} [args] The arguments to invoke `func` with.
  27984. * @returns {number} Returns the timer id.
  27985. * @example
  27986. *
  27987. * _.delay(function(text) {
  27988. * console.log(text);
  27989. * }, 1000, 'later');
  27990. * // => Logs 'later' after one second.
  27991. */
  27992. var delay = baseRest(function(func, wait, args) {
  27993. return baseDelay(func, toNumber(wait) || 0, args);
  27994. });
  27995. /**
  27996. * Creates a function that invokes `func` with arguments reversed.
  27997. *
  27998. * @static
  27999. * @memberOf _
  28000. * @since 4.0.0
  28001. * @category Function
  28002. * @param {Function} func The function to flip arguments for.
  28003. * @returns {Function} Returns the new flipped function.
  28004. * @example
  28005. *
  28006. * var flipped = _.flip(function() {
  28007. * return _.toArray(arguments);
  28008. * });
  28009. *
  28010. * flipped('a', 'b', 'c', 'd');
  28011. * // => ['d', 'c', 'b', 'a']
  28012. */
  28013. function flip(func) {
  28014. return createWrap(func, WRAP_FLIP_FLAG);
  28015. }
  28016. /**
  28017. * Creates a function that memoizes the result of `func`. If `resolver` is
  28018. * provided, it determines the cache key for storing the result based on the
  28019. * arguments provided to the memoized function. By default, the first argument
  28020. * provided to the memoized function is used as the map cache key. The `func`
  28021. * is invoked with the `this` binding of the memoized function.
  28022. *
  28023. * **Note:** The cache is exposed as the `cache` property on the memoized
  28024. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28025. * constructor with one whose instances implement the
  28026. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28027. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28028. *
  28029. * @static
  28030. * @memberOf _
  28031. * @since 0.1.0
  28032. * @category Function
  28033. * @param {Function} func The function to have its output memoized.
  28034. * @param {Function} [resolver] The function to resolve the cache key.
  28035. * @returns {Function} Returns the new memoized function.
  28036. * @example
  28037. *
  28038. * var object = { 'a': 1, 'b': 2 };
  28039. * var other = { 'c': 3, 'd': 4 };
  28040. *
  28041. * var values = _.memoize(_.values);
  28042. * values(object);
  28043. * // => [1, 2]
  28044. *
  28045. * values(other);
  28046. * // => [3, 4]
  28047. *
  28048. * object.a = 2;
  28049. * values(object);
  28050. * // => [1, 2]
  28051. *
  28052. * // Modify the result cache.
  28053. * values.cache.set(object, ['a', 'b']);
  28054. * values(object);
  28055. * // => ['a', 'b']
  28056. *
  28057. * // Replace `_.memoize.Cache`.
  28058. * _.memoize.Cache = WeakMap;
  28059. */
  28060. function memoize(func, resolver) {
  28061. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28062. throw new TypeError(FUNC_ERROR_TEXT);
  28063. }
  28064. var memoized = function() {
  28065. var args = arguments,
  28066. key = resolver ? resolver.apply(this, args) : args[0],
  28067. cache = memoized.cache;
  28068. if (cache.has(key)) {
  28069. return cache.get(key);
  28070. }
  28071. var result = func.apply(this, args);
  28072. memoized.cache = cache.set(key, result) || cache;
  28073. return result;
  28074. };
  28075. memoized.cache = new (memoize.Cache || MapCache);
  28076. return memoized;
  28077. }
  28078. // Expose `MapCache`.
  28079. memoize.Cache = MapCache;
  28080. /**
  28081. * Creates a function that negates the result of the predicate `func`. The
  28082. * `func` predicate is invoked with the `this` binding and arguments of the
  28083. * created function.
  28084. *
  28085. * @static
  28086. * @memberOf _
  28087. * @since 3.0.0
  28088. * @category Function
  28089. * @param {Function} predicate The predicate to negate.
  28090. * @returns {Function} Returns the new negated function.
  28091. * @example
  28092. *
  28093. * function isEven(n) {
  28094. * return n % 2 == 0;
  28095. * }
  28096. *
  28097. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28098. * // => [1, 3, 5]
  28099. */
  28100. function negate(predicate) {
  28101. if (typeof predicate != 'function') {
  28102. throw new TypeError(FUNC_ERROR_TEXT);
  28103. }
  28104. return function() {
  28105. var args = arguments;
  28106. switch (args.length) {
  28107. case 0: return !predicate.call(this);
  28108. case 1: return !predicate.call(this, args[0]);
  28109. case 2: return !predicate.call(this, args[0], args[1]);
  28110. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28111. }
  28112. return !predicate.apply(this, args);
  28113. };
  28114. }
  28115. /**
  28116. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28117. * to the function return the value of the first invocation. The `func` is
  28118. * invoked with the `this` binding and arguments of the created function.
  28119. *
  28120. * @static
  28121. * @memberOf _
  28122. * @since 0.1.0
  28123. * @category Function
  28124. * @param {Function} func The function to restrict.
  28125. * @returns {Function} Returns the new restricted function.
  28126. * @example
  28127. *
  28128. * var initialize = _.once(createApplication);
  28129. * initialize();
  28130. * initialize();
  28131. * // => `createApplication` is invoked once
  28132. */
  28133. function once(func) {
  28134. return before(2, func);
  28135. }
  28136. /**
  28137. * Creates a function that invokes `func` with its arguments transformed.
  28138. *
  28139. * @static
  28140. * @since 4.0.0
  28141. * @memberOf _
  28142. * @category Function
  28143. * @param {Function} func The function to wrap.
  28144. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28145. * The argument transforms.
  28146. * @returns {Function} Returns the new function.
  28147. * @example
  28148. *
  28149. * function doubled(n) {
  28150. * return n * 2;
  28151. * }
  28152. *
  28153. * function square(n) {
  28154. * return n * n;
  28155. * }
  28156. *
  28157. * var func = _.overArgs(function(x, y) {
  28158. * return [x, y];
  28159. * }, [square, doubled]);
  28160. *
  28161. * func(9, 3);
  28162. * // => [81, 6]
  28163. *
  28164. * func(10, 5);
  28165. * // => [100, 10]
  28166. */
  28167. var overArgs = castRest(function(func, transforms) {
  28168. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28169. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28170. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28171. var funcsLength = transforms.length;
  28172. return baseRest(function(args) {
  28173. var index = -1,
  28174. length = nativeMin(args.length, funcsLength);
  28175. while (++index < length) {
  28176. args[index] = transforms[index].call(this, args[index]);
  28177. }
  28178. return apply(func, this, args);
  28179. });
  28180. });
  28181. /**
  28182. * Creates a function that invokes `func` with `partials` prepended to the
  28183. * arguments it receives. This method is like `_.bind` except it does **not**
  28184. * alter the `this` binding.
  28185. *
  28186. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28187. * builds, may be used as a placeholder for partially applied arguments.
  28188. *
  28189. * **Note:** This method doesn't set the "length" property of partially
  28190. * applied functions.
  28191. *
  28192. * @static
  28193. * @memberOf _
  28194. * @since 0.2.0
  28195. * @category Function
  28196. * @param {Function} func The function to partially apply arguments to.
  28197. * @param {...*} [partials] The arguments to be partially applied.
  28198. * @returns {Function} Returns the new partially applied function.
  28199. * @example
  28200. *
  28201. * function greet(greeting, name) {
  28202. * return greeting + ' ' + name;
  28203. * }
  28204. *
  28205. * var sayHelloTo = _.partial(greet, 'hello');
  28206. * sayHelloTo('fred');
  28207. * // => 'hello fred'
  28208. *
  28209. * // Partially applied with placeholders.
  28210. * var greetFred = _.partial(greet, _, 'fred');
  28211. * greetFred('hi');
  28212. * // => 'hi fred'
  28213. */
  28214. var partial = baseRest(function(func, partials) {
  28215. var holders = replaceHolders(partials, getHolder(partial));
  28216. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28217. });
  28218. /**
  28219. * This method is like `_.partial` except that partially applied arguments
  28220. * are appended to the arguments it receives.
  28221. *
  28222. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28223. * builds, may be used as a placeholder for partially applied arguments.
  28224. *
  28225. * **Note:** This method doesn't set the "length" property of partially
  28226. * applied functions.
  28227. *
  28228. * @static
  28229. * @memberOf _
  28230. * @since 1.0.0
  28231. * @category Function
  28232. * @param {Function} func The function to partially apply arguments to.
  28233. * @param {...*} [partials] The arguments to be partially applied.
  28234. * @returns {Function} Returns the new partially applied function.
  28235. * @example
  28236. *
  28237. * function greet(greeting, name) {
  28238. * return greeting + ' ' + name;
  28239. * }
  28240. *
  28241. * var greetFred = _.partialRight(greet, 'fred');
  28242. * greetFred('hi');
  28243. * // => 'hi fred'
  28244. *
  28245. * // Partially applied with placeholders.
  28246. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28247. * sayHelloTo('fred');
  28248. * // => 'hello fred'
  28249. */
  28250. var partialRight = baseRest(function(func, partials) {
  28251. var holders = replaceHolders(partials, getHolder(partialRight));
  28252. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28253. });
  28254. /**
  28255. * Creates a function that invokes `func` with arguments arranged according
  28256. * to the specified `indexes` where the argument value at the first index is
  28257. * provided as the first argument, the argument value at the second index is
  28258. * provided as the second argument, and so on.
  28259. *
  28260. * @static
  28261. * @memberOf _
  28262. * @since 3.0.0
  28263. * @category Function
  28264. * @param {Function} func The function to rearrange arguments for.
  28265. * @param {...(number|number[])} indexes The arranged argument indexes.
  28266. * @returns {Function} Returns the new function.
  28267. * @example
  28268. *
  28269. * var rearged = _.rearg(function(a, b, c) {
  28270. * return [a, b, c];
  28271. * }, [2, 0, 1]);
  28272. *
  28273. * rearged('b', 'c', 'a')
  28274. * // => ['a', 'b', 'c']
  28275. */
  28276. var rearg = flatRest(function(func, indexes) {
  28277. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28278. });
  28279. /**
  28280. * Creates a function that invokes `func` with the `this` binding of the
  28281. * created function and arguments from `start` and beyond provided as
  28282. * an array.
  28283. *
  28284. * **Note:** This method is based on the
  28285. * [rest parameter](https://mdn.io/rest_parameters).
  28286. *
  28287. * @static
  28288. * @memberOf _
  28289. * @since 4.0.0
  28290. * @category Function
  28291. * @param {Function} func The function to apply a rest parameter to.
  28292. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28293. * @returns {Function} Returns the new function.
  28294. * @example
  28295. *
  28296. * var say = _.rest(function(what, names) {
  28297. * return what + ' ' + _.initial(names).join(', ') +
  28298. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28299. * });
  28300. *
  28301. * say('hello', 'fred', 'barney', 'pebbles');
  28302. * // => 'hello fred, barney, & pebbles'
  28303. */
  28304. function rest(func, start) {
  28305. if (typeof func != 'function') {
  28306. throw new TypeError(FUNC_ERROR_TEXT);
  28307. }
  28308. start = start === undefined ? start : toInteger(start);
  28309. return baseRest(func, start);
  28310. }
  28311. /**
  28312. * Creates a function that invokes `func` with the `this` binding of the
  28313. * create function and an array of arguments much like
  28314. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28315. *
  28316. * **Note:** This method is based on the
  28317. * [spread operator](https://mdn.io/spread_operator).
  28318. *
  28319. * @static
  28320. * @memberOf _
  28321. * @since 3.2.0
  28322. * @category Function
  28323. * @param {Function} func The function to spread arguments over.
  28324. * @param {number} [start=0] The start position of the spread.
  28325. * @returns {Function} Returns the new function.
  28326. * @example
  28327. *
  28328. * var say = _.spread(function(who, what) {
  28329. * return who + ' says ' + what;
  28330. * });
  28331. *
  28332. * say(['fred', 'hello']);
  28333. * // => 'fred says hello'
  28334. *
  28335. * var numbers = Promise.all([
  28336. * Promise.resolve(40),
  28337. * Promise.resolve(36)
  28338. * ]);
  28339. *
  28340. * numbers.then(_.spread(function(x, y) {
  28341. * return x + y;
  28342. * }));
  28343. * // => a Promise of 76
  28344. */
  28345. function spread(func, start) {
  28346. if (typeof func != 'function') {
  28347. throw new TypeError(FUNC_ERROR_TEXT);
  28348. }
  28349. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28350. return baseRest(function(args) {
  28351. var array = args[start],
  28352. otherArgs = castSlice(args, 0, start);
  28353. if (array) {
  28354. arrayPush(otherArgs, array);
  28355. }
  28356. return apply(func, this, otherArgs);
  28357. });
  28358. }
  28359. /**
  28360. * Creates a throttled function that only invokes `func` at most once per
  28361. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28362. * method to cancel delayed `func` invocations and a `flush` method to
  28363. * immediately invoke them. Provide `options` to indicate whether `func`
  28364. * should be invoked on the leading and/or trailing edge of the `wait`
  28365. * timeout. The `func` is invoked with the last arguments provided to the
  28366. * throttled function. Subsequent calls to the throttled function return the
  28367. * result of the last `func` invocation.
  28368. *
  28369. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28370. * invoked on the trailing edge of the timeout only if the throttled function
  28371. * is invoked more than once during the `wait` timeout.
  28372. *
  28373. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28374. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28375. *
  28376. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28377. * for details over the differences between `_.throttle` and `_.debounce`.
  28378. *
  28379. * @static
  28380. * @memberOf _
  28381. * @since 0.1.0
  28382. * @category Function
  28383. * @param {Function} func The function to throttle.
  28384. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28385. * @param {Object} [options={}] The options object.
  28386. * @param {boolean} [options.leading=true]
  28387. * Specify invoking on the leading edge of the timeout.
  28388. * @param {boolean} [options.trailing=true]
  28389. * Specify invoking on the trailing edge of the timeout.
  28390. * @returns {Function} Returns the new throttled function.
  28391. * @example
  28392. *
  28393. * // Avoid excessively updating the position while scrolling.
  28394. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28395. *
  28396. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28397. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28398. * jQuery(element).on('click', throttled);
  28399. *
  28400. * // Cancel the trailing throttled invocation.
  28401. * jQuery(window).on('popstate', throttled.cancel);
  28402. */
  28403. function throttle(func, wait, options) {
  28404. var leading = true,
  28405. trailing = true;
  28406. if (typeof func != 'function') {
  28407. throw new TypeError(FUNC_ERROR_TEXT);
  28408. }
  28409. if (isObject(options)) {
  28410. leading = 'leading' in options ? !!options.leading : leading;
  28411. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28412. }
  28413. return debounce(func, wait, {
  28414. 'leading': leading,
  28415. 'maxWait': wait,
  28416. 'trailing': trailing
  28417. });
  28418. }
  28419. /**
  28420. * Creates a function that accepts up to one argument, ignoring any
  28421. * additional arguments.
  28422. *
  28423. * @static
  28424. * @memberOf _
  28425. * @since 4.0.0
  28426. * @category Function
  28427. * @param {Function} func The function to cap arguments for.
  28428. * @returns {Function} Returns the new capped function.
  28429. * @example
  28430. *
  28431. * _.map(['6', '8', '10'], _.unary(parseInt));
  28432. * // => [6, 8, 10]
  28433. */
  28434. function unary(func) {
  28435. return ary(func, 1);
  28436. }
  28437. /**
  28438. * Creates a function that provides `value` to `wrapper` as its first
  28439. * argument. Any additional arguments provided to the function are appended
  28440. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28441. * binding of the created function.
  28442. *
  28443. * @static
  28444. * @memberOf _
  28445. * @since 0.1.0
  28446. * @category Function
  28447. * @param {*} value The value to wrap.
  28448. * @param {Function} [wrapper=identity] The wrapper function.
  28449. * @returns {Function} Returns the new function.
  28450. * @example
  28451. *
  28452. * var p = _.wrap(_.escape, function(func, text) {
  28453. * return '<p>' + func(text) + '</p>';
  28454. * });
  28455. *
  28456. * p('fred, barney, & pebbles');
  28457. * // => '<p>fred, barney, &amp; pebbles</p>'
  28458. */
  28459. function wrap(value, wrapper) {
  28460. return partial(castFunction(wrapper), value);
  28461. }
  28462. /*------------------------------------------------------------------------*/
  28463. /**
  28464. * Casts `value` as an array if it's not one.
  28465. *
  28466. * @static
  28467. * @memberOf _
  28468. * @since 4.4.0
  28469. * @category Lang
  28470. * @param {*} value The value to inspect.
  28471. * @returns {Array} Returns the cast array.
  28472. * @example
  28473. *
  28474. * _.castArray(1);
  28475. * // => [1]
  28476. *
  28477. * _.castArray({ 'a': 1 });
  28478. * // => [{ 'a': 1 }]
  28479. *
  28480. * _.castArray('abc');
  28481. * // => ['abc']
  28482. *
  28483. * _.castArray(null);
  28484. * // => [null]
  28485. *
  28486. * _.castArray(undefined);
  28487. * // => [undefined]
  28488. *
  28489. * _.castArray();
  28490. * // => []
  28491. *
  28492. * var array = [1, 2, 3];
  28493. * console.log(_.castArray(array) === array);
  28494. * // => true
  28495. */
  28496. function castArray() {
  28497. if (!arguments.length) {
  28498. return [];
  28499. }
  28500. var value = arguments[0];
  28501. return isArray(value) ? value : [value];
  28502. }
  28503. /**
  28504. * Creates a shallow clone of `value`.
  28505. *
  28506. * **Note:** This method is loosely based on the
  28507. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28508. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28509. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28510. * arrays. The own enumerable properties of `arguments` objects are cloned
  28511. * as plain objects. An empty object is returned for uncloneable values such
  28512. * as error objects, functions, DOM nodes, and WeakMaps.
  28513. *
  28514. * @static
  28515. * @memberOf _
  28516. * @since 0.1.0
  28517. * @category Lang
  28518. * @param {*} value The value to clone.
  28519. * @returns {*} Returns the cloned value.
  28520. * @see _.cloneDeep
  28521. * @example
  28522. *
  28523. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28524. *
  28525. * var shallow = _.clone(objects);
  28526. * console.log(shallow[0] === objects[0]);
  28527. * // => true
  28528. */
  28529. function clone(value) {
  28530. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28531. }
  28532. /**
  28533. * This method is like `_.clone` except that it accepts `customizer` which
  28534. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28535. * cloning is handled by the method instead. The `customizer` is invoked with
  28536. * up to four arguments; (value [, index|key, object, stack]).
  28537. *
  28538. * @static
  28539. * @memberOf _
  28540. * @since 4.0.0
  28541. * @category Lang
  28542. * @param {*} value The value to clone.
  28543. * @param {Function} [customizer] The function to customize cloning.
  28544. * @returns {*} Returns the cloned value.
  28545. * @see _.cloneDeepWith
  28546. * @example
  28547. *
  28548. * function customizer(value) {
  28549. * if (_.isElement(value)) {
  28550. * return value.cloneNode(false);
  28551. * }
  28552. * }
  28553. *
  28554. * var el = _.cloneWith(document.body, customizer);
  28555. *
  28556. * console.log(el === document.body);
  28557. * // => false
  28558. * console.log(el.nodeName);
  28559. * // => 'BODY'
  28560. * console.log(el.childNodes.length);
  28561. * // => 0
  28562. */
  28563. function cloneWith(value, customizer) {
  28564. customizer = typeof customizer == 'function' ? customizer : undefined;
  28565. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28566. }
  28567. /**
  28568. * This method is like `_.clone` except that it recursively clones `value`.
  28569. *
  28570. * @static
  28571. * @memberOf _
  28572. * @since 1.0.0
  28573. * @category Lang
  28574. * @param {*} value The value to recursively clone.
  28575. * @returns {*} Returns the deep cloned value.
  28576. * @see _.clone
  28577. * @example
  28578. *
  28579. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28580. *
  28581. * var deep = _.cloneDeep(objects);
  28582. * console.log(deep[0] === objects[0]);
  28583. * // => false
  28584. */
  28585. function cloneDeep(value) {
  28586. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28587. }
  28588. /**
  28589. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28590. *
  28591. * @static
  28592. * @memberOf _
  28593. * @since 4.0.0
  28594. * @category Lang
  28595. * @param {*} value The value to recursively clone.
  28596. * @param {Function} [customizer] The function to customize cloning.
  28597. * @returns {*} Returns the deep cloned value.
  28598. * @see _.cloneWith
  28599. * @example
  28600. *
  28601. * function customizer(value) {
  28602. * if (_.isElement(value)) {
  28603. * return value.cloneNode(true);
  28604. * }
  28605. * }
  28606. *
  28607. * var el = _.cloneDeepWith(document.body, customizer);
  28608. *
  28609. * console.log(el === document.body);
  28610. * // => false
  28611. * console.log(el.nodeName);
  28612. * // => 'BODY'
  28613. * console.log(el.childNodes.length);
  28614. * // => 20
  28615. */
  28616. function cloneDeepWith(value, customizer) {
  28617. customizer = typeof customizer == 'function' ? customizer : undefined;
  28618. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28619. }
  28620. /**
  28621. * Checks if `object` conforms to `source` by invoking the predicate
  28622. * properties of `source` with the corresponding property values of `object`.
  28623. *
  28624. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28625. * partially applied.
  28626. *
  28627. * @static
  28628. * @memberOf _
  28629. * @since 4.14.0
  28630. * @category Lang
  28631. * @param {Object} object The object to inspect.
  28632. * @param {Object} source The object of property predicates to conform to.
  28633. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28634. * @example
  28635. *
  28636. * var object = { 'a': 1, 'b': 2 };
  28637. *
  28638. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28639. * // => true
  28640. *
  28641. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28642. * // => false
  28643. */
  28644. function conformsTo(object, source) {
  28645. return source == null || baseConformsTo(object, source, keys(source));
  28646. }
  28647. /**
  28648. * Performs a
  28649. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28650. * comparison between two values to determine if they are equivalent.
  28651. *
  28652. * @static
  28653. * @memberOf _
  28654. * @since 4.0.0
  28655. * @category Lang
  28656. * @param {*} value The value to compare.
  28657. * @param {*} other The other value to compare.
  28658. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28659. * @example
  28660. *
  28661. * var object = { 'a': 1 };
  28662. * var other = { 'a': 1 };
  28663. *
  28664. * _.eq(object, object);
  28665. * // => true
  28666. *
  28667. * _.eq(object, other);
  28668. * // => false
  28669. *
  28670. * _.eq('a', 'a');
  28671. * // => true
  28672. *
  28673. * _.eq('a', Object('a'));
  28674. * // => false
  28675. *
  28676. * _.eq(NaN, NaN);
  28677. * // => true
  28678. */
  28679. function eq(value, other) {
  28680. return value === other || (value !== value && other !== other);
  28681. }
  28682. /**
  28683. * Checks if `value` is greater than `other`.
  28684. *
  28685. * @static
  28686. * @memberOf _
  28687. * @since 3.9.0
  28688. * @category Lang
  28689. * @param {*} value The value to compare.
  28690. * @param {*} other The other value to compare.
  28691. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28692. * else `false`.
  28693. * @see _.lt
  28694. * @example
  28695. *
  28696. * _.gt(3, 1);
  28697. * // => true
  28698. *
  28699. * _.gt(3, 3);
  28700. * // => false
  28701. *
  28702. * _.gt(1, 3);
  28703. * // => false
  28704. */
  28705. var gt = createRelationalOperation(baseGt);
  28706. /**
  28707. * Checks if `value` is greater than or equal to `other`.
  28708. *
  28709. * @static
  28710. * @memberOf _
  28711. * @since 3.9.0
  28712. * @category Lang
  28713. * @param {*} value The value to compare.
  28714. * @param {*} other The other value to compare.
  28715. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28716. * `other`, else `false`.
  28717. * @see _.lte
  28718. * @example
  28719. *
  28720. * _.gte(3, 1);
  28721. * // => true
  28722. *
  28723. * _.gte(3, 3);
  28724. * // => true
  28725. *
  28726. * _.gte(1, 3);
  28727. * // => false
  28728. */
  28729. var gte = createRelationalOperation(function(value, other) {
  28730. return value >= other;
  28731. });
  28732. /**
  28733. * Checks if `value` is likely an `arguments` object.
  28734. *
  28735. * @static
  28736. * @memberOf _
  28737. * @since 0.1.0
  28738. * @category Lang
  28739. * @param {*} value The value to check.
  28740. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28741. * else `false`.
  28742. * @example
  28743. *
  28744. * _.isArguments(function() { return arguments; }());
  28745. * // => true
  28746. *
  28747. * _.isArguments([1, 2, 3]);
  28748. * // => false
  28749. */
  28750. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28751. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28752. !propertyIsEnumerable.call(value, 'callee');
  28753. };
  28754. /**
  28755. * Checks if `value` is classified as an `Array` object.
  28756. *
  28757. * @static
  28758. * @memberOf _
  28759. * @since 0.1.0
  28760. * @category Lang
  28761. * @param {*} value The value to check.
  28762. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28763. * @example
  28764. *
  28765. * _.isArray([1, 2, 3]);
  28766. * // => true
  28767. *
  28768. * _.isArray(document.body.children);
  28769. * // => false
  28770. *
  28771. * _.isArray('abc');
  28772. * // => false
  28773. *
  28774. * _.isArray(_.noop);
  28775. * // => false
  28776. */
  28777. var isArray = Array.isArray;
  28778. /**
  28779. * Checks if `value` is classified as an `ArrayBuffer` object.
  28780. *
  28781. * @static
  28782. * @memberOf _
  28783. * @since 4.3.0
  28784. * @category Lang
  28785. * @param {*} value The value to check.
  28786. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28787. * @example
  28788. *
  28789. * _.isArrayBuffer(new ArrayBuffer(2));
  28790. * // => true
  28791. *
  28792. * _.isArrayBuffer(new Array(2));
  28793. * // => false
  28794. */
  28795. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28796. /**
  28797. * Checks if `value` is array-like. A value is considered array-like if it's
  28798. * not a function and has a `value.length` that's an integer greater than or
  28799. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28800. *
  28801. * @static
  28802. * @memberOf _
  28803. * @since 4.0.0
  28804. * @category Lang
  28805. * @param {*} value The value to check.
  28806. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28807. * @example
  28808. *
  28809. * _.isArrayLike([1, 2, 3]);
  28810. * // => true
  28811. *
  28812. * _.isArrayLike(document.body.children);
  28813. * // => true
  28814. *
  28815. * _.isArrayLike('abc');
  28816. * // => true
  28817. *
  28818. * _.isArrayLike(_.noop);
  28819. * // => false
  28820. */
  28821. function isArrayLike(value) {
  28822. return value != null && isLength(value.length) && !isFunction(value);
  28823. }
  28824. /**
  28825. * This method is like `_.isArrayLike` except that it also checks if `value`
  28826. * is an object.
  28827. *
  28828. * @static
  28829. * @memberOf _
  28830. * @since 4.0.0
  28831. * @category Lang
  28832. * @param {*} value The value to check.
  28833. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28834. * else `false`.
  28835. * @example
  28836. *
  28837. * _.isArrayLikeObject([1, 2, 3]);
  28838. * // => true
  28839. *
  28840. * _.isArrayLikeObject(document.body.children);
  28841. * // => true
  28842. *
  28843. * _.isArrayLikeObject('abc');
  28844. * // => false
  28845. *
  28846. * _.isArrayLikeObject(_.noop);
  28847. * // => false
  28848. */
  28849. function isArrayLikeObject(value) {
  28850. return isObjectLike(value) && isArrayLike(value);
  28851. }
  28852. /**
  28853. * Checks if `value` is classified as a boolean primitive or object.
  28854. *
  28855. * @static
  28856. * @memberOf _
  28857. * @since 0.1.0
  28858. * @category Lang
  28859. * @param {*} value The value to check.
  28860. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28861. * @example
  28862. *
  28863. * _.isBoolean(false);
  28864. * // => true
  28865. *
  28866. * _.isBoolean(null);
  28867. * // => false
  28868. */
  28869. function isBoolean(value) {
  28870. return value === true || value === false ||
  28871. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28872. }
  28873. /**
  28874. * Checks if `value` is a buffer.
  28875. *
  28876. * @static
  28877. * @memberOf _
  28878. * @since 4.3.0
  28879. * @category Lang
  28880. * @param {*} value The value to check.
  28881. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28882. * @example
  28883. *
  28884. * _.isBuffer(new Buffer(2));
  28885. * // => true
  28886. *
  28887. * _.isBuffer(new Uint8Array(2));
  28888. * // => false
  28889. */
  28890. var isBuffer = nativeIsBuffer || stubFalse;
  28891. /**
  28892. * Checks if `value` is classified as a `Date` object.
  28893. *
  28894. * @static
  28895. * @memberOf _
  28896. * @since 0.1.0
  28897. * @category Lang
  28898. * @param {*} value The value to check.
  28899. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28900. * @example
  28901. *
  28902. * _.isDate(new Date);
  28903. * // => true
  28904. *
  28905. * _.isDate('Mon April 23 2012');
  28906. * // => false
  28907. */
  28908. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28909. /**
  28910. * Checks if `value` is likely a DOM element.
  28911. *
  28912. * @static
  28913. * @memberOf _
  28914. * @since 0.1.0
  28915. * @category Lang
  28916. * @param {*} value The value to check.
  28917. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28918. * @example
  28919. *
  28920. * _.isElement(document.body);
  28921. * // => true
  28922. *
  28923. * _.isElement('<body>');
  28924. * // => false
  28925. */
  28926. function isElement(value) {
  28927. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28928. }
  28929. /**
  28930. * Checks if `value` is an empty object, collection, map, or set.
  28931. *
  28932. * Objects are considered empty if they have no own enumerable string keyed
  28933. * properties.
  28934. *
  28935. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28936. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28937. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28938. *
  28939. * @static
  28940. * @memberOf _
  28941. * @since 0.1.0
  28942. * @category Lang
  28943. * @param {*} value The value to check.
  28944. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28945. * @example
  28946. *
  28947. * _.isEmpty(null);
  28948. * // => true
  28949. *
  28950. * _.isEmpty(true);
  28951. * // => true
  28952. *
  28953. * _.isEmpty(1);
  28954. * // => true
  28955. *
  28956. * _.isEmpty([1, 2, 3]);
  28957. * // => false
  28958. *
  28959. * _.isEmpty({ 'a': 1 });
  28960. * // => false
  28961. */
  28962. function isEmpty(value) {
  28963. if (value == null) {
  28964. return true;
  28965. }
  28966. if (isArrayLike(value) &&
  28967. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28968. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28969. return !value.length;
  28970. }
  28971. var tag = getTag(value);
  28972. if (tag == mapTag || tag == setTag) {
  28973. return !value.size;
  28974. }
  28975. if (isPrototype(value)) {
  28976. return !baseKeys(value).length;
  28977. }
  28978. for (var key in value) {
  28979. if (hasOwnProperty.call(value, key)) {
  28980. return false;
  28981. }
  28982. }
  28983. return true;
  28984. }
  28985. /**
  28986. * Performs a deep comparison between two values to determine if they are
  28987. * equivalent.
  28988. *
  28989. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28990. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28991. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28992. * by their own, not inherited, enumerable properties. Functions and DOM
  28993. * nodes are compared by strict equality, i.e. `===`.
  28994. *
  28995. * @static
  28996. * @memberOf _
  28997. * @since 0.1.0
  28998. * @category Lang
  28999. * @param {*} value The value to compare.
  29000. * @param {*} other The other value to compare.
  29001. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29002. * @example
  29003. *
  29004. * var object = { 'a': 1 };
  29005. * var other = { 'a': 1 };
  29006. *
  29007. * _.isEqual(object, other);
  29008. * // => true
  29009. *
  29010. * object === other;
  29011. * // => false
  29012. */
  29013. function isEqual(value, other) {
  29014. return baseIsEqual(value, other);
  29015. }
  29016. /**
  29017. * This method is like `_.isEqual` except that it accepts `customizer` which
  29018. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29019. * are handled by the method instead. The `customizer` is invoked with up to
  29020. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29021. *
  29022. * @static
  29023. * @memberOf _
  29024. * @since 4.0.0
  29025. * @category Lang
  29026. * @param {*} value The value to compare.
  29027. * @param {*} other The other value to compare.
  29028. * @param {Function} [customizer] The function to customize comparisons.
  29029. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29030. * @example
  29031. *
  29032. * function isGreeting(value) {
  29033. * return /^h(?:i|ello)$/.test(value);
  29034. * }
  29035. *
  29036. * function customizer(objValue, othValue) {
  29037. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29038. * return true;
  29039. * }
  29040. * }
  29041. *
  29042. * var array = ['hello', 'goodbye'];
  29043. * var other = ['hi', 'goodbye'];
  29044. *
  29045. * _.isEqualWith(array, other, customizer);
  29046. * // => true
  29047. */
  29048. function isEqualWith(value, other, customizer) {
  29049. customizer = typeof customizer == 'function' ? customizer : undefined;
  29050. var result = customizer ? customizer(value, other) : undefined;
  29051. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29052. }
  29053. /**
  29054. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29055. * `SyntaxError`, `TypeError`, or `URIError` object.
  29056. *
  29057. * @static
  29058. * @memberOf _
  29059. * @since 3.0.0
  29060. * @category Lang
  29061. * @param {*} value The value to check.
  29062. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29063. * @example
  29064. *
  29065. * _.isError(new Error);
  29066. * // => true
  29067. *
  29068. * _.isError(Error);
  29069. * // => false
  29070. */
  29071. function isError(value) {
  29072. if (!isObjectLike(value)) {
  29073. return false;
  29074. }
  29075. var tag = baseGetTag(value);
  29076. return tag == errorTag || tag == domExcTag ||
  29077. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29078. }
  29079. /**
  29080. * Checks if `value` is a finite primitive number.
  29081. *
  29082. * **Note:** This method is based on
  29083. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29084. *
  29085. * @static
  29086. * @memberOf _
  29087. * @since 0.1.0
  29088. * @category Lang
  29089. * @param {*} value The value to check.
  29090. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29091. * @example
  29092. *
  29093. * _.isFinite(3);
  29094. * // => true
  29095. *
  29096. * _.isFinite(Number.MIN_VALUE);
  29097. * // => true
  29098. *
  29099. * _.isFinite(Infinity);
  29100. * // => false
  29101. *
  29102. * _.isFinite('3');
  29103. * // => false
  29104. */
  29105. function isFinite(value) {
  29106. return typeof value == 'number' && nativeIsFinite(value);
  29107. }
  29108. /**
  29109. * Checks if `value` is classified as a `Function` object.
  29110. *
  29111. * @static
  29112. * @memberOf _
  29113. * @since 0.1.0
  29114. * @category Lang
  29115. * @param {*} value The value to check.
  29116. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29117. * @example
  29118. *
  29119. * _.isFunction(_);
  29120. * // => true
  29121. *
  29122. * _.isFunction(/abc/);
  29123. * // => false
  29124. */
  29125. function isFunction(value) {
  29126. if (!isObject(value)) {
  29127. return false;
  29128. }
  29129. // The use of `Object#toString` avoids issues with the `typeof` operator
  29130. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29131. var tag = baseGetTag(value);
  29132. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29133. }
  29134. /**
  29135. * Checks if `value` is an integer.
  29136. *
  29137. * **Note:** This method is based on
  29138. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29139. *
  29140. * @static
  29141. * @memberOf _
  29142. * @since 4.0.0
  29143. * @category Lang
  29144. * @param {*} value The value to check.
  29145. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29146. * @example
  29147. *
  29148. * _.isInteger(3);
  29149. * // => true
  29150. *
  29151. * _.isInteger(Number.MIN_VALUE);
  29152. * // => false
  29153. *
  29154. * _.isInteger(Infinity);
  29155. * // => false
  29156. *
  29157. * _.isInteger('3');
  29158. * // => false
  29159. */
  29160. function isInteger(value) {
  29161. return typeof value == 'number' && value == toInteger(value);
  29162. }
  29163. /**
  29164. * Checks if `value` is a valid array-like length.
  29165. *
  29166. * **Note:** This method is loosely based on
  29167. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29168. *
  29169. * @static
  29170. * @memberOf _
  29171. * @since 4.0.0
  29172. * @category Lang
  29173. * @param {*} value The value to check.
  29174. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29175. * @example
  29176. *
  29177. * _.isLength(3);
  29178. * // => true
  29179. *
  29180. * _.isLength(Number.MIN_VALUE);
  29181. * // => false
  29182. *
  29183. * _.isLength(Infinity);
  29184. * // => false
  29185. *
  29186. * _.isLength('3');
  29187. * // => false
  29188. */
  29189. function isLength(value) {
  29190. return typeof value == 'number' &&
  29191. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29192. }
  29193. /**
  29194. * Checks if `value` is the
  29195. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29196. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29197. *
  29198. * @static
  29199. * @memberOf _
  29200. * @since 0.1.0
  29201. * @category Lang
  29202. * @param {*} value The value to check.
  29203. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29204. * @example
  29205. *
  29206. * _.isObject({});
  29207. * // => true
  29208. *
  29209. * _.isObject([1, 2, 3]);
  29210. * // => true
  29211. *
  29212. * _.isObject(_.noop);
  29213. * // => true
  29214. *
  29215. * _.isObject(null);
  29216. * // => false
  29217. */
  29218. function isObject(value) {
  29219. var type = typeof value;
  29220. return value != null && (type == 'object' || type == 'function');
  29221. }
  29222. /**
  29223. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29224. * and has a `typeof` result of "object".
  29225. *
  29226. * @static
  29227. * @memberOf _
  29228. * @since 4.0.0
  29229. * @category Lang
  29230. * @param {*} value The value to check.
  29231. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29232. * @example
  29233. *
  29234. * _.isObjectLike({});
  29235. * // => true
  29236. *
  29237. * _.isObjectLike([1, 2, 3]);
  29238. * // => true
  29239. *
  29240. * _.isObjectLike(_.noop);
  29241. * // => false
  29242. *
  29243. * _.isObjectLike(null);
  29244. * // => false
  29245. */
  29246. function isObjectLike(value) {
  29247. return value != null && typeof value == 'object';
  29248. }
  29249. /**
  29250. * Checks if `value` is classified as a `Map` object.
  29251. *
  29252. * @static
  29253. * @memberOf _
  29254. * @since 4.3.0
  29255. * @category Lang
  29256. * @param {*} value The value to check.
  29257. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29258. * @example
  29259. *
  29260. * _.isMap(new Map);
  29261. * // => true
  29262. *
  29263. * _.isMap(new WeakMap);
  29264. * // => false
  29265. */
  29266. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29267. /**
  29268. * Performs a partial deep comparison between `object` and `source` to
  29269. * determine if `object` contains equivalent property values.
  29270. *
  29271. * **Note:** This method is equivalent to `_.matches` when `source` is
  29272. * partially applied.
  29273. *
  29274. * Partial comparisons will match empty array and empty object `source`
  29275. * values against any array or object value, respectively. See `_.isEqual`
  29276. * for a list of supported value comparisons.
  29277. *
  29278. * @static
  29279. * @memberOf _
  29280. * @since 3.0.0
  29281. * @category Lang
  29282. * @param {Object} object The object to inspect.
  29283. * @param {Object} source The object of property values to match.
  29284. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29285. * @example
  29286. *
  29287. * var object = { 'a': 1, 'b': 2 };
  29288. *
  29289. * _.isMatch(object, { 'b': 2 });
  29290. * // => true
  29291. *
  29292. * _.isMatch(object, { 'b': 1 });
  29293. * // => false
  29294. */
  29295. function isMatch(object, source) {
  29296. return object === source || baseIsMatch(object, source, getMatchData(source));
  29297. }
  29298. /**
  29299. * This method is like `_.isMatch` except that it accepts `customizer` which
  29300. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29301. * are handled by the method instead. The `customizer` is invoked with five
  29302. * arguments: (objValue, srcValue, index|key, object, source).
  29303. *
  29304. * @static
  29305. * @memberOf _
  29306. * @since 4.0.0
  29307. * @category Lang
  29308. * @param {Object} object The object to inspect.
  29309. * @param {Object} source The object of property values to match.
  29310. * @param {Function} [customizer] The function to customize comparisons.
  29311. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29312. * @example
  29313. *
  29314. * function isGreeting(value) {
  29315. * return /^h(?:i|ello)$/.test(value);
  29316. * }
  29317. *
  29318. * function customizer(objValue, srcValue) {
  29319. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29320. * return true;
  29321. * }
  29322. * }
  29323. *
  29324. * var object = { 'greeting': 'hello' };
  29325. * var source = { 'greeting': 'hi' };
  29326. *
  29327. * _.isMatchWith(object, source, customizer);
  29328. * // => true
  29329. */
  29330. function isMatchWith(object, source, customizer) {
  29331. customizer = typeof customizer == 'function' ? customizer : undefined;
  29332. return baseIsMatch(object, source, getMatchData(source), customizer);
  29333. }
  29334. /**
  29335. * Checks if `value` is `NaN`.
  29336. *
  29337. * **Note:** This method is based on
  29338. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29339. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29340. * `undefined` and other non-number values.
  29341. *
  29342. * @static
  29343. * @memberOf _
  29344. * @since 0.1.0
  29345. * @category Lang
  29346. * @param {*} value The value to check.
  29347. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29348. * @example
  29349. *
  29350. * _.isNaN(NaN);
  29351. * // => true
  29352. *
  29353. * _.isNaN(new Number(NaN));
  29354. * // => true
  29355. *
  29356. * isNaN(undefined);
  29357. * // => true
  29358. *
  29359. * _.isNaN(undefined);
  29360. * // => false
  29361. */
  29362. function isNaN(value) {
  29363. // An `NaN` primitive is the only value that is not equal to itself.
  29364. // Perform the `toStringTag` check first to avoid errors with some
  29365. // ActiveX objects in IE.
  29366. return isNumber(value) && value != +value;
  29367. }
  29368. /**
  29369. * Checks if `value` is a pristine native function.
  29370. *
  29371. * **Note:** This method can't reliably detect native functions in the presence
  29372. * of the core-js package because core-js circumvents this kind of detection.
  29373. * Despite multiple requests, the core-js maintainer has made it clear: any
  29374. * attempt to fix the detection will be obstructed. As a result, we're left
  29375. * with little choice but to throw an error. Unfortunately, this also affects
  29376. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29377. * which rely on core-js.
  29378. *
  29379. * @static
  29380. * @memberOf _
  29381. * @since 3.0.0
  29382. * @category Lang
  29383. * @param {*} value The value to check.
  29384. * @returns {boolean} Returns `true` if `value` is a native function,
  29385. * else `false`.
  29386. * @example
  29387. *
  29388. * _.isNative(Array.prototype.push);
  29389. * // => true
  29390. *
  29391. * _.isNative(_);
  29392. * // => false
  29393. */
  29394. function isNative(value) {
  29395. if (isMaskable(value)) {
  29396. throw new Error(CORE_ERROR_TEXT);
  29397. }
  29398. return baseIsNative(value);
  29399. }
  29400. /**
  29401. * Checks if `value` is `null`.
  29402. *
  29403. * @static
  29404. * @memberOf _
  29405. * @since 0.1.0
  29406. * @category Lang
  29407. * @param {*} value The value to check.
  29408. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29409. * @example
  29410. *
  29411. * _.isNull(null);
  29412. * // => true
  29413. *
  29414. * _.isNull(void 0);
  29415. * // => false
  29416. */
  29417. function isNull(value) {
  29418. return value === null;
  29419. }
  29420. /**
  29421. * Checks if `value` is `null` or `undefined`.
  29422. *
  29423. * @static
  29424. * @memberOf _
  29425. * @since 4.0.0
  29426. * @category Lang
  29427. * @param {*} value The value to check.
  29428. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29429. * @example
  29430. *
  29431. * _.isNil(null);
  29432. * // => true
  29433. *
  29434. * _.isNil(void 0);
  29435. * // => true
  29436. *
  29437. * _.isNil(NaN);
  29438. * // => false
  29439. */
  29440. function isNil(value) {
  29441. return value == null;
  29442. }
  29443. /**
  29444. * Checks if `value` is classified as a `Number` primitive or object.
  29445. *
  29446. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29447. * classified as numbers, use the `_.isFinite` method.
  29448. *
  29449. * @static
  29450. * @memberOf _
  29451. * @since 0.1.0
  29452. * @category Lang
  29453. * @param {*} value The value to check.
  29454. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29455. * @example
  29456. *
  29457. * _.isNumber(3);
  29458. * // => true
  29459. *
  29460. * _.isNumber(Number.MIN_VALUE);
  29461. * // => true
  29462. *
  29463. * _.isNumber(Infinity);
  29464. * // => true
  29465. *
  29466. * _.isNumber('3');
  29467. * // => false
  29468. */
  29469. function isNumber(value) {
  29470. return typeof value == 'number' ||
  29471. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29472. }
  29473. /**
  29474. * Checks if `value` is a plain object, that is, an object created by the
  29475. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29476. *
  29477. * @static
  29478. * @memberOf _
  29479. * @since 0.8.0
  29480. * @category Lang
  29481. * @param {*} value The value to check.
  29482. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29483. * @example
  29484. *
  29485. * function Foo() {
  29486. * this.a = 1;
  29487. * }
  29488. *
  29489. * _.isPlainObject(new Foo);
  29490. * // => false
  29491. *
  29492. * _.isPlainObject([1, 2, 3]);
  29493. * // => false
  29494. *
  29495. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29496. * // => true
  29497. *
  29498. * _.isPlainObject(Object.create(null));
  29499. * // => true
  29500. */
  29501. function isPlainObject(value) {
  29502. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29503. return false;
  29504. }
  29505. var proto = getPrototype(value);
  29506. if (proto === null) {
  29507. return true;
  29508. }
  29509. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29510. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29511. funcToString.call(Ctor) == objectCtorString;
  29512. }
  29513. /**
  29514. * Checks if `value` is classified as a `RegExp` object.
  29515. *
  29516. * @static
  29517. * @memberOf _
  29518. * @since 0.1.0
  29519. * @category Lang
  29520. * @param {*} value The value to check.
  29521. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29522. * @example
  29523. *
  29524. * _.isRegExp(/abc/);
  29525. * // => true
  29526. *
  29527. * _.isRegExp('/abc/');
  29528. * // => false
  29529. */
  29530. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29531. /**
  29532. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29533. * double precision number which isn't the result of a rounded unsafe integer.
  29534. *
  29535. * **Note:** This method is based on
  29536. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29537. *
  29538. * @static
  29539. * @memberOf _
  29540. * @since 4.0.0
  29541. * @category Lang
  29542. * @param {*} value The value to check.
  29543. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29544. * @example
  29545. *
  29546. * _.isSafeInteger(3);
  29547. * // => true
  29548. *
  29549. * _.isSafeInteger(Number.MIN_VALUE);
  29550. * // => false
  29551. *
  29552. * _.isSafeInteger(Infinity);
  29553. * // => false
  29554. *
  29555. * _.isSafeInteger('3');
  29556. * // => false
  29557. */
  29558. function isSafeInteger(value) {
  29559. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29560. }
  29561. /**
  29562. * Checks if `value` is classified as a `Set` object.
  29563. *
  29564. * @static
  29565. * @memberOf _
  29566. * @since 4.3.0
  29567. * @category Lang
  29568. * @param {*} value The value to check.
  29569. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29570. * @example
  29571. *
  29572. * _.isSet(new Set);
  29573. * // => true
  29574. *
  29575. * _.isSet(new WeakSet);
  29576. * // => false
  29577. */
  29578. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29579. /**
  29580. * Checks if `value` is classified as a `String` primitive or object.
  29581. *
  29582. * @static
  29583. * @since 0.1.0
  29584. * @memberOf _
  29585. * @category Lang
  29586. * @param {*} value The value to check.
  29587. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29588. * @example
  29589. *
  29590. * _.isString('abc');
  29591. * // => true
  29592. *
  29593. * _.isString(1);
  29594. * // => false
  29595. */
  29596. function isString(value) {
  29597. return typeof value == 'string' ||
  29598. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29599. }
  29600. /**
  29601. * Checks if `value` is classified as a `Symbol` primitive or object.
  29602. *
  29603. * @static
  29604. * @memberOf _
  29605. * @since 4.0.0
  29606. * @category Lang
  29607. * @param {*} value The value to check.
  29608. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29609. * @example
  29610. *
  29611. * _.isSymbol(Symbol.iterator);
  29612. * // => true
  29613. *
  29614. * _.isSymbol('abc');
  29615. * // => false
  29616. */
  29617. function isSymbol(value) {
  29618. return typeof value == 'symbol' ||
  29619. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29620. }
  29621. /**
  29622. * Checks if `value` is classified as a typed array.
  29623. *
  29624. * @static
  29625. * @memberOf _
  29626. * @since 3.0.0
  29627. * @category Lang
  29628. * @param {*} value The value to check.
  29629. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29630. * @example
  29631. *
  29632. * _.isTypedArray(new Uint8Array);
  29633. * // => true
  29634. *
  29635. * _.isTypedArray([]);
  29636. * // => false
  29637. */
  29638. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29639. /**
  29640. * Checks if `value` is `undefined`.
  29641. *
  29642. * @static
  29643. * @since 0.1.0
  29644. * @memberOf _
  29645. * @category Lang
  29646. * @param {*} value The value to check.
  29647. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29648. * @example
  29649. *
  29650. * _.isUndefined(void 0);
  29651. * // => true
  29652. *
  29653. * _.isUndefined(null);
  29654. * // => false
  29655. */
  29656. function isUndefined(value) {
  29657. return value === undefined;
  29658. }
  29659. /**
  29660. * Checks if `value` is classified as a `WeakMap` object.
  29661. *
  29662. * @static
  29663. * @memberOf _
  29664. * @since 4.3.0
  29665. * @category Lang
  29666. * @param {*} value The value to check.
  29667. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29668. * @example
  29669. *
  29670. * _.isWeakMap(new WeakMap);
  29671. * // => true
  29672. *
  29673. * _.isWeakMap(new Map);
  29674. * // => false
  29675. */
  29676. function isWeakMap(value) {
  29677. return isObjectLike(value) && getTag(value) == weakMapTag;
  29678. }
  29679. /**
  29680. * Checks if `value` is classified as a `WeakSet` object.
  29681. *
  29682. * @static
  29683. * @memberOf _
  29684. * @since 4.3.0
  29685. * @category Lang
  29686. * @param {*} value The value to check.
  29687. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29688. * @example
  29689. *
  29690. * _.isWeakSet(new WeakSet);
  29691. * // => true
  29692. *
  29693. * _.isWeakSet(new Set);
  29694. * // => false
  29695. */
  29696. function isWeakSet(value) {
  29697. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29698. }
  29699. /**
  29700. * Checks if `value` is less than `other`.
  29701. *
  29702. * @static
  29703. * @memberOf _
  29704. * @since 3.9.0
  29705. * @category Lang
  29706. * @param {*} value The value to compare.
  29707. * @param {*} other The other value to compare.
  29708. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29709. * else `false`.
  29710. * @see _.gt
  29711. * @example
  29712. *
  29713. * _.lt(1, 3);
  29714. * // => true
  29715. *
  29716. * _.lt(3, 3);
  29717. * // => false
  29718. *
  29719. * _.lt(3, 1);
  29720. * // => false
  29721. */
  29722. var lt = createRelationalOperation(baseLt);
  29723. /**
  29724. * Checks if `value` is less than or equal to `other`.
  29725. *
  29726. * @static
  29727. * @memberOf _
  29728. * @since 3.9.0
  29729. * @category Lang
  29730. * @param {*} value The value to compare.
  29731. * @param {*} other The other value to compare.
  29732. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29733. * `other`, else `false`.
  29734. * @see _.gte
  29735. * @example
  29736. *
  29737. * _.lte(1, 3);
  29738. * // => true
  29739. *
  29740. * _.lte(3, 3);
  29741. * // => true
  29742. *
  29743. * _.lte(3, 1);
  29744. * // => false
  29745. */
  29746. var lte = createRelationalOperation(function(value, other) {
  29747. return value <= other;
  29748. });
  29749. /**
  29750. * Converts `value` to an array.
  29751. *
  29752. * @static
  29753. * @since 0.1.0
  29754. * @memberOf _
  29755. * @category Lang
  29756. * @param {*} value The value to convert.
  29757. * @returns {Array} Returns the converted array.
  29758. * @example
  29759. *
  29760. * _.toArray({ 'a': 1, 'b': 2 });
  29761. * // => [1, 2]
  29762. *
  29763. * _.toArray('abc');
  29764. * // => ['a', 'b', 'c']
  29765. *
  29766. * _.toArray(1);
  29767. * // => []
  29768. *
  29769. * _.toArray(null);
  29770. * // => []
  29771. */
  29772. function toArray(value) {
  29773. if (!value) {
  29774. return [];
  29775. }
  29776. if (isArrayLike(value)) {
  29777. return isString(value) ? stringToArray(value) : copyArray(value);
  29778. }
  29779. if (symIterator && value[symIterator]) {
  29780. return iteratorToArray(value[symIterator]());
  29781. }
  29782. var tag = getTag(value),
  29783. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29784. return func(value);
  29785. }
  29786. /**
  29787. * Converts `value` to a finite number.
  29788. *
  29789. * @static
  29790. * @memberOf _
  29791. * @since 4.12.0
  29792. * @category Lang
  29793. * @param {*} value The value to convert.
  29794. * @returns {number} Returns the converted number.
  29795. * @example
  29796. *
  29797. * _.toFinite(3.2);
  29798. * // => 3.2
  29799. *
  29800. * _.toFinite(Number.MIN_VALUE);
  29801. * // => 5e-324
  29802. *
  29803. * _.toFinite(Infinity);
  29804. * // => 1.7976931348623157e+308
  29805. *
  29806. * _.toFinite('3.2');
  29807. * // => 3.2
  29808. */
  29809. function toFinite(value) {
  29810. if (!value) {
  29811. return value === 0 ? value : 0;
  29812. }
  29813. value = toNumber(value);
  29814. if (value === INFINITY || value === -INFINITY) {
  29815. var sign = (value < 0 ? -1 : 1);
  29816. return sign * MAX_INTEGER;
  29817. }
  29818. return value === value ? value : 0;
  29819. }
  29820. /**
  29821. * Converts `value` to an integer.
  29822. *
  29823. * **Note:** This method is loosely based on
  29824. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29825. *
  29826. * @static
  29827. * @memberOf _
  29828. * @since 4.0.0
  29829. * @category Lang
  29830. * @param {*} value The value to convert.
  29831. * @returns {number} Returns the converted integer.
  29832. * @example
  29833. *
  29834. * _.toInteger(3.2);
  29835. * // => 3
  29836. *
  29837. * _.toInteger(Number.MIN_VALUE);
  29838. * // => 0
  29839. *
  29840. * _.toInteger(Infinity);
  29841. * // => 1.7976931348623157e+308
  29842. *
  29843. * _.toInteger('3.2');
  29844. * // => 3
  29845. */
  29846. function toInteger(value) {
  29847. var result = toFinite(value),
  29848. remainder = result % 1;
  29849. return result === result ? (remainder ? result - remainder : result) : 0;
  29850. }
  29851. /**
  29852. * Converts `value` to an integer suitable for use as the length of an
  29853. * array-like object.
  29854. *
  29855. * **Note:** This method is based on
  29856. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29857. *
  29858. * @static
  29859. * @memberOf _
  29860. * @since 4.0.0
  29861. * @category Lang
  29862. * @param {*} value The value to convert.
  29863. * @returns {number} Returns the converted integer.
  29864. * @example
  29865. *
  29866. * _.toLength(3.2);
  29867. * // => 3
  29868. *
  29869. * _.toLength(Number.MIN_VALUE);
  29870. * // => 0
  29871. *
  29872. * _.toLength(Infinity);
  29873. * // => 4294967295
  29874. *
  29875. * _.toLength('3.2');
  29876. * // => 3
  29877. */
  29878. function toLength(value) {
  29879. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29880. }
  29881. /**
  29882. * Converts `value` to a number.
  29883. *
  29884. * @static
  29885. * @memberOf _
  29886. * @since 4.0.0
  29887. * @category Lang
  29888. * @param {*} value The value to process.
  29889. * @returns {number} Returns the number.
  29890. * @example
  29891. *
  29892. * _.toNumber(3.2);
  29893. * // => 3.2
  29894. *
  29895. * _.toNumber(Number.MIN_VALUE);
  29896. * // => 5e-324
  29897. *
  29898. * _.toNumber(Infinity);
  29899. * // => Infinity
  29900. *
  29901. * _.toNumber('3.2');
  29902. * // => 3.2
  29903. */
  29904. function toNumber(value) {
  29905. if (typeof value == 'number') {
  29906. return value;
  29907. }
  29908. if (isSymbol(value)) {
  29909. return NAN;
  29910. }
  29911. if (isObject(value)) {
  29912. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29913. value = isObject(other) ? (other + '') : other;
  29914. }
  29915. if (typeof value != 'string') {
  29916. return value === 0 ? value : +value;
  29917. }
  29918. value = value.replace(reTrim, '');
  29919. var isBinary = reIsBinary.test(value);
  29920. return (isBinary || reIsOctal.test(value))
  29921. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29922. : (reIsBadHex.test(value) ? NAN : +value);
  29923. }
  29924. /**
  29925. * Converts `value` to a plain object flattening inherited enumerable string
  29926. * keyed properties of `value` to own properties of the plain object.
  29927. *
  29928. * @static
  29929. * @memberOf _
  29930. * @since 3.0.0
  29931. * @category Lang
  29932. * @param {*} value The value to convert.
  29933. * @returns {Object} Returns the converted plain object.
  29934. * @example
  29935. *
  29936. * function Foo() {
  29937. * this.b = 2;
  29938. * }
  29939. *
  29940. * Foo.prototype.c = 3;
  29941. *
  29942. * _.assign({ 'a': 1 }, new Foo);
  29943. * // => { 'a': 1, 'b': 2 }
  29944. *
  29945. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29946. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29947. */
  29948. function toPlainObject(value) {
  29949. return copyObject(value, keysIn(value));
  29950. }
  29951. /**
  29952. * Converts `value` to a safe integer. A safe integer can be compared and
  29953. * represented correctly.
  29954. *
  29955. * @static
  29956. * @memberOf _
  29957. * @since 4.0.0
  29958. * @category Lang
  29959. * @param {*} value The value to convert.
  29960. * @returns {number} Returns the converted integer.
  29961. * @example
  29962. *
  29963. * _.toSafeInteger(3.2);
  29964. * // => 3
  29965. *
  29966. * _.toSafeInteger(Number.MIN_VALUE);
  29967. * // => 0
  29968. *
  29969. * _.toSafeInteger(Infinity);
  29970. * // => 9007199254740991
  29971. *
  29972. * _.toSafeInteger('3.2');
  29973. * // => 3
  29974. */
  29975. function toSafeInteger(value) {
  29976. return value
  29977. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29978. : (value === 0 ? value : 0);
  29979. }
  29980. /**
  29981. * Converts `value` to a string. An empty string is returned for `null`
  29982. * and `undefined` values. The sign of `-0` is preserved.
  29983. *
  29984. * @static
  29985. * @memberOf _
  29986. * @since 4.0.0
  29987. * @category Lang
  29988. * @param {*} value The value to convert.
  29989. * @returns {string} Returns the converted string.
  29990. * @example
  29991. *
  29992. * _.toString(null);
  29993. * // => ''
  29994. *
  29995. * _.toString(-0);
  29996. * // => '-0'
  29997. *
  29998. * _.toString([1, 2, 3]);
  29999. * // => '1,2,3'
  30000. */
  30001. function toString(value) {
  30002. return value == null ? '' : baseToString(value);
  30003. }
  30004. /*------------------------------------------------------------------------*/
  30005. /**
  30006. * Assigns own enumerable string keyed properties of source objects to the
  30007. * destination object. Source objects are applied from left to right.
  30008. * Subsequent sources overwrite property assignments of previous sources.
  30009. *
  30010. * **Note:** This method mutates `object` and is loosely based on
  30011. * [`Object.assign`](https://mdn.io/Object/assign).
  30012. *
  30013. * @static
  30014. * @memberOf _
  30015. * @since 0.10.0
  30016. * @category Object
  30017. * @param {Object} object The destination object.
  30018. * @param {...Object} [sources] The source objects.
  30019. * @returns {Object} Returns `object`.
  30020. * @see _.assignIn
  30021. * @example
  30022. *
  30023. * function Foo() {
  30024. * this.a = 1;
  30025. * }
  30026. *
  30027. * function Bar() {
  30028. * this.c = 3;
  30029. * }
  30030. *
  30031. * Foo.prototype.b = 2;
  30032. * Bar.prototype.d = 4;
  30033. *
  30034. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30035. * // => { 'a': 1, 'c': 3 }
  30036. */
  30037. var assign = createAssigner(function(object, source) {
  30038. if (isPrototype(source) || isArrayLike(source)) {
  30039. copyObject(source, keys(source), object);
  30040. return;
  30041. }
  30042. for (var key in source) {
  30043. if (hasOwnProperty.call(source, key)) {
  30044. assignValue(object, key, source[key]);
  30045. }
  30046. }
  30047. });
  30048. /**
  30049. * This method is like `_.assign` except that it iterates over own and
  30050. * inherited source properties.
  30051. *
  30052. * **Note:** This method mutates `object`.
  30053. *
  30054. * @static
  30055. * @memberOf _
  30056. * @since 4.0.0
  30057. * @alias extend
  30058. * @category Object
  30059. * @param {Object} object The destination object.
  30060. * @param {...Object} [sources] The source objects.
  30061. * @returns {Object} Returns `object`.
  30062. * @see _.assign
  30063. * @example
  30064. *
  30065. * function Foo() {
  30066. * this.a = 1;
  30067. * }
  30068. *
  30069. * function Bar() {
  30070. * this.c = 3;
  30071. * }
  30072. *
  30073. * Foo.prototype.b = 2;
  30074. * Bar.prototype.d = 4;
  30075. *
  30076. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30077. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30078. */
  30079. var assignIn = createAssigner(function(object, source) {
  30080. copyObject(source, keysIn(source), object);
  30081. });
  30082. /**
  30083. * This method is like `_.assignIn` except that it accepts `customizer`
  30084. * which is invoked to produce the assigned values. If `customizer` returns
  30085. * `undefined`, assignment is handled by the method instead. The `customizer`
  30086. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30087. *
  30088. * **Note:** This method mutates `object`.
  30089. *
  30090. * @static
  30091. * @memberOf _
  30092. * @since 4.0.0
  30093. * @alias extendWith
  30094. * @category Object
  30095. * @param {Object} object The destination object.
  30096. * @param {...Object} sources The source objects.
  30097. * @param {Function} [customizer] The function to customize assigned values.
  30098. * @returns {Object} Returns `object`.
  30099. * @see _.assignWith
  30100. * @example
  30101. *
  30102. * function customizer(objValue, srcValue) {
  30103. * return _.isUndefined(objValue) ? srcValue : objValue;
  30104. * }
  30105. *
  30106. * var defaults = _.partialRight(_.assignInWith, customizer);
  30107. *
  30108. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30109. * // => { 'a': 1, 'b': 2 }
  30110. */
  30111. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30112. copyObject(source, keysIn(source), object, customizer);
  30113. });
  30114. /**
  30115. * This method is like `_.assign` except that it accepts `customizer`
  30116. * which is invoked to produce the assigned values. If `customizer` returns
  30117. * `undefined`, assignment is handled by the method instead. The `customizer`
  30118. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30119. *
  30120. * **Note:** This method mutates `object`.
  30121. *
  30122. * @static
  30123. * @memberOf _
  30124. * @since 4.0.0
  30125. * @category Object
  30126. * @param {Object} object The destination object.
  30127. * @param {...Object} sources The source objects.
  30128. * @param {Function} [customizer] The function to customize assigned values.
  30129. * @returns {Object} Returns `object`.
  30130. * @see _.assignInWith
  30131. * @example
  30132. *
  30133. * function customizer(objValue, srcValue) {
  30134. * return _.isUndefined(objValue) ? srcValue : objValue;
  30135. * }
  30136. *
  30137. * var defaults = _.partialRight(_.assignWith, customizer);
  30138. *
  30139. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30140. * // => { 'a': 1, 'b': 2 }
  30141. */
  30142. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30143. copyObject(source, keys(source), object, customizer);
  30144. });
  30145. /**
  30146. * Creates an array of values corresponding to `paths` of `object`.
  30147. *
  30148. * @static
  30149. * @memberOf _
  30150. * @since 1.0.0
  30151. * @category Object
  30152. * @param {Object} object The object to iterate over.
  30153. * @param {...(string|string[])} [paths] The property paths to pick.
  30154. * @returns {Array} Returns the picked values.
  30155. * @example
  30156. *
  30157. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30158. *
  30159. * _.at(object, ['a[0].b.c', 'a[1]']);
  30160. * // => [3, 4]
  30161. */
  30162. var at = flatRest(baseAt);
  30163. /**
  30164. * Creates an object that inherits from the `prototype` object. If a
  30165. * `properties` object is given, its own enumerable string keyed properties
  30166. * are assigned to the created object.
  30167. *
  30168. * @static
  30169. * @memberOf _
  30170. * @since 2.3.0
  30171. * @category Object
  30172. * @param {Object} prototype The object to inherit from.
  30173. * @param {Object} [properties] The properties to assign to the object.
  30174. * @returns {Object} Returns the new object.
  30175. * @example
  30176. *
  30177. * function Shape() {
  30178. * this.x = 0;
  30179. * this.y = 0;
  30180. * }
  30181. *
  30182. * function Circle() {
  30183. * Shape.call(this);
  30184. * }
  30185. *
  30186. * Circle.prototype = _.create(Shape.prototype, {
  30187. * 'constructor': Circle
  30188. * });
  30189. *
  30190. * var circle = new Circle;
  30191. * circle instanceof Circle;
  30192. * // => true
  30193. *
  30194. * circle instanceof Shape;
  30195. * // => true
  30196. */
  30197. function create(prototype, properties) {
  30198. var result = baseCreate(prototype);
  30199. return properties == null ? result : baseAssign(result, properties);
  30200. }
  30201. /**
  30202. * Assigns own and inherited enumerable string keyed properties of source
  30203. * objects to the destination object for all destination properties that
  30204. * resolve to `undefined`. Source objects are applied from left to right.
  30205. * Once a property is set, additional values of the same property are ignored.
  30206. *
  30207. * **Note:** This method mutates `object`.
  30208. *
  30209. * @static
  30210. * @since 0.1.0
  30211. * @memberOf _
  30212. * @category Object
  30213. * @param {Object} object The destination object.
  30214. * @param {...Object} [sources] The source objects.
  30215. * @returns {Object} Returns `object`.
  30216. * @see _.defaultsDeep
  30217. * @example
  30218. *
  30219. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30220. * // => { 'a': 1, 'b': 2 }
  30221. */
  30222. var defaults = baseRest(function(object, sources) {
  30223. object = Object(object);
  30224. var index = -1;
  30225. var length = sources.length;
  30226. var guard = length > 2 ? sources[2] : undefined;
  30227. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30228. length = 1;
  30229. }
  30230. while (++index < length) {
  30231. var source = sources[index];
  30232. var props = keysIn(source);
  30233. var propsIndex = -1;
  30234. var propsLength = props.length;
  30235. while (++propsIndex < propsLength) {
  30236. var key = props[propsIndex];
  30237. var value = object[key];
  30238. if (value === undefined ||
  30239. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30240. object[key] = source[key];
  30241. }
  30242. }
  30243. }
  30244. return object;
  30245. });
  30246. /**
  30247. * This method is like `_.defaults` except that it recursively assigns
  30248. * default properties.
  30249. *
  30250. * **Note:** This method mutates `object`.
  30251. *
  30252. * @static
  30253. * @memberOf _
  30254. * @since 3.10.0
  30255. * @category Object
  30256. * @param {Object} object The destination object.
  30257. * @param {...Object} [sources] The source objects.
  30258. * @returns {Object} Returns `object`.
  30259. * @see _.defaults
  30260. * @example
  30261. *
  30262. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30263. * // => { 'a': { 'b': 2, 'c': 3 } }
  30264. */
  30265. var defaultsDeep = baseRest(function(args) {
  30266. args.push(undefined, customDefaultsMerge);
  30267. return apply(mergeWith, undefined, args);
  30268. });
  30269. /**
  30270. * This method is like `_.find` except that it returns the key of the first
  30271. * element `predicate` returns truthy for instead of the element itself.
  30272. *
  30273. * @static
  30274. * @memberOf _
  30275. * @since 1.1.0
  30276. * @category Object
  30277. * @param {Object} object The object to inspect.
  30278. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30279. * @returns {string|undefined} Returns the key of the matched element,
  30280. * else `undefined`.
  30281. * @example
  30282. *
  30283. * var users = {
  30284. * 'barney': { 'age': 36, 'active': true },
  30285. * 'fred': { 'age': 40, 'active': false },
  30286. * 'pebbles': { 'age': 1, 'active': true }
  30287. * };
  30288. *
  30289. * _.findKey(users, function(o) { return o.age < 40; });
  30290. * // => 'barney' (iteration order is not guaranteed)
  30291. *
  30292. * // The `_.matches` iteratee shorthand.
  30293. * _.findKey(users, { 'age': 1, 'active': true });
  30294. * // => 'pebbles'
  30295. *
  30296. * // The `_.matchesProperty` iteratee shorthand.
  30297. * _.findKey(users, ['active', false]);
  30298. * // => 'fred'
  30299. *
  30300. * // The `_.property` iteratee shorthand.
  30301. * _.findKey(users, 'active');
  30302. * // => 'barney'
  30303. */
  30304. function findKey(object, predicate) {
  30305. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30306. }
  30307. /**
  30308. * This method is like `_.findKey` except that it iterates over elements of
  30309. * a collection in the opposite order.
  30310. *
  30311. * @static
  30312. * @memberOf _
  30313. * @since 2.0.0
  30314. * @category Object
  30315. * @param {Object} object The object to inspect.
  30316. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30317. * @returns {string|undefined} Returns the key of the matched element,
  30318. * else `undefined`.
  30319. * @example
  30320. *
  30321. * var users = {
  30322. * 'barney': { 'age': 36, 'active': true },
  30323. * 'fred': { 'age': 40, 'active': false },
  30324. * 'pebbles': { 'age': 1, 'active': true }
  30325. * };
  30326. *
  30327. * _.findLastKey(users, function(o) { return o.age < 40; });
  30328. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30329. *
  30330. * // The `_.matches` iteratee shorthand.
  30331. * _.findLastKey(users, { 'age': 36, 'active': true });
  30332. * // => 'barney'
  30333. *
  30334. * // The `_.matchesProperty` iteratee shorthand.
  30335. * _.findLastKey(users, ['active', false]);
  30336. * // => 'fred'
  30337. *
  30338. * // The `_.property` iteratee shorthand.
  30339. * _.findLastKey(users, 'active');
  30340. * // => 'pebbles'
  30341. */
  30342. function findLastKey(object, predicate) {
  30343. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30344. }
  30345. /**
  30346. * Iterates over own and inherited enumerable string keyed properties of an
  30347. * object and invokes `iteratee` for each property. The iteratee is invoked
  30348. * with three arguments: (value, key, object). Iteratee functions may exit
  30349. * iteration early by explicitly returning `false`.
  30350. *
  30351. * @static
  30352. * @memberOf _
  30353. * @since 0.3.0
  30354. * @category Object
  30355. * @param {Object} object The object to iterate over.
  30356. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30357. * @returns {Object} Returns `object`.
  30358. * @see _.forInRight
  30359. * @example
  30360. *
  30361. * function Foo() {
  30362. * this.a = 1;
  30363. * this.b = 2;
  30364. * }
  30365. *
  30366. * Foo.prototype.c = 3;
  30367. *
  30368. * _.forIn(new Foo, function(value, key) {
  30369. * console.log(key);
  30370. * });
  30371. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30372. */
  30373. function forIn(object, iteratee) {
  30374. return object == null
  30375. ? object
  30376. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30377. }
  30378. /**
  30379. * This method is like `_.forIn` except that it iterates over properties of
  30380. * `object` in the opposite order.
  30381. *
  30382. * @static
  30383. * @memberOf _
  30384. * @since 2.0.0
  30385. * @category Object
  30386. * @param {Object} object The object to iterate over.
  30387. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30388. * @returns {Object} Returns `object`.
  30389. * @see _.forIn
  30390. * @example
  30391. *
  30392. * function Foo() {
  30393. * this.a = 1;
  30394. * this.b = 2;
  30395. * }
  30396. *
  30397. * Foo.prototype.c = 3;
  30398. *
  30399. * _.forInRight(new Foo, function(value, key) {
  30400. * console.log(key);
  30401. * });
  30402. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30403. */
  30404. function forInRight(object, iteratee) {
  30405. return object == null
  30406. ? object
  30407. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30408. }
  30409. /**
  30410. * Iterates over own enumerable string keyed properties of an object and
  30411. * invokes `iteratee` for each property. The iteratee is invoked with three
  30412. * arguments: (value, key, object). Iteratee functions may exit iteration
  30413. * early by explicitly returning `false`.
  30414. *
  30415. * @static
  30416. * @memberOf _
  30417. * @since 0.3.0
  30418. * @category Object
  30419. * @param {Object} object The object to iterate over.
  30420. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30421. * @returns {Object} Returns `object`.
  30422. * @see _.forOwnRight
  30423. * @example
  30424. *
  30425. * function Foo() {
  30426. * this.a = 1;
  30427. * this.b = 2;
  30428. * }
  30429. *
  30430. * Foo.prototype.c = 3;
  30431. *
  30432. * _.forOwn(new Foo, function(value, key) {
  30433. * console.log(key);
  30434. * });
  30435. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30436. */
  30437. function forOwn(object, iteratee) {
  30438. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30439. }
  30440. /**
  30441. * This method is like `_.forOwn` except that it iterates over properties of
  30442. * `object` in the opposite order.
  30443. *
  30444. * @static
  30445. * @memberOf _
  30446. * @since 2.0.0
  30447. * @category Object
  30448. * @param {Object} object The object to iterate over.
  30449. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30450. * @returns {Object} Returns `object`.
  30451. * @see _.forOwn
  30452. * @example
  30453. *
  30454. * function Foo() {
  30455. * this.a = 1;
  30456. * this.b = 2;
  30457. * }
  30458. *
  30459. * Foo.prototype.c = 3;
  30460. *
  30461. * _.forOwnRight(new Foo, function(value, key) {
  30462. * console.log(key);
  30463. * });
  30464. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30465. */
  30466. function forOwnRight(object, iteratee) {
  30467. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30468. }
  30469. /**
  30470. * Creates an array of function property names from own enumerable properties
  30471. * of `object`.
  30472. *
  30473. * @static
  30474. * @since 0.1.0
  30475. * @memberOf _
  30476. * @category Object
  30477. * @param {Object} object The object to inspect.
  30478. * @returns {Array} Returns the function names.
  30479. * @see _.functionsIn
  30480. * @example
  30481. *
  30482. * function Foo() {
  30483. * this.a = _.constant('a');
  30484. * this.b = _.constant('b');
  30485. * }
  30486. *
  30487. * Foo.prototype.c = _.constant('c');
  30488. *
  30489. * _.functions(new Foo);
  30490. * // => ['a', 'b']
  30491. */
  30492. function functions(object) {
  30493. return object == null ? [] : baseFunctions(object, keys(object));
  30494. }
  30495. /**
  30496. * Creates an array of function property names from own and inherited
  30497. * enumerable properties of `object`.
  30498. *
  30499. * @static
  30500. * @memberOf _
  30501. * @since 4.0.0
  30502. * @category Object
  30503. * @param {Object} object The object to inspect.
  30504. * @returns {Array} Returns the function names.
  30505. * @see _.functions
  30506. * @example
  30507. *
  30508. * function Foo() {
  30509. * this.a = _.constant('a');
  30510. * this.b = _.constant('b');
  30511. * }
  30512. *
  30513. * Foo.prototype.c = _.constant('c');
  30514. *
  30515. * _.functionsIn(new Foo);
  30516. * // => ['a', 'b', 'c']
  30517. */
  30518. function functionsIn(object) {
  30519. return object == null ? [] : baseFunctions(object, keysIn(object));
  30520. }
  30521. /**
  30522. * Gets the value at `path` of `object`. If the resolved value is
  30523. * `undefined`, the `defaultValue` is returned in its place.
  30524. *
  30525. * @static
  30526. * @memberOf _
  30527. * @since 3.7.0
  30528. * @category Object
  30529. * @param {Object} object The object to query.
  30530. * @param {Array|string} path The path of the property to get.
  30531. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30532. * @returns {*} Returns the resolved value.
  30533. * @example
  30534. *
  30535. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30536. *
  30537. * _.get(object, 'a[0].b.c');
  30538. * // => 3
  30539. *
  30540. * _.get(object, ['a', '0', 'b', 'c']);
  30541. * // => 3
  30542. *
  30543. * _.get(object, 'a.b.c', 'default');
  30544. * // => 'default'
  30545. */
  30546. function get(object, path, defaultValue) {
  30547. var result = object == null ? undefined : baseGet(object, path);
  30548. return result === undefined ? defaultValue : result;
  30549. }
  30550. /**
  30551. * Checks if `path` is a direct property of `object`.
  30552. *
  30553. * @static
  30554. * @since 0.1.0
  30555. * @memberOf _
  30556. * @category Object
  30557. * @param {Object} object The object to query.
  30558. * @param {Array|string} path The path to check.
  30559. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30560. * @example
  30561. *
  30562. * var object = { 'a': { 'b': 2 } };
  30563. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30564. *
  30565. * _.has(object, 'a');
  30566. * // => true
  30567. *
  30568. * _.has(object, 'a.b');
  30569. * // => true
  30570. *
  30571. * _.has(object, ['a', 'b']);
  30572. * // => true
  30573. *
  30574. * _.has(other, 'a');
  30575. * // => false
  30576. */
  30577. function has(object, path) {
  30578. return object != null && hasPath(object, path, baseHas);
  30579. }
  30580. /**
  30581. * Checks if `path` is a direct or inherited property of `object`.
  30582. *
  30583. * @static
  30584. * @memberOf _
  30585. * @since 4.0.0
  30586. * @category Object
  30587. * @param {Object} object The object to query.
  30588. * @param {Array|string} path The path to check.
  30589. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30590. * @example
  30591. *
  30592. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30593. *
  30594. * _.hasIn(object, 'a');
  30595. * // => true
  30596. *
  30597. * _.hasIn(object, 'a.b');
  30598. * // => true
  30599. *
  30600. * _.hasIn(object, ['a', 'b']);
  30601. * // => true
  30602. *
  30603. * _.hasIn(object, 'b');
  30604. * // => false
  30605. */
  30606. function hasIn(object, path) {
  30607. return object != null && hasPath(object, path, baseHasIn);
  30608. }
  30609. /**
  30610. * Creates an object composed of the inverted keys and values of `object`.
  30611. * If `object` contains duplicate values, subsequent values overwrite
  30612. * property assignments of previous values.
  30613. *
  30614. * @static
  30615. * @memberOf _
  30616. * @since 0.7.0
  30617. * @category Object
  30618. * @param {Object} object The object to invert.
  30619. * @returns {Object} Returns the new inverted object.
  30620. * @example
  30621. *
  30622. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30623. *
  30624. * _.invert(object);
  30625. * // => { '1': 'c', '2': 'b' }
  30626. */
  30627. var invert = createInverter(function(result, value, key) {
  30628. if (value != null &&
  30629. typeof value.toString != 'function') {
  30630. value = nativeObjectToString.call(value);
  30631. }
  30632. result[value] = key;
  30633. }, constant(identity));
  30634. /**
  30635. * This method is like `_.invert` except that the inverted object is generated
  30636. * from the results of running each element of `object` thru `iteratee`. The
  30637. * corresponding inverted value of each inverted key is an array of keys
  30638. * responsible for generating the inverted value. The iteratee is invoked
  30639. * with one argument: (value).
  30640. *
  30641. * @static
  30642. * @memberOf _
  30643. * @since 4.1.0
  30644. * @category Object
  30645. * @param {Object} object The object to invert.
  30646. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30647. * @returns {Object} Returns the new inverted object.
  30648. * @example
  30649. *
  30650. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30651. *
  30652. * _.invertBy(object);
  30653. * // => { '1': ['a', 'c'], '2': ['b'] }
  30654. *
  30655. * _.invertBy(object, function(value) {
  30656. * return 'group' + value;
  30657. * });
  30658. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30659. */
  30660. var invertBy = createInverter(function(result, value, key) {
  30661. if (value != null &&
  30662. typeof value.toString != 'function') {
  30663. value = nativeObjectToString.call(value);
  30664. }
  30665. if (hasOwnProperty.call(result, value)) {
  30666. result[value].push(key);
  30667. } else {
  30668. result[value] = [key];
  30669. }
  30670. }, getIteratee);
  30671. /**
  30672. * Invokes the method at `path` of `object`.
  30673. *
  30674. * @static
  30675. * @memberOf _
  30676. * @since 4.0.0
  30677. * @category Object
  30678. * @param {Object} object The object to query.
  30679. * @param {Array|string} path The path of the method to invoke.
  30680. * @param {...*} [args] The arguments to invoke the method with.
  30681. * @returns {*} Returns the result of the invoked method.
  30682. * @example
  30683. *
  30684. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30685. *
  30686. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30687. * // => [2, 3]
  30688. */
  30689. var invoke = baseRest(baseInvoke);
  30690. /**
  30691. * Creates an array of the own enumerable property names of `object`.
  30692. *
  30693. * **Note:** Non-object values are coerced to objects. See the
  30694. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30695. * for more details.
  30696. *
  30697. * @static
  30698. * @since 0.1.0
  30699. * @memberOf _
  30700. * @category Object
  30701. * @param {Object} object The object to query.
  30702. * @returns {Array} Returns the array of property names.
  30703. * @example
  30704. *
  30705. * function Foo() {
  30706. * this.a = 1;
  30707. * this.b = 2;
  30708. * }
  30709. *
  30710. * Foo.prototype.c = 3;
  30711. *
  30712. * _.keys(new Foo);
  30713. * // => ['a', 'b'] (iteration order is not guaranteed)
  30714. *
  30715. * _.keys('hi');
  30716. * // => ['0', '1']
  30717. */
  30718. function keys(object) {
  30719. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30720. }
  30721. /**
  30722. * Creates an array of the own and inherited enumerable property names of `object`.
  30723. *
  30724. * **Note:** Non-object values are coerced to objects.
  30725. *
  30726. * @static
  30727. * @memberOf _
  30728. * @since 3.0.0
  30729. * @category Object
  30730. * @param {Object} object The object to query.
  30731. * @returns {Array} Returns the array of property names.
  30732. * @example
  30733. *
  30734. * function Foo() {
  30735. * this.a = 1;
  30736. * this.b = 2;
  30737. * }
  30738. *
  30739. * Foo.prototype.c = 3;
  30740. *
  30741. * _.keysIn(new Foo);
  30742. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30743. */
  30744. function keysIn(object) {
  30745. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30746. }
  30747. /**
  30748. * The opposite of `_.mapValues`; this method creates an object with the
  30749. * same values as `object` and keys generated by running each own enumerable
  30750. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30751. * with three arguments: (value, key, object).
  30752. *
  30753. * @static
  30754. * @memberOf _
  30755. * @since 3.8.0
  30756. * @category Object
  30757. * @param {Object} object The object to iterate over.
  30758. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30759. * @returns {Object} Returns the new mapped object.
  30760. * @see _.mapValues
  30761. * @example
  30762. *
  30763. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30764. * return key + value;
  30765. * });
  30766. * // => { 'a1': 1, 'b2': 2 }
  30767. */
  30768. function mapKeys(object, iteratee) {
  30769. var result = {};
  30770. iteratee = getIteratee(iteratee, 3);
  30771. baseForOwn(object, function(value, key, object) {
  30772. baseAssignValue(result, iteratee(value, key, object), value);
  30773. });
  30774. return result;
  30775. }
  30776. /**
  30777. * Creates an object with the same keys as `object` and values generated
  30778. * by running each own enumerable string keyed property of `object` thru
  30779. * `iteratee`. The iteratee is invoked with three arguments:
  30780. * (value, key, object).
  30781. *
  30782. * @static
  30783. * @memberOf _
  30784. * @since 2.4.0
  30785. * @category Object
  30786. * @param {Object} object The object to iterate over.
  30787. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30788. * @returns {Object} Returns the new mapped object.
  30789. * @see _.mapKeys
  30790. * @example
  30791. *
  30792. * var users = {
  30793. * 'fred': { 'user': 'fred', 'age': 40 },
  30794. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30795. * };
  30796. *
  30797. * _.mapValues(users, function(o) { return o.age; });
  30798. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30799. *
  30800. * // The `_.property` iteratee shorthand.
  30801. * _.mapValues(users, 'age');
  30802. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30803. */
  30804. function mapValues(object, iteratee) {
  30805. var result = {};
  30806. iteratee = getIteratee(iteratee, 3);
  30807. baseForOwn(object, function(value, key, object) {
  30808. baseAssignValue(result, key, iteratee(value, key, object));
  30809. });
  30810. return result;
  30811. }
  30812. /**
  30813. * This method is like `_.assign` except that it recursively merges own and
  30814. * inherited enumerable string keyed properties of source objects into the
  30815. * destination object. Source properties that resolve to `undefined` are
  30816. * skipped if a destination value exists. Array and plain object properties
  30817. * are merged recursively. Other objects and value types are overridden by
  30818. * assignment. Source objects are applied from left to right. Subsequent
  30819. * sources overwrite property assignments of previous sources.
  30820. *
  30821. * **Note:** This method mutates `object`.
  30822. *
  30823. * @static
  30824. * @memberOf _
  30825. * @since 0.5.0
  30826. * @category Object
  30827. * @param {Object} object The destination object.
  30828. * @param {...Object} [sources] The source objects.
  30829. * @returns {Object} Returns `object`.
  30830. * @example
  30831. *
  30832. * var object = {
  30833. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30834. * };
  30835. *
  30836. * var other = {
  30837. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30838. * };
  30839. *
  30840. * _.merge(object, other);
  30841. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30842. */
  30843. var merge = createAssigner(function(object, source, srcIndex) {
  30844. baseMerge(object, source, srcIndex);
  30845. });
  30846. /**
  30847. * This method is like `_.merge` except that it accepts `customizer` which
  30848. * is invoked to produce the merged values of the destination and source
  30849. * properties. If `customizer` returns `undefined`, merging is handled by the
  30850. * method instead. The `customizer` is invoked with six arguments:
  30851. * (objValue, srcValue, key, object, source, stack).
  30852. *
  30853. * **Note:** This method mutates `object`.
  30854. *
  30855. * @static
  30856. * @memberOf _
  30857. * @since 4.0.0
  30858. * @category Object
  30859. * @param {Object} object The destination object.
  30860. * @param {...Object} sources The source objects.
  30861. * @param {Function} customizer The function to customize assigned values.
  30862. * @returns {Object} Returns `object`.
  30863. * @example
  30864. *
  30865. * function customizer(objValue, srcValue) {
  30866. * if (_.isArray(objValue)) {
  30867. * return objValue.concat(srcValue);
  30868. * }
  30869. * }
  30870. *
  30871. * var object = { 'a': [1], 'b': [2] };
  30872. * var other = { 'a': [3], 'b': [4] };
  30873. *
  30874. * _.mergeWith(object, other, customizer);
  30875. * // => { 'a': [1, 3], 'b': [2, 4] }
  30876. */
  30877. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30878. baseMerge(object, source, srcIndex, customizer);
  30879. });
  30880. /**
  30881. * The opposite of `_.pick`; this method creates an object composed of the
  30882. * own and inherited enumerable property paths of `object` that are not omitted.
  30883. *
  30884. * **Note:** This method is considerably slower than `_.pick`.
  30885. *
  30886. * @static
  30887. * @since 0.1.0
  30888. * @memberOf _
  30889. * @category Object
  30890. * @param {Object} object The source object.
  30891. * @param {...(string|string[])} [paths] The property paths to omit.
  30892. * @returns {Object} Returns the new object.
  30893. * @example
  30894. *
  30895. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30896. *
  30897. * _.omit(object, ['a', 'c']);
  30898. * // => { 'b': '2' }
  30899. */
  30900. var omit = flatRest(function(object, paths) {
  30901. var result = {};
  30902. if (object == null) {
  30903. return result;
  30904. }
  30905. var isDeep = false;
  30906. paths = arrayMap(paths, function(path) {
  30907. path = castPath(path, object);
  30908. isDeep || (isDeep = path.length > 1);
  30909. return path;
  30910. });
  30911. copyObject(object, getAllKeysIn(object), result);
  30912. if (isDeep) {
  30913. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30914. }
  30915. var length = paths.length;
  30916. while (length--) {
  30917. baseUnset(result, paths[length]);
  30918. }
  30919. return result;
  30920. });
  30921. /**
  30922. * The opposite of `_.pickBy`; this method creates an object composed of
  30923. * the own and inherited enumerable string keyed properties of `object` that
  30924. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30925. * arguments: (value, key).
  30926. *
  30927. * @static
  30928. * @memberOf _
  30929. * @since 4.0.0
  30930. * @category Object
  30931. * @param {Object} object The source object.
  30932. * @param {Function} [predicate=_.identity] The function invoked per property.
  30933. * @returns {Object} Returns the new object.
  30934. * @example
  30935. *
  30936. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30937. *
  30938. * _.omitBy(object, _.isNumber);
  30939. * // => { 'b': '2' }
  30940. */
  30941. function omitBy(object, predicate) {
  30942. return pickBy(object, negate(getIteratee(predicate)));
  30943. }
  30944. /**
  30945. * Creates an object composed of the picked `object` properties.
  30946. *
  30947. * @static
  30948. * @since 0.1.0
  30949. * @memberOf _
  30950. * @category Object
  30951. * @param {Object} object The source object.
  30952. * @param {...(string|string[])} [paths] The property paths to pick.
  30953. * @returns {Object} Returns the new object.
  30954. * @example
  30955. *
  30956. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30957. *
  30958. * _.pick(object, ['a', 'c']);
  30959. * // => { 'a': 1, 'c': 3 }
  30960. */
  30961. var pick = flatRest(function(object, paths) {
  30962. return object == null ? {} : basePick(object, paths);
  30963. });
  30964. /**
  30965. * Creates an object composed of the `object` properties `predicate` returns
  30966. * truthy for. The predicate is invoked with two arguments: (value, key).
  30967. *
  30968. * @static
  30969. * @memberOf _
  30970. * @since 4.0.0
  30971. * @category Object
  30972. * @param {Object} object The source object.
  30973. * @param {Function} [predicate=_.identity] The function invoked per property.
  30974. * @returns {Object} Returns the new object.
  30975. * @example
  30976. *
  30977. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30978. *
  30979. * _.pickBy(object, _.isNumber);
  30980. * // => { 'a': 1, 'c': 3 }
  30981. */
  30982. function pickBy(object, predicate) {
  30983. if (object == null) {
  30984. return {};
  30985. }
  30986. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30987. return [prop];
  30988. });
  30989. predicate = getIteratee(predicate);
  30990. return basePickBy(object, props, function(value, path) {
  30991. return predicate(value, path[0]);
  30992. });
  30993. }
  30994. /**
  30995. * This method is like `_.get` except that if the resolved value is a
  30996. * function it's invoked with the `this` binding of its parent object and
  30997. * its result is returned.
  30998. *
  30999. * @static
  31000. * @since 0.1.0
  31001. * @memberOf _
  31002. * @category Object
  31003. * @param {Object} object The object to query.
  31004. * @param {Array|string} path The path of the property to resolve.
  31005. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31006. * @returns {*} Returns the resolved value.
  31007. * @example
  31008. *
  31009. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31010. *
  31011. * _.result(object, 'a[0].b.c1');
  31012. * // => 3
  31013. *
  31014. * _.result(object, 'a[0].b.c2');
  31015. * // => 4
  31016. *
  31017. * _.result(object, 'a[0].b.c3', 'default');
  31018. * // => 'default'
  31019. *
  31020. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31021. * // => 'default'
  31022. */
  31023. function result(object, path, defaultValue) {
  31024. path = castPath(path, object);
  31025. var index = -1,
  31026. length = path.length;
  31027. // Ensure the loop is entered when path is empty.
  31028. if (!length) {
  31029. length = 1;
  31030. object = undefined;
  31031. }
  31032. while (++index < length) {
  31033. var value = object == null ? undefined : object[toKey(path[index])];
  31034. if (value === undefined) {
  31035. index = length;
  31036. value = defaultValue;
  31037. }
  31038. object = isFunction(value) ? value.call(object) : value;
  31039. }
  31040. return object;
  31041. }
  31042. /**
  31043. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31044. * it's created. Arrays are created for missing index properties while objects
  31045. * are created for all other missing properties. Use `_.setWith` to customize
  31046. * `path` creation.
  31047. *
  31048. * **Note:** This method mutates `object`.
  31049. *
  31050. * @static
  31051. * @memberOf _
  31052. * @since 3.7.0
  31053. * @category Object
  31054. * @param {Object} object The object to modify.
  31055. * @param {Array|string} path The path of the property to set.
  31056. * @param {*} value The value to set.
  31057. * @returns {Object} Returns `object`.
  31058. * @example
  31059. *
  31060. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31061. *
  31062. * _.set(object, 'a[0].b.c', 4);
  31063. * console.log(object.a[0].b.c);
  31064. * // => 4
  31065. *
  31066. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31067. * console.log(object.x[0].y.z);
  31068. * // => 5
  31069. */
  31070. function set(object, path, value) {
  31071. return object == null ? object : baseSet(object, path, value);
  31072. }
  31073. /**
  31074. * This method is like `_.set` except that it accepts `customizer` which is
  31075. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31076. * path creation is handled by the method instead. The `customizer` is invoked
  31077. * with three arguments: (nsValue, key, nsObject).
  31078. *
  31079. * **Note:** This method mutates `object`.
  31080. *
  31081. * @static
  31082. * @memberOf _
  31083. * @since 4.0.0
  31084. * @category Object
  31085. * @param {Object} object The object to modify.
  31086. * @param {Array|string} path The path of the property to set.
  31087. * @param {*} value The value to set.
  31088. * @param {Function} [customizer] The function to customize assigned values.
  31089. * @returns {Object} Returns `object`.
  31090. * @example
  31091. *
  31092. * var object = {};
  31093. *
  31094. * _.setWith(object, '[0][1]', 'a', Object);
  31095. * // => { '0': { '1': 'a' } }
  31096. */
  31097. function setWith(object, path, value, customizer) {
  31098. customizer = typeof customizer == 'function' ? customizer : undefined;
  31099. return object == null ? object : baseSet(object, path, value, customizer);
  31100. }
  31101. /**
  31102. * Creates an array of own enumerable string keyed-value pairs for `object`
  31103. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31104. * entries are returned.
  31105. *
  31106. * @static
  31107. * @memberOf _
  31108. * @since 4.0.0
  31109. * @alias entries
  31110. * @category Object
  31111. * @param {Object} object The object to query.
  31112. * @returns {Array} Returns the key-value pairs.
  31113. * @example
  31114. *
  31115. * function Foo() {
  31116. * this.a = 1;
  31117. * this.b = 2;
  31118. * }
  31119. *
  31120. * Foo.prototype.c = 3;
  31121. *
  31122. * _.toPairs(new Foo);
  31123. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31124. */
  31125. var toPairs = createToPairs(keys);
  31126. /**
  31127. * Creates an array of own and inherited enumerable string keyed-value pairs
  31128. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31129. * or set, its entries are returned.
  31130. *
  31131. * @static
  31132. * @memberOf _
  31133. * @since 4.0.0
  31134. * @alias entriesIn
  31135. * @category Object
  31136. * @param {Object} object The object to query.
  31137. * @returns {Array} Returns the key-value pairs.
  31138. * @example
  31139. *
  31140. * function Foo() {
  31141. * this.a = 1;
  31142. * this.b = 2;
  31143. * }
  31144. *
  31145. * Foo.prototype.c = 3;
  31146. *
  31147. * _.toPairsIn(new Foo);
  31148. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31149. */
  31150. var toPairsIn = createToPairs(keysIn);
  31151. /**
  31152. * An alternative to `_.reduce`; this method transforms `object` to a new
  31153. * `accumulator` object which is the result of running each of its own
  31154. * enumerable string keyed properties thru `iteratee`, with each invocation
  31155. * potentially mutating the `accumulator` object. If `accumulator` is not
  31156. * provided, a new object with the same `[[Prototype]]` will be used. The
  31157. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31158. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31159. *
  31160. * @static
  31161. * @memberOf _
  31162. * @since 1.3.0
  31163. * @category Object
  31164. * @param {Object} object The object to iterate over.
  31165. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31166. * @param {*} [accumulator] The custom accumulator value.
  31167. * @returns {*} Returns the accumulated value.
  31168. * @example
  31169. *
  31170. * _.transform([2, 3, 4], function(result, n) {
  31171. * result.push(n *= n);
  31172. * return n % 2 == 0;
  31173. * }, []);
  31174. * // => [4, 9]
  31175. *
  31176. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31177. * (result[value] || (result[value] = [])).push(key);
  31178. * }, {});
  31179. * // => { '1': ['a', 'c'], '2': ['b'] }
  31180. */
  31181. function transform(object, iteratee, accumulator) {
  31182. var isArr = isArray(object),
  31183. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31184. iteratee = getIteratee(iteratee, 4);
  31185. if (accumulator == null) {
  31186. var Ctor = object && object.constructor;
  31187. if (isArrLike) {
  31188. accumulator = isArr ? new Ctor : [];
  31189. }
  31190. else if (isObject(object)) {
  31191. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31192. }
  31193. else {
  31194. accumulator = {};
  31195. }
  31196. }
  31197. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31198. return iteratee(accumulator, value, index, object);
  31199. });
  31200. return accumulator;
  31201. }
  31202. /**
  31203. * Removes the property at `path` of `object`.
  31204. *
  31205. * **Note:** This method mutates `object`.
  31206. *
  31207. * @static
  31208. * @memberOf _
  31209. * @since 4.0.0
  31210. * @category Object
  31211. * @param {Object} object The object to modify.
  31212. * @param {Array|string} path The path of the property to unset.
  31213. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31214. * @example
  31215. *
  31216. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31217. * _.unset(object, 'a[0].b.c');
  31218. * // => true
  31219. *
  31220. * console.log(object);
  31221. * // => { 'a': [{ 'b': {} }] };
  31222. *
  31223. * _.unset(object, ['a', '0', 'b', 'c']);
  31224. * // => true
  31225. *
  31226. * console.log(object);
  31227. * // => { 'a': [{ 'b': {} }] };
  31228. */
  31229. function unset(object, path) {
  31230. return object == null ? true : baseUnset(object, path);
  31231. }
  31232. /**
  31233. * This method is like `_.set` except that accepts `updater` to produce the
  31234. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31235. * is invoked with one argument: (value).
  31236. *
  31237. * **Note:** This method mutates `object`.
  31238. *
  31239. * @static
  31240. * @memberOf _
  31241. * @since 4.6.0
  31242. * @category Object
  31243. * @param {Object} object The object to modify.
  31244. * @param {Array|string} path The path of the property to set.
  31245. * @param {Function} updater The function to produce the updated value.
  31246. * @returns {Object} Returns `object`.
  31247. * @example
  31248. *
  31249. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31250. *
  31251. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31252. * console.log(object.a[0].b.c);
  31253. * // => 9
  31254. *
  31255. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31256. * console.log(object.x[0].y.z);
  31257. * // => 0
  31258. */
  31259. function update(object, path, updater) {
  31260. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31261. }
  31262. /**
  31263. * This method is like `_.update` except that it accepts `customizer` which is
  31264. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31265. * path creation is handled by the method instead. The `customizer` is invoked
  31266. * with three arguments: (nsValue, key, nsObject).
  31267. *
  31268. * **Note:** This method mutates `object`.
  31269. *
  31270. * @static
  31271. * @memberOf _
  31272. * @since 4.6.0
  31273. * @category Object
  31274. * @param {Object} object The object to modify.
  31275. * @param {Array|string} path The path of the property to set.
  31276. * @param {Function} updater The function to produce the updated value.
  31277. * @param {Function} [customizer] The function to customize assigned values.
  31278. * @returns {Object} Returns `object`.
  31279. * @example
  31280. *
  31281. * var object = {};
  31282. *
  31283. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31284. * // => { '0': { '1': 'a' } }
  31285. */
  31286. function updateWith(object, path, updater, customizer) {
  31287. customizer = typeof customizer == 'function' ? customizer : undefined;
  31288. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31289. }
  31290. /**
  31291. * Creates an array of the own enumerable string keyed property values of `object`.
  31292. *
  31293. * **Note:** Non-object values are coerced to objects.
  31294. *
  31295. * @static
  31296. * @since 0.1.0
  31297. * @memberOf _
  31298. * @category Object
  31299. * @param {Object} object The object to query.
  31300. * @returns {Array} Returns the array of property values.
  31301. * @example
  31302. *
  31303. * function Foo() {
  31304. * this.a = 1;
  31305. * this.b = 2;
  31306. * }
  31307. *
  31308. * Foo.prototype.c = 3;
  31309. *
  31310. * _.values(new Foo);
  31311. * // => [1, 2] (iteration order is not guaranteed)
  31312. *
  31313. * _.values('hi');
  31314. * // => ['h', 'i']
  31315. */
  31316. function values(object) {
  31317. return object == null ? [] : baseValues(object, keys(object));
  31318. }
  31319. /**
  31320. * Creates an array of the own and inherited enumerable string keyed property
  31321. * values of `object`.
  31322. *
  31323. * **Note:** Non-object values are coerced to objects.
  31324. *
  31325. * @static
  31326. * @memberOf _
  31327. * @since 3.0.0
  31328. * @category Object
  31329. * @param {Object} object The object to query.
  31330. * @returns {Array} Returns the array of property values.
  31331. * @example
  31332. *
  31333. * function Foo() {
  31334. * this.a = 1;
  31335. * this.b = 2;
  31336. * }
  31337. *
  31338. * Foo.prototype.c = 3;
  31339. *
  31340. * _.valuesIn(new Foo);
  31341. * // => [1, 2, 3] (iteration order is not guaranteed)
  31342. */
  31343. function valuesIn(object) {
  31344. return object == null ? [] : baseValues(object, keysIn(object));
  31345. }
  31346. /*------------------------------------------------------------------------*/
  31347. /**
  31348. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31349. *
  31350. * @static
  31351. * @memberOf _
  31352. * @since 4.0.0
  31353. * @category Number
  31354. * @param {number} number The number to clamp.
  31355. * @param {number} [lower] The lower bound.
  31356. * @param {number} upper The upper bound.
  31357. * @returns {number} Returns the clamped number.
  31358. * @example
  31359. *
  31360. * _.clamp(-10, -5, 5);
  31361. * // => -5
  31362. *
  31363. * _.clamp(10, -5, 5);
  31364. * // => 5
  31365. */
  31366. function clamp(number, lower, upper) {
  31367. if (upper === undefined) {
  31368. upper = lower;
  31369. lower = undefined;
  31370. }
  31371. if (upper !== undefined) {
  31372. upper = toNumber(upper);
  31373. upper = upper === upper ? upper : 0;
  31374. }
  31375. if (lower !== undefined) {
  31376. lower = toNumber(lower);
  31377. lower = lower === lower ? lower : 0;
  31378. }
  31379. return baseClamp(toNumber(number), lower, upper);
  31380. }
  31381. /**
  31382. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31383. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31384. * If `start` is greater than `end` the params are swapped to support
  31385. * negative ranges.
  31386. *
  31387. * @static
  31388. * @memberOf _
  31389. * @since 3.3.0
  31390. * @category Number
  31391. * @param {number} number The number to check.
  31392. * @param {number} [start=0] The start of the range.
  31393. * @param {number} end The end of the range.
  31394. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31395. * @see _.range, _.rangeRight
  31396. * @example
  31397. *
  31398. * _.inRange(3, 2, 4);
  31399. * // => true
  31400. *
  31401. * _.inRange(4, 8);
  31402. * // => true
  31403. *
  31404. * _.inRange(4, 2);
  31405. * // => false
  31406. *
  31407. * _.inRange(2, 2);
  31408. * // => false
  31409. *
  31410. * _.inRange(1.2, 2);
  31411. * // => true
  31412. *
  31413. * _.inRange(5.2, 4);
  31414. * // => false
  31415. *
  31416. * _.inRange(-3, -2, -6);
  31417. * // => true
  31418. */
  31419. function inRange(number, start, end) {
  31420. start = toFinite(start);
  31421. if (end === undefined) {
  31422. end = start;
  31423. start = 0;
  31424. } else {
  31425. end = toFinite(end);
  31426. }
  31427. number = toNumber(number);
  31428. return baseInRange(number, start, end);
  31429. }
  31430. /**
  31431. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31432. * If only one argument is provided a number between `0` and the given number
  31433. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31434. * floats, a floating-point number is returned instead of an integer.
  31435. *
  31436. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31437. * floating-point values which can produce unexpected results.
  31438. *
  31439. * @static
  31440. * @memberOf _
  31441. * @since 0.7.0
  31442. * @category Number
  31443. * @param {number} [lower=0] The lower bound.
  31444. * @param {number} [upper=1] The upper bound.
  31445. * @param {boolean} [floating] Specify returning a floating-point number.
  31446. * @returns {number} Returns the random number.
  31447. * @example
  31448. *
  31449. * _.random(0, 5);
  31450. * // => an integer between 0 and 5
  31451. *
  31452. * _.random(5);
  31453. * // => also an integer between 0 and 5
  31454. *
  31455. * _.random(5, true);
  31456. * // => a floating-point number between 0 and 5
  31457. *
  31458. * _.random(1.2, 5.2);
  31459. * // => a floating-point number between 1.2 and 5.2
  31460. */
  31461. function random(lower, upper, floating) {
  31462. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31463. upper = floating = undefined;
  31464. }
  31465. if (floating === undefined) {
  31466. if (typeof upper == 'boolean') {
  31467. floating = upper;
  31468. upper = undefined;
  31469. }
  31470. else if (typeof lower == 'boolean') {
  31471. floating = lower;
  31472. lower = undefined;
  31473. }
  31474. }
  31475. if (lower === undefined && upper === undefined) {
  31476. lower = 0;
  31477. upper = 1;
  31478. }
  31479. else {
  31480. lower = toFinite(lower);
  31481. if (upper === undefined) {
  31482. upper = lower;
  31483. lower = 0;
  31484. } else {
  31485. upper = toFinite(upper);
  31486. }
  31487. }
  31488. if (lower > upper) {
  31489. var temp = lower;
  31490. lower = upper;
  31491. upper = temp;
  31492. }
  31493. if (floating || lower % 1 || upper % 1) {
  31494. var rand = nativeRandom();
  31495. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31496. }
  31497. return baseRandom(lower, upper);
  31498. }
  31499. /*------------------------------------------------------------------------*/
  31500. /**
  31501. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31502. *
  31503. * @static
  31504. * @memberOf _
  31505. * @since 3.0.0
  31506. * @category String
  31507. * @param {string} [string=''] The string to convert.
  31508. * @returns {string} Returns the camel cased string.
  31509. * @example
  31510. *
  31511. * _.camelCase('Foo Bar');
  31512. * // => 'fooBar'
  31513. *
  31514. * _.camelCase('--foo-bar--');
  31515. * // => 'fooBar'
  31516. *
  31517. * _.camelCase('__FOO_BAR__');
  31518. * // => 'fooBar'
  31519. */
  31520. var camelCase = createCompounder(function(result, word, index) {
  31521. word = word.toLowerCase();
  31522. return result + (index ? capitalize(word) : word);
  31523. });
  31524. /**
  31525. * Converts the first character of `string` to upper case and the remaining
  31526. * to lower case.
  31527. *
  31528. * @static
  31529. * @memberOf _
  31530. * @since 3.0.0
  31531. * @category String
  31532. * @param {string} [string=''] The string to capitalize.
  31533. * @returns {string} Returns the capitalized string.
  31534. * @example
  31535. *
  31536. * _.capitalize('FRED');
  31537. * // => 'Fred'
  31538. */
  31539. function capitalize(string) {
  31540. return upperFirst(toString(string).toLowerCase());
  31541. }
  31542. /**
  31543. * Deburrs `string` by converting
  31544. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31545. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31546. * letters to basic Latin letters and removing
  31547. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31548. *
  31549. * @static
  31550. * @memberOf _
  31551. * @since 3.0.0
  31552. * @category String
  31553. * @param {string} [string=''] The string to deburr.
  31554. * @returns {string} Returns the deburred string.
  31555. * @example
  31556. *
  31557. * _.deburr('déjà vu');
  31558. * // => 'deja vu'
  31559. */
  31560. function deburr(string) {
  31561. string = toString(string);
  31562. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31563. }
  31564. /**
  31565. * Checks if `string` ends with the given target string.
  31566. *
  31567. * @static
  31568. * @memberOf _
  31569. * @since 3.0.0
  31570. * @category String
  31571. * @param {string} [string=''] The string to inspect.
  31572. * @param {string} [target] The string to search for.
  31573. * @param {number} [position=string.length] The position to search up to.
  31574. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31575. * else `false`.
  31576. * @example
  31577. *
  31578. * _.endsWith('abc', 'c');
  31579. * // => true
  31580. *
  31581. * _.endsWith('abc', 'b');
  31582. * // => false
  31583. *
  31584. * _.endsWith('abc', 'b', 2);
  31585. * // => true
  31586. */
  31587. function endsWith(string, target, position) {
  31588. string = toString(string);
  31589. target = baseToString(target);
  31590. var length = string.length;
  31591. position = position === undefined
  31592. ? length
  31593. : baseClamp(toInteger(position), 0, length);
  31594. var end = position;
  31595. position -= target.length;
  31596. return position >= 0 && string.slice(position, end) == target;
  31597. }
  31598. /**
  31599. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31600. * corresponding HTML entities.
  31601. *
  31602. * **Note:** No other characters are escaped. To escape additional
  31603. * characters use a third-party library like [_he_](https://mths.be/he).
  31604. *
  31605. * Though the ">" character is escaped for symmetry, characters like
  31606. * ">" and "/" don't need escaping in HTML and have no special meaning
  31607. * unless they're part of a tag or unquoted attribute value. See
  31608. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31609. * (under "semi-related fun fact") for more details.
  31610. *
  31611. * When working with HTML you should always
  31612. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31613. * XSS vectors.
  31614. *
  31615. * @static
  31616. * @since 0.1.0
  31617. * @memberOf _
  31618. * @category String
  31619. * @param {string} [string=''] The string to escape.
  31620. * @returns {string} Returns the escaped string.
  31621. * @example
  31622. *
  31623. * _.escape('fred, barney, & pebbles');
  31624. * // => 'fred, barney, &amp; pebbles'
  31625. */
  31626. function escape(string) {
  31627. string = toString(string);
  31628. return (string && reHasUnescapedHtml.test(string))
  31629. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31630. : string;
  31631. }
  31632. /**
  31633. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31634. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31635. *
  31636. * @static
  31637. * @memberOf _
  31638. * @since 3.0.0
  31639. * @category String
  31640. * @param {string} [string=''] The string to escape.
  31641. * @returns {string} Returns the escaped string.
  31642. * @example
  31643. *
  31644. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31645. * // => '\[lodash\]\(https://lodash\.com/\)'
  31646. */
  31647. function escapeRegExp(string) {
  31648. string = toString(string);
  31649. return (string && reHasRegExpChar.test(string))
  31650. ? string.replace(reRegExpChar, '\\$&')
  31651. : string;
  31652. }
  31653. /**
  31654. * Converts `string` to
  31655. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31656. *
  31657. * @static
  31658. * @memberOf _
  31659. * @since 3.0.0
  31660. * @category String
  31661. * @param {string} [string=''] The string to convert.
  31662. * @returns {string} Returns the kebab cased string.
  31663. * @example
  31664. *
  31665. * _.kebabCase('Foo Bar');
  31666. * // => 'foo-bar'
  31667. *
  31668. * _.kebabCase('fooBar');
  31669. * // => 'foo-bar'
  31670. *
  31671. * _.kebabCase('__FOO_BAR__');
  31672. * // => 'foo-bar'
  31673. */
  31674. var kebabCase = createCompounder(function(result, word, index) {
  31675. return result + (index ? '-' : '') + word.toLowerCase();
  31676. });
  31677. /**
  31678. * Converts `string`, as space separated words, to lower case.
  31679. *
  31680. * @static
  31681. * @memberOf _
  31682. * @since 4.0.0
  31683. * @category String
  31684. * @param {string} [string=''] The string to convert.
  31685. * @returns {string} Returns the lower cased string.
  31686. * @example
  31687. *
  31688. * _.lowerCase('--Foo-Bar--');
  31689. * // => 'foo bar'
  31690. *
  31691. * _.lowerCase('fooBar');
  31692. * // => 'foo bar'
  31693. *
  31694. * _.lowerCase('__FOO_BAR__');
  31695. * // => 'foo bar'
  31696. */
  31697. var lowerCase = createCompounder(function(result, word, index) {
  31698. return result + (index ? ' ' : '') + word.toLowerCase();
  31699. });
  31700. /**
  31701. * Converts the first character of `string` to lower case.
  31702. *
  31703. * @static
  31704. * @memberOf _
  31705. * @since 4.0.0
  31706. * @category String
  31707. * @param {string} [string=''] The string to convert.
  31708. * @returns {string} Returns the converted string.
  31709. * @example
  31710. *
  31711. * _.lowerFirst('Fred');
  31712. * // => 'fred'
  31713. *
  31714. * _.lowerFirst('FRED');
  31715. * // => 'fRED'
  31716. */
  31717. var lowerFirst = createCaseFirst('toLowerCase');
  31718. /**
  31719. * Pads `string` on the left and right sides if it's shorter than `length`.
  31720. * Padding characters are truncated if they can't be evenly divided by `length`.
  31721. *
  31722. * @static
  31723. * @memberOf _
  31724. * @since 3.0.0
  31725. * @category String
  31726. * @param {string} [string=''] The string to pad.
  31727. * @param {number} [length=0] The padding length.
  31728. * @param {string} [chars=' '] The string used as padding.
  31729. * @returns {string} Returns the padded string.
  31730. * @example
  31731. *
  31732. * _.pad('abc', 8);
  31733. * // => ' abc '
  31734. *
  31735. * _.pad('abc', 8, '_-');
  31736. * // => '_-abc_-_'
  31737. *
  31738. * _.pad('abc', 3);
  31739. * // => 'abc'
  31740. */
  31741. function pad(string, length, chars) {
  31742. string = toString(string);
  31743. length = toInteger(length);
  31744. var strLength = length ? stringSize(string) : 0;
  31745. if (!length || strLength >= length) {
  31746. return string;
  31747. }
  31748. var mid = (length - strLength) / 2;
  31749. return (
  31750. createPadding(nativeFloor(mid), chars) +
  31751. string +
  31752. createPadding(nativeCeil(mid), chars)
  31753. );
  31754. }
  31755. /**
  31756. * Pads `string` on the right side if it's shorter than `length`. Padding
  31757. * characters are truncated if they exceed `length`.
  31758. *
  31759. * @static
  31760. * @memberOf _
  31761. * @since 4.0.0
  31762. * @category String
  31763. * @param {string} [string=''] The string to pad.
  31764. * @param {number} [length=0] The padding length.
  31765. * @param {string} [chars=' '] The string used as padding.
  31766. * @returns {string} Returns the padded string.
  31767. * @example
  31768. *
  31769. * _.padEnd('abc', 6);
  31770. * // => 'abc '
  31771. *
  31772. * _.padEnd('abc', 6, '_-');
  31773. * // => 'abc_-_'
  31774. *
  31775. * _.padEnd('abc', 3);
  31776. * // => 'abc'
  31777. */
  31778. function padEnd(string, length, chars) {
  31779. string = toString(string);
  31780. length = toInteger(length);
  31781. var strLength = length ? stringSize(string) : 0;
  31782. return (length && strLength < length)
  31783. ? (string + createPadding(length - strLength, chars))
  31784. : string;
  31785. }
  31786. /**
  31787. * Pads `string` on the left side if it's shorter than `length`. Padding
  31788. * characters are truncated if they exceed `length`.
  31789. *
  31790. * @static
  31791. * @memberOf _
  31792. * @since 4.0.0
  31793. * @category String
  31794. * @param {string} [string=''] The string to pad.
  31795. * @param {number} [length=0] The padding length.
  31796. * @param {string} [chars=' '] The string used as padding.
  31797. * @returns {string} Returns the padded string.
  31798. * @example
  31799. *
  31800. * _.padStart('abc', 6);
  31801. * // => ' abc'
  31802. *
  31803. * _.padStart('abc', 6, '_-');
  31804. * // => '_-_abc'
  31805. *
  31806. * _.padStart('abc', 3);
  31807. * // => 'abc'
  31808. */
  31809. function padStart(string, length, chars) {
  31810. string = toString(string);
  31811. length = toInteger(length);
  31812. var strLength = length ? stringSize(string) : 0;
  31813. return (length && strLength < length)
  31814. ? (createPadding(length - strLength, chars) + string)
  31815. : string;
  31816. }
  31817. /**
  31818. * Converts `string` to an integer of the specified radix. If `radix` is
  31819. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31820. * hexadecimal, in which case a `radix` of `16` is used.
  31821. *
  31822. * **Note:** This method aligns with the
  31823. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31824. *
  31825. * @static
  31826. * @memberOf _
  31827. * @since 1.1.0
  31828. * @category String
  31829. * @param {string} string The string to convert.
  31830. * @param {number} [radix=10] The radix to interpret `value` by.
  31831. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31832. * @returns {number} Returns the converted integer.
  31833. * @example
  31834. *
  31835. * _.parseInt('08');
  31836. * // => 8
  31837. *
  31838. * _.map(['6', '08', '10'], _.parseInt);
  31839. * // => [6, 8, 10]
  31840. */
  31841. function parseInt(string, radix, guard) {
  31842. if (guard || radix == null) {
  31843. radix = 0;
  31844. } else if (radix) {
  31845. radix = +radix;
  31846. }
  31847. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31848. }
  31849. /**
  31850. * Repeats the given string `n` times.
  31851. *
  31852. * @static
  31853. * @memberOf _
  31854. * @since 3.0.0
  31855. * @category String
  31856. * @param {string} [string=''] The string to repeat.
  31857. * @param {number} [n=1] The number of times to repeat the string.
  31858. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31859. * @returns {string} Returns the repeated string.
  31860. * @example
  31861. *
  31862. * _.repeat('*', 3);
  31863. * // => '***'
  31864. *
  31865. * _.repeat('abc', 2);
  31866. * // => 'abcabc'
  31867. *
  31868. * _.repeat('abc', 0);
  31869. * // => ''
  31870. */
  31871. function repeat(string, n, guard) {
  31872. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31873. n = 1;
  31874. } else {
  31875. n = toInteger(n);
  31876. }
  31877. return baseRepeat(toString(string), n);
  31878. }
  31879. /**
  31880. * Replaces matches for `pattern` in `string` with `replacement`.
  31881. *
  31882. * **Note:** This method is based on
  31883. * [`String#replace`](https://mdn.io/String/replace).
  31884. *
  31885. * @static
  31886. * @memberOf _
  31887. * @since 4.0.0
  31888. * @category String
  31889. * @param {string} [string=''] The string to modify.
  31890. * @param {RegExp|string} pattern The pattern to replace.
  31891. * @param {Function|string} replacement The match replacement.
  31892. * @returns {string} Returns the modified string.
  31893. * @example
  31894. *
  31895. * _.replace('Hi Fred', 'Fred', 'Barney');
  31896. * // => 'Hi Barney'
  31897. */
  31898. function replace() {
  31899. var args = arguments,
  31900. string = toString(args[0]);
  31901. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31902. }
  31903. /**
  31904. * Converts `string` to
  31905. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31906. *
  31907. * @static
  31908. * @memberOf _
  31909. * @since 3.0.0
  31910. * @category String
  31911. * @param {string} [string=''] The string to convert.
  31912. * @returns {string} Returns the snake cased string.
  31913. * @example
  31914. *
  31915. * _.snakeCase('Foo Bar');
  31916. * // => 'foo_bar'
  31917. *
  31918. * _.snakeCase('fooBar');
  31919. * // => 'foo_bar'
  31920. *
  31921. * _.snakeCase('--FOO-BAR--');
  31922. * // => 'foo_bar'
  31923. */
  31924. var snakeCase = createCompounder(function(result, word, index) {
  31925. return result + (index ? '_' : '') + word.toLowerCase();
  31926. });
  31927. /**
  31928. * Splits `string` by `separator`.
  31929. *
  31930. * **Note:** This method is based on
  31931. * [`String#split`](https://mdn.io/String/split).
  31932. *
  31933. * @static
  31934. * @memberOf _
  31935. * @since 4.0.0
  31936. * @category String
  31937. * @param {string} [string=''] The string to split.
  31938. * @param {RegExp|string} separator The separator pattern to split by.
  31939. * @param {number} [limit] The length to truncate results to.
  31940. * @returns {Array} Returns the string segments.
  31941. * @example
  31942. *
  31943. * _.split('a-b-c', '-', 2);
  31944. * // => ['a', 'b']
  31945. */
  31946. function split(string, separator, limit) {
  31947. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31948. separator = limit = undefined;
  31949. }
  31950. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31951. if (!limit) {
  31952. return [];
  31953. }
  31954. string = toString(string);
  31955. if (string && (
  31956. typeof separator == 'string' ||
  31957. (separator != null && !isRegExp(separator))
  31958. )) {
  31959. separator = baseToString(separator);
  31960. if (!separator && hasUnicode(string)) {
  31961. return castSlice(stringToArray(string), 0, limit);
  31962. }
  31963. }
  31964. return string.split(separator, limit);
  31965. }
  31966. /**
  31967. * Converts `string` to
  31968. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31969. *
  31970. * @static
  31971. * @memberOf _
  31972. * @since 3.1.0
  31973. * @category String
  31974. * @param {string} [string=''] The string to convert.
  31975. * @returns {string} Returns the start cased string.
  31976. * @example
  31977. *
  31978. * _.startCase('--foo-bar--');
  31979. * // => 'Foo Bar'
  31980. *
  31981. * _.startCase('fooBar');
  31982. * // => 'Foo Bar'
  31983. *
  31984. * _.startCase('__FOO_BAR__');
  31985. * // => 'FOO BAR'
  31986. */
  31987. var startCase = createCompounder(function(result, word, index) {
  31988. return result + (index ? ' ' : '') + upperFirst(word);
  31989. });
  31990. /**
  31991. * Checks if `string` starts with the given target string.
  31992. *
  31993. * @static
  31994. * @memberOf _
  31995. * @since 3.0.0
  31996. * @category String
  31997. * @param {string} [string=''] The string to inspect.
  31998. * @param {string} [target] The string to search for.
  31999. * @param {number} [position=0] The position to search from.
  32000. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32001. * else `false`.
  32002. * @example
  32003. *
  32004. * _.startsWith('abc', 'a');
  32005. * // => true
  32006. *
  32007. * _.startsWith('abc', 'b');
  32008. * // => false
  32009. *
  32010. * _.startsWith('abc', 'b', 1);
  32011. * // => true
  32012. */
  32013. function startsWith(string, target, position) {
  32014. string = toString(string);
  32015. position = position == null
  32016. ? 0
  32017. : baseClamp(toInteger(position), 0, string.length);
  32018. target = baseToString(target);
  32019. return string.slice(position, position + target.length) == target;
  32020. }
  32021. /**
  32022. * Creates a compiled template function that can interpolate data properties
  32023. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32024. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32025. * properties may be accessed as free variables in the template. If a setting
  32026. * object is given, it takes precedence over `_.templateSettings` values.
  32027. *
  32028. * **Note:** In the development build `_.template` utilizes
  32029. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32030. * for easier debugging.
  32031. *
  32032. * For more information on precompiling templates see
  32033. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32034. *
  32035. * For more information on Chrome extension sandboxes see
  32036. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32037. *
  32038. * @static
  32039. * @since 0.1.0
  32040. * @memberOf _
  32041. * @category String
  32042. * @param {string} [string=''] The template string.
  32043. * @param {Object} [options={}] The options object.
  32044. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32045. * The HTML "escape" delimiter.
  32046. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32047. * The "evaluate" delimiter.
  32048. * @param {Object} [options.imports=_.templateSettings.imports]
  32049. * An object to import into the template as free variables.
  32050. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32051. * The "interpolate" delimiter.
  32052. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32053. * The sourceURL of the compiled template.
  32054. * @param {string} [options.variable='obj']
  32055. * The data object variable name.
  32056. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32057. * @returns {Function} Returns the compiled template function.
  32058. * @example
  32059. *
  32060. * // Use the "interpolate" delimiter to create a compiled template.
  32061. * var compiled = _.template('hello <%= user %>!');
  32062. * compiled({ 'user': 'fred' });
  32063. * // => 'hello fred!'
  32064. *
  32065. * // Use the HTML "escape" delimiter to escape data property values.
  32066. * var compiled = _.template('<b><%- value %></b>');
  32067. * compiled({ 'value': '<script>' });
  32068. * // => '<b>&lt;script&gt;</b>'
  32069. *
  32070. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32071. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32072. * compiled({ 'users': ['fred', 'barney'] });
  32073. * // => '<li>fred</li><li>barney</li>'
  32074. *
  32075. * // Use the internal `print` function in "evaluate" delimiters.
  32076. * var compiled = _.template('<% print("hello " + user); %>!');
  32077. * compiled({ 'user': 'barney' });
  32078. * // => 'hello barney!'
  32079. *
  32080. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32081. * // Disable support by replacing the "interpolate" delimiter.
  32082. * var compiled = _.template('hello ${ user }!');
  32083. * compiled({ 'user': 'pebbles' });
  32084. * // => 'hello pebbles!'
  32085. *
  32086. * // Use backslashes to treat delimiters as plain text.
  32087. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32088. * compiled({ 'value': 'ignored' });
  32089. * // => '<%- value %>'
  32090. *
  32091. * // Use the `imports` option to import `jQuery` as `jq`.
  32092. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32093. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32094. * compiled({ 'users': ['fred', 'barney'] });
  32095. * // => '<li>fred</li><li>barney</li>'
  32096. *
  32097. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32098. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32099. * compiled(data);
  32100. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32101. *
  32102. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32103. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32104. * compiled.source;
  32105. * // => function(data) {
  32106. * // var __t, __p = '';
  32107. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32108. * // return __p;
  32109. * // }
  32110. *
  32111. * // Use custom template delimiters.
  32112. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32113. * var compiled = _.template('hello {{ user }}!');
  32114. * compiled({ 'user': 'mustache' });
  32115. * // => 'hello mustache!'
  32116. *
  32117. * // Use the `source` property to inline compiled templates for meaningful
  32118. * // line numbers in error messages and stack traces.
  32119. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32120. * var JST = {\
  32121. * "main": ' + _.template(mainText).source + '\
  32122. * };\
  32123. * ');
  32124. */
  32125. function template(string, options, guard) {
  32126. // Based on John Resig's `tmpl` implementation
  32127. // (http://ejohn.org/blog/javascript-micro-templating/)
  32128. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32129. var settings = lodash.templateSettings;
  32130. if (guard && isIterateeCall(string, options, guard)) {
  32131. options = undefined;
  32132. }
  32133. string = toString(string);
  32134. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32135. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32136. importsKeys = keys(imports),
  32137. importsValues = baseValues(imports, importsKeys);
  32138. var isEscaping,
  32139. isEvaluating,
  32140. index = 0,
  32141. interpolate = options.interpolate || reNoMatch,
  32142. source = "__p += '";
  32143. // Compile the regexp to match each delimiter.
  32144. var reDelimiters = RegExp(
  32145. (options.escape || reNoMatch).source + '|' +
  32146. interpolate.source + '|' +
  32147. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32148. (options.evaluate || reNoMatch).source + '|$'
  32149. , 'g');
  32150. // Use a sourceURL for easier debugging.
  32151. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32152. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32153. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32154. var sourceURL = '//# sourceURL=' +
  32155. (hasOwnProperty.call(options, 'sourceURL')
  32156. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32157. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32158. ) + '\n';
  32159. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32160. interpolateValue || (interpolateValue = esTemplateValue);
  32161. // Escape characters that can't be included in string literals.
  32162. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32163. // Replace delimiters with snippets.
  32164. if (escapeValue) {
  32165. isEscaping = true;
  32166. source += "' +\n__e(" + escapeValue + ") +\n'";
  32167. }
  32168. if (evaluateValue) {
  32169. isEvaluating = true;
  32170. source += "';\n" + evaluateValue + ";\n__p += '";
  32171. }
  32172. if (interpolateValue) {
  32173. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32174. }
  32175. index = offset + match.length;
  32176. // The JS engine embedded in Adobe products needs `match` returned in
  32177. // order to produce the correct `offset` value.
  32178. return match;
  32179. });
  32180. source += "';\n";
  32181. // If `variable` is not specified wrap a with-statement around the generated
  32182. // code to add the data object to the top of the scope chain.
  32183. // Like with sourceURL, we take care to not check the option's prototype,
  32184. // as this configuration is a code injection vector.
  32185. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32186. if (!variable) {
  32187. source = 'with (obj) {\n' + source + '\n}\n';
  32188. }
  32189. // Cleanup code by stripping empty strings.
  32190. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32191. .replace(reEmptyStringMiddle, '$1')
  32192. .replace(reEmptyStringTrailing, '$1;');
  32193. // Frame code as the function body.
  32194. source = 'function(' + (variable || 'obj') + ') {\n' +
  32195. (variable
  32196. ? ''
  32197. : 'obj || (obj = {});\n'
  32198. ) +
  32199. "var __t, __p = ''" +
  32200. (isEscaping
  32201. ? ', __e = _.escape'
  32202. : ''
  32203. ) +
  32204. (isEvaluating
  32205. ? ', __j = Array.prototype.join;\n' +
  32206. "function print() { __p += __j.call(arguments, '') }\n"
  32207. : ';\n'
  32208. ) +
  32209. source +
  32210. 'return __p\n}';
  32211. var result = attempt(function() {
  32212. return Function(importsKeys, sourceURL + 'return ' + source)
  32213. .apply(undefined, importsValues);
  32214. });
  32215. // Provide the compiled function's source by its `toString` method or
  32216. // the `source` property as a convenience for inlining compiled templates.
  32217. result.source = source;
  32218. if (isError(result)) {
  32219. throw result;
  32220. }
  32221. return result;
  32222. }
  32223. /**
  32224. * Converts `string`, as a whole, to lower case just like
  32225. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32226. *
  32227. * @static
  32228. * @memberOf _
  32229. * @since 4.0.0
  32230. * @category String
  32231. * @param {string} [string=''] The string to convert.
  32232. * @returns {string} Returns the lower cased string.
  32233. * @example
  32234. *
  32235. * _.toLower('--Foo-Bar--');
  32236. * // => '--foo-bar--'
  32237. *
  32238. * _.toLower('fooBar');
  32239. * // => 'foobar'
  32240. *
  32241. * _.toLower('__FOO_BAR__');
  32242. * // => '__foo_bar__'
  32243. */
  32244. function toLower(value) {
  32245. return toString(value).toLowerCase();
  32246. }
  32247. /**
  32248. * Converts `string`, as a whole, to upper case just like
  32249. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32250. *
  32251. * @static
  32252. * @memberOf _
  32253. * @since 4.0.0
  32254. * @category String
  32255. * @param {string} [string=''] The string to convert.
  32256. * @returns {string} Returns the upper cased string.
  32257. * @example
  32258. *
  32259. * _.toUpper('--foo-bar--');
  32260. * // => '--FOO-BAR--'
  32261. *
  32262. * _.toUpper('fooBar');
  32263. * // => 'FOOBAR'
  32264. *
  32265. * _.toUpper('__foo_bar__');
  32266. * // => '__FOO_BAR__'
  32267. */
  32268. function toUpper(value) {
  32269. return toString(value).toUpperCase();
  32270. }
  32271. /**
  32272. * Removes leading and trailing whitespace or specified characters from `string`.
  32273. *
  32274. * @static
  32275. * @memberOf _
  32276. * @since 3.0.0
  32277. * @category String
  32278. * @param {string} [string=''] The string to trim.
  32279. * @param {string} [chars=whitespace] The characters to trim.
  32280. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32281. * @returns {string} Returns the trimmed string.
  32282. * @example
  32283. *
  32284. * _.trim(' abc ');
  32285. * // => 'abc'
  32286. *
  32287. * _.trim('-_-abc-_-', '_-');
  32288. * // => 'abc'
  32289. *
  32290. * _.map([' foo ', ' bar '], _.trim);
  32291. * // => ['foo', 'bar']
  32292. */
  32293. function trim(string, chars, guard) {
  32294. string = toString(string);
  32295. if (string && (guard || chars === undefined)) {
  32296. return string.replace(reTrim, '');
  32297. }
  32298. if (!string || !(chars = baseToString(chars))) {
  32299. return string;
  32300. }
  32301. var strSymbols = stringToArray(string),
  32302. chrSymbols = stringToArray(chars),
  32303. start = charsStartIndex(strSymbols, chrSymbols),
  32304. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32305. return castSlice(strSymbols, start, end).join('');
  32306. }
  32307. /**
  32308. * Removes trailing whitespace or specified characters from `string`.
  32309. *
  32310. * @static
  32311. * @memberOf _
  32312. * @since 4.0.0
  32313. * @category String
  32314. * @param {string} [string=''] The string to trim.
  32315. * @param {string} [chars=whitespace] The characters to trim.
  32316. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32317. * @returns {string} Returns the trimmed string.
  32318. * @example
  32319. *
  32320. * _.trimEnd(' abc ');
  32321. * // => ' abc'
  32322. *
  32323. * _.trimEnd('-_-abc-_-', '_-');
  32324. * // => '-_-abc'
  32325. */
  32326. function trimEnd(string, chars, guard) {
  32327. string = toString(string);
  32328. if (string && (guard || chars === undefined)) {
  32329. return string.replace(reTrimEnd, '');
  32330. }
  32331. if (!string || !(chars = baseToString(chars))) {
  32332. return string;
  32333. }
  32334. var strSymbols = stringToArray(string),
  32335. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32336. return castSlice(strSymbols, 0, end).join('');
  32337. }
  32338. /**
  32339. * Removes leading whitespace or specified characters from `string`.
  32340. *
  32341. * @static
  32342. * @memberOf _
  32343. * @since 4.0.0
  32344. * @category String
  32345. * @param {string} [string=''] The string to trim.
  32346. * @param {string} [chars=whitespace] The characters to trim.
  32347. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32348. * @returns {string} Returns the trimmed string.
  32349. * @example
  32350. *
  32351. * _.trimStart(' abc ');
  32352. * // => 'abc '
  32353. *
  32354. * _.trimStart('-_-abc-_-', '_-');
  32355. * // => 'abc-_-'
  32356. */
  32357. function trimStart(string, chars, guard) {
  32358. string = toString(string);
  32359. if (string && (guard || chars === undefined)) {
  32360. return string.replace(reTrimStart, '');
  32361. }
  32362. if (!string || !(chars = baseToString(chars))) {
  32363. return string;
  32364. }
  32365. var strSymbols = stringToArray(string),
  32366. start = charsStartIndex(strSymbols, stringToArray(chars));
  32367. return castSlice(strSymbols, start).join('');
  32368. }
  32369. /**
  32370. * Truncates `string` if it's longer than the given maximum string length.
  32371. * The last characters of the truncated string are replaced with the omission
  32372. * string which defaults to "...".
  32373. *
  32374. * @static
  32375. * @memberOf _
  32376. * @since 4.0.0
  32377. * @category String
  32378. * @param {string} [string=''] The string to truncate.
  32379. * @param {Object} [options={}] The options object.
  32380. * @param {number} [options.length=30] The maximum string length.
  32381. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32382. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32383. * @returns {string} Returns the truncated string.
  32384. * @example
  32385. *
  32386. * _.truncate('hi-diddly-ho there, neighborino');
  32387. * // => 'hi-diddly-ho there, neighbo...'
  32388. *
  32389. * _.truncate('hi-diddly-ho there, neighborino', {
  32390. * 'length': 24,
  32391. * 'separator': ' '
  32392. * });
  32393. * // => 'hi-diddly-ho there,...'
  32394. *
  32395. * _.truncate('hi-diddly-ho there, neighborino', {
  32396. * 'length': 24,
  32397. * 'separator': /,? +/
  32398. * });
  32399. * // => 'hi-diddly-ho there...'
  32400. *
  32401. * _.truncate('hi-diddly-ho there, neighborino', {
  32402. * 'omission': ' [...]'
  32403. * });
  32404. * // => 'hi-diddly-ho there, neig [...]'
  32405. */
  32406. function truncate(string, options) {
  32407. var length = DEFAULT_TRUNC_LENGTH,
  32408. omission = DEFAULT_TRUNC_OMISSION;
  32409. if (isObject(options)) {
  32410. var separator = 'separator' in options ? options.separator : separator;
  32411. length = 'length' in options ? toInteger(options.length) : length;
  32412. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32413. }
  32414. string = toString(string);
  32415. var strLength = string.length;
  32416. if (hasUnicode(string)) {
  32417. var strSymbols = stringToArray(string);
  32418. strLength = strSymbols.length;
  32419. }
  32420. if (length >= strLength) {
  32421. return string;
  32422. }
  32423. var end = length - stringSize(omission);
  32424. if (end < 1) {
  32425. return omission;
  32426. }
  32427. var result = strSymbols
  32428. ? castSlice(strSymbols, 0, end).join('')
  32429. : string.slice(0, end);
  32430. if (separator === undefined) {
  32431. return result + omission;
  32432. }
  32433. if (strSymbols) {
  32434. end += (result.length - end);
  32435. }
  32436. if (isRegExp(separator)) {
  32437. if (string.slice(end).search(separator)) {
  32438. var match,
  32439. substring = result;
  32440. if (!separator.global) {
  32441. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32442. }
  32443. separator.lastIndex = 0;
  32444. while ((match = separator.exec(substring))) {
  32445. var newEnd = match.index;
  32446. }
  32447. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32448. }
  32449. } else if (string.indexOf(baseToString(separator), end) != end) {
  32450. var index = result.lastIndexOf(separator);
  32451. if (index > -1) {
  32452. result = result.slice(0, index);
  32453. }
  32454. }
  32455. return result + omission;
  32456. }
  32457. /**
  32458. * The inverse of `_.escape`; this method converts the HTML entities
  32459. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32460. * their corresponding characters.
  32461. *
  32462. * **Note:** No other HTML entities are unescaped. To unescape additional
  32463. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32464. *
  32465. * @static
  32466. * @memberOf _
  32467. * @since 0.6.0
  32468. * @category String
  32469. * @param {string} [string=''] The string to unescape.
  32470. * @returns {string} Returns the unescaped string.
  32471. * @example
  32472. *
  32473. * _.unescape('fred, barney, &amp; pebbles');
  32474. * // => 'fred, barney, & pebbles'
  32475. */
  32476. function unescape(string) {
  32477. string = toString(string);
  32478. return (string && reHasEscapedHtml.test(string))
  32479. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32480. : string;
  32481. }
  32482. /**
  32483. * Converts `string`, as space separated words, to upper case.
  32484. *
  32485. * @static
  32486. * @memberOf _
  32487. * @since 4.0.0
  32488. * @category String
  32489. * @param {string} [string=''] The string to convert.
  32490. * @returns {string} Returns the upper cased string.
  32491. * @example
  32492. *
  32493. * _.upperCase('--foo-bar');
  32494. * // => 'FOO BAR'
  32495. *
  32496. * _.upperCase('fooBar');
  32497. * // => 'FOO BAR'
  32498. *
  32499. * _.upperCase('__foo_bar__');
  32500. * // => 'FOO BAR'
  32501. */
  32502. var upperCase = createCompounder(function(result, word, index) {
  32503. return result + (index ? ' ' : '') + word.toUpperCase();
  32504. });
  32505. /**
  32506. * Converts the first character of `string` to upper case.
  32507. *
  32508. * @static
  32509. * @memberOf _
  32510. * @since 4.0.0
  32511. * @category String
  32512. * @param {string} [string=''] The string to convert.
  32513. * @returns {string} Returns the converted string.
  32514. * @example
  32515. *
  32516. * _.upperFirst('fred');
  32517. * // => 'Fred'
  32518. *
  32519. * _.upperFirst('FRED');
  32520. * // => 'FRED'
  32521. */
  32522. var upperFirst = createCaseFirst('toUpperCase');
  32523. /**
  32524. * Splits `string` into an array of its words.
  32525. *
  32526. * @static
  32527. * @memberOf _
  32528. * @since 3.0.0
  32529. * @category String
  32530. * @param {string} [string=''] The string to inspect.
  32531. * @param {RegExp|string} [pattern] The pattern to match words.
  32532. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32533. * @returns {Array} Returns the words of `string`.
  32534. * @example
  32535. *
  32536. * _.words('fred, barney, & pebbles');
  32537. * // => ['fred', 'barney', 'pebbles']
  32538. *
  32539. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32540. * // => ['fred', 'barney', '&', 'pebbles']
  32541. */
  32542. function words(string, pattern, guard) {
  32543. string = toString(string);
  32544. pattern = guard ? undefined : pattern;
  32545. if (pattern === undefined) {
  32546. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32547. }
  32548. return string.match(pattern) || [];
  32549. }
  32550. /*------------------------------------------------------------------------*/
  32551. /**
  32552. * Attempts to invoke `func`, returning either the result or the caught error
  32553. * object. Any additional arguments are provided to `func` when it's invoked.
  32554. *
  32555. * @static
  32556. * @memberOf _
  32557. * @since 3.0.0
  32558. * @category Util
  32559. * @param {Function} func The function to attempt.
  32560. * @param {...*} [args] The arguments to invoke `func` with.
  32561. * @returns {*} Returns the `func` result or error object.
  32562. * @example
  32563. *
  32564. * // Avoid throwing errors for invalid selectors.
  32565. * var elements = _.attempt(function(selector) {
  32566. * return document.querySelectorAll(selector);
  32567. * }, '>_>');
  32568. *
  32569. * if (_.isError(elements)) {
  32570. * elements = [];
  32571. * }
  32572. */
  32573. var attempt = baseRest(function(func, args) {
  32574. try {
  32575. return apply(func, undefined, args);
  32576. } catch (e) {
  32577. return isError(e) ? e : new Error(e);
  32578. }
  32579. });
  32580. /**
  32581. * Binds methods of an object to the object itself, overwriting the existing
  32582. * method.
  32583. *
  32584. * **Note:** This method doesn't set the "length" property of bound functions.
  32585. *
  32586. * @static
  32587. * @since 0.1.0
  32588. * @memberOf _
  32589. * @category Util
  32590. * @param {Object} object The object to bind and assign the bound methods to.
  32591. * @param {...(string|string[])} methodNames The object method names to bind.
  32592. * @returns {Object} Returns `object`.
  32593. * @example
  32594. *
  32595. * var view = {
  32596. * 'label': 'docs',
  32597. * 'click': function() {
  32598. * console.log('clicked ' + this.label);
  32599. * }
  32600. * };
  32601. *
  32602. * _.bindAll(view, ['click']);
  32603. * jQuery(element).on('click', view.click);
  32604. * // => Logs 'clicked docs' when clicked.
  32605. */
  32606. var bindAll = flatRest(function(object, methodNames) {
  32607. arrayEach(methodNames, function(key) {
  32608. key = toKey(key);
  32609. baseAssignValue(object, key, bind(object[key], object));
  32610. });
  32611. return object;
  32612. });
  32613. /**
  32614. * Creates a function that iterates over `pairs` and invokes the corresponding
  32615. * function of the first predicate to return truthy. The predicate-function
  32616. * pairs are invoked with the `this` binding and arguments of the created
  32617. * function.
  32618. *
  32619. * @static
  32620. * @memberOf _
  32621. * @since 4.0.0
  32622. * @category Util
  32623. * @param {Array} pairs The predicate-function pairs.
  32624. * @returns {Function} Returns the new composite function.
  32625. * @example
  32626. *
  32627. * var func = _.cond([
  32628. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32629. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32630. * [_.stubTrue, _.constant('no match')]
  32631. * ]);
  32632. *
  32633. * func({ 'a': 1, 'b': 2 });
  32634. * // => 'matches A'
  32635. *
  32636. * func({ 'a': 0, 'b': 1 });
  32637. * // => 'matches B'
  32638. *
  32639. * func({ 'a': '1', 'b': '2' });
  32640. * // => 'no match'
  32641. */
  32642. function cond(pairs) {
  32643. var length = pairs == null ? 0 : pairs.length,
  32644. toIteratee = getIteratee();
  32645. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32646. if (typeof pair[1] != 'function') {
  32647. throw new TypeError(FUNC_ERROR_TEXT);
  32648. }
  32649. return [toIteratee(pair[0]), pair[1]];
  32650. });
  32651. return baseRest(function(args) {
  32652. var index = -1;
  32653. while (++index < length) {
  32654. var pair = pairs[index];
  32655. if (apply(pair[0], this, args)) {
  32656. return apply(pair[1], this, args);
  32657. }
  32658. }
  32659. });
  32660. }
  32661. /**
  32662. * Creates a function that invokes the predicate properties of `source` with
  32663. * the corresponding property values of a given object, returning `true` if
  32664. * all predicates return truthy, else `false`.
  32665. *
  32666. * **Note:** The created function is equivalent to `_.conformsTo` with
  32667. * `source` partially applied.
  32668. *
  32669. * @static
  32670. * @memberOf _
  32671. * @since 4.0.0
  32672. * @category Util
  32673. * @param {Object} source The object of property predicates to conform to.
  32674. * @returns {Function} Returns the new spec function.
  32675. * @example
  32676. *
  32677. * var objects = [
  32678. * { 'a': 2, 'b': 1 },
  32679. * { 'a': 1, 'b': 2 }
  32680. * ];
  32681. *
  32682. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32683. * // => [{ 'a': 1, 'b': 2 }]
  32684. */
  32685. function conforms(source) {
  32686. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32687. }
  32688. /**
  32689. * Creates a function that returns `value`.
  32690. *
  32691. * @static
  32692. * @memberOf _
  32693. * @since 2.4.0
  32694. * @category Util
  32695. * @param {*} value The value to return from the new function.
  32696. * @returns {Function} Returns the new constant function.
  32697. * @example
  32698. *
  32699. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32700. *
  32701. * console.log(objects);
  32702. * // => [{ 'a': 1 }, { 'a': 1 }]
  32703. *
  32704. * console.log(objects[0] === objects[1]);
  32705. * // => true
  32706. */
  32707. function constant(value) {
  32708. return function() {
  32709. return value;
  32710. };
  32711. }
  32712. /**
  32713. * Checks `value` to determine whether a default value should be returned in
  32714. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32715. * or `undefined`.
  32716. *
  32717. * @static
  32718. * @memberOf _
  32719. * @since 4.14.0
  32720. * @category Util
  32721. * @param {*} value The value to check.
  32722. * @param {*} defaultValue The default value.
  32723. * @returns {*} Returns the resolved value.
  32724. * @example
  32725. *
  32726. * _.defaultTo(1, 10);
  32727. * // => 1
  32728. *
  32729. * _.defaultTo(undefined, 10);
  32730. * // => 10
  32731. */
  32732. function defaultTo(value, defaultValue) {
  32733. return (value == null || value !== value) ? defaultValue : value;
  32734. }
  32735. /**
  32736. * Creates a function that returns the result of invoking the given functions
  32737. * with the `this` binding of the created function, where each successive
  32738. * invocation is supplied the return value of the previous.
  32739. *
  32740. * @static
  32741. * @memberOf _
  32742. * @since 3.0.0
  32743. * @category Util
  32744. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32745. * @returns {Function} Returns the new composite function.
  32746. * @see _.flowRight
  32747. * @example
  32748. *
  32749. * function square(n) {
  32750. * return n * n;
  32751. * }
  32752. *
  32753. * var addSquare = _.flow([_.add, square]);
  32754. * addSquare(1, 2);
  32755. * // => 9
  32756. */
  32757. var flow = createFlow();
  32758. /**
  32759. * This method is like `_.flow` except that it creates a function that
  32760. * invokes the given functions from right to left.
  32761. *
  32762. * @static
  32763. * @since 3.0.0
  32764. * @memberOf _
  32765. * @category Util
  32766. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32767. * @returns {Function} Returns the new composite function.
  32768. * @see _.flow
  32769. * @example
  32770. *
  32771. * function square(n) {
  32772. * return n * n;
  32773. * }
  32774. *
  32775. * var addSquare = _.flowRight([square, _.add]);
  32776. * addSquare(1, 2);
  32777. * // => 9
  32778. */
  32779. var flowRight = createFlow(true);
  32780. /**
  32781. * This method returns the first argument it receives.
  32782. *
  32783. * @static
  32784. * @since 0.1.0
  32785. * @memberOf _
  32786. * @category Util
  32787. * @param {*} value Any value.
  32788. * @returns {*} Returns `value`.
  32789. * @example
  32790. *
  32791. * var object = { 'a': 1 };
  32792. *
  32793. * console.log(_.identity(object) === object);
  32794. * // => true
  32795. */
  32796. function identity(value) {
  32797. return value;
  32798. }
  32799. /**
  32800. * Creates a function that invokes `func` with the arguments of the created
  32801. * function. If `func` is a property name, the created function returns the
  32802. * property value for a given element. If `func` is an array or object, the
  32803. * created function returns `true` for elements that contain the equivalent
  32804. * source properties, otherwise it returns `false`.
  32805. *
  32806. * @static
  32807. * @since 4.0.0
  32808. * @memberOf _
  32809. * @category Util
  32810. * @param {*} [func=_.identity] The value to convert to a callback.
  32811. * @returns {Function} Returns the callback.
  32812. * @example
  32813. *
  32814. * var users = [
  32815. * { 'user': 'barney', 'age': 36, 'active': true },
  32816. * { 'user': 'fred', 'age': 40, 'active': false }
  32817. * ];
  32818. *
  32819. * // The `_.matches` iteratee shorthand.
  32820. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32821. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32822. *
  32823. * // The `_.matchesProperty` iteratee shorthand.
  32824. * _.filter(users, _.iteratee(['user', 'fred']));
  32825. * // => [{ 'user': 'fred', 'age': 40 }]
  32826. *
  32827. * // The `_.property` iteratee shorthand.
  32828. * _.map(users, _.iteratee('user'));
  32829. * // => ['barney', 'fred']
  32830. *
  32831. * // Create custom iteratee shorthands.
  32832. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32833. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32834. * return func.test(string);
  32835. * };
  32836. * });
  32837. *
  32838. * _.filter(['abc', 'def'], /ef/);
  32839. * // => ['def']
  32840. */
  32841. function iteratee(func) {
  32842. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32843. }
  32844. /**
  32845. * Creates a function that performs a partial deep comparison between a given
  32846. * object and `source`, returning `true` if the given object has equivalent
  32847. * property values, else `false`.
  32848. *
  32849. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32850. * partially applied.
  32851. *
  32852. * Partial comparisons will match empty array and empty object `source`
  32853. * values against any array or object value, respectively. See `_.isEqual`
  32854. * for a list of supported value comparisons.
  32855. *
  32856. * @static
  32857. * @memberOf _
  32858. * @since 3.0.0
  32859. * @category Util
  32860. * @param {Object} source The object of property values to match.
  32861. * @returns {Function} Returns the new spec function.
  32862. * @example
  32863. *
  32864. * var objects = [
  32865. * { 'a': 1, 'b': 2, 'c': 3 },
  32866. * { 'a': 4, 'b': 5, 'c': 6 }
  32867. * ];
  32868. *
  32869. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32870. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32871. */
  32872. function matches(source) {
  32873. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32874. }
  32875. /**
  32876. * Creates a function that performs a partial deep comparison between the
  32877. * value at `path` of a given object to `srcValue`, returning `true` if the
  32878. * object value is equivalent, else `false`.
  32879. *
  32880. * **Note:** Partial comparisons will match empty array and empty object
  32881. * `srcValue` values against any array or object value, respectively. See
  32882. * `_.isEqual` for a list of supported value comparisons.
  32883. *
  32884. * @static
  32885. * @memberOf _
  32886. * @since 3.2.0
  32887. * @category Util
  32888. * @param {Array|string} path The path of the property to get.
  32889. * @param {*} srcValue The value to match.
  32890. * @returns {Function} Returns the new spec function.
  32891. * @example
  32892. *
  32893. * var objects = [
  32894. * { 'a': 1, 'b': 2, 'c': 3 },
  32895. * { 'a': 4, 'b': 5, 'c': 6 }
  32896. * ];
  32897. *
  32898. * _.find(objects, _.matchesProperty('a', 4));
  32899. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32900. */
  32901. function matchesProperty(path, srcValue) {
  32902. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32903. }
  32904. /**
  32905. * Creates a function that invokes the method at `path` of a given object.
  32906. * Any additional arguments are provided to the invoked method.
  32907. *
  32908. * @static
  32909. * @memberOf _
  32910. * @since 3.7.0
  32911. * @category Util
  32912. * @param {Array|string} path The path of the method to invoke.
  32913. * @param {...*} [args] The arguments to invoke the method with.
  32914. * @returns {Function} Returns the new invoker function.
  32915. * @example
  32916. *
  32917. * var objects = [
  32918. * { 'a': { 'b': _.constant(2) } },
  32919. * { 'a': { 'b': _.constant(1) } }
  32920. * ];
  32921. *
  32922. * _.map(objects, _.method('a.b'));
  32923. * // => [2, 1]
  32924. *
  32925. * _.map(objects, _.method(['a', 'b']));
  32926. * // => [2, 1]
  32927. */
  32928. var method = baseRest(function(path, args) {
  32929. return function(object) {
  32930. return baseInvoke(object, path, args);
  32931. };
  32932. });
  32933. /**
  32934. * The opposite of `_.method`; this method creates a function that invokes
  32935. * the method at a given path of `object`. Any additional arguments are
  32936. * provided to the invoked method.
  32937. *
  32938. * @static
  32939. * @memberOf _
  32940. * @since 3.7.0
  32941. * @category Util
  32942. * @param {Object} object The object to query.
  32943. * @param {...*} [args] The arguments to invoke the method with.
  32944. * @returns {Function} Returns the new invoker function.
  32945. * @example
  32946. *
  32947. * var array = _.times(3, _.constant),
  32948. * object = { 'a': array, 'b': array, 'c': array };
  32949. *
  32950. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32951. * // => [2, 0]
  32952. *
  32953. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32954. * // => [2, 0]
  32955. */
  32956. var methodOf = baseRest(function(object, args) {
  32957. return function(path) {
  32958. return baseInvoke(object, path, args);
  32959. };
  32960. });
  32961. /**
  32962. * Adds all own enumerable string keyed function properties of a source
  32963. * object to the destination object. If `object` is a function, then methods
  32964. * are added to its prototype as well.
  32965. *
  32966. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32967. * avoid conflicts caused by modifying the original.
  32968. *
  32969. * @static
  32970. * @since 0.1.0
  32971. * @memberOf _
  32972. * @category Util
  32973. * @param {Function|Object} [object=lodash] The destination object.
  32974. * @param {Object} source The object of functions to add.
  32975. * @param {Object} [options={}] The options object.
  32976. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32977. * @returns {Function|Object} Returns `object`.
  32978. * @example
  32979. *
  32980. * function vowels(string) {
  32981. * return _.filter(string, function(v) {
  32982. * return /[aeiou]/i.test(v);
  32983. * });
  32984. * }
  32985. *
  32986. * _.mixin({ 'vowels': vowels });
  32987. * _.vowels('fred');
  32988. * // => ['e']
  32989. *
  32990. * _('fred').vowels().value();
  32991. * // => ['e']
  32992. *
  32993. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32994. * _('fred').vowels();
  32995. * // => ['e']
  32996. */
  32997. function mixin(object, source, options) {
  32998. var props = keys(source),
  32999. methodNames = baseFunctions(source, props);
  33000. if (options == null &&
  33001. !(isObject(source) && (methodNames.length || !props.length))) {
  33002. options = source;
  33003. source = object;
  33004. object = this;
  33005. methodNames = baseFunctions(source, keys(source));
  33006. }
  33007. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33008. isFunc = isFunction(object);
  33009. arrayEach(methodNames, function(methodName) {
  33010. var func = source[methodName];
  33011. object[methodName] = func;
  33012. if (isFunc) {
  33013. object.prototype[methodName] = function() {
  33014. var chainAll = this.__chain__;
  33015. if (chain || chainAll) {
  33016. var result = object(this.__wrapped__),
  33017. actions = result.__actions__ = copyArray(this.__actions__);
  33018. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33019. result.__chain__ = chainAll;
  33020. return result;
  33021. }
  33022. return func.apply(object, arrayPush([this.value()], arguments));
  33023. };
  33024. }
  33025. });
  33026. return object;
  33027. }
  33028. /**
  33029. * Reverts the `_` variable to its previous value and returns a reference to
  33030. * the `lodash` function.
  33031. *
  33032. * @static
  33033. * @since 0.1.0
  33034. * @memberOf _
  33035. * @category Util
  33036. * @returns {Function} Returns the `lodash` function.
  33037. * @example
  33038. *
  33039. * var lodash = _.noConflict();
  33040. */
  33041. function noConflict() {
  33042. if (root._ === this) {
  33043. root._ = oldDash;
  33044. }
  33045. return this;
  33046. }
  33047. /**
  33048. * This method returns `undefined`.
  33049. *
  33050. * @static
  33051. * @memberOf _
  33052. * @since 2.3.0
  33053. * @category Util
  33054. * @example
  33055. *
  33056. * _.times(2, _.noop);
  33057. * // => [undefined, undefined]
  33058. */
  33059. function noop() {
  33060. // No operation performed.
  33061. }
  33062. /**
  33063. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33064. * the nth argument from the end is returned.
  33065. *
  33066. * @static
  33067. * @memberOf _
  33068. * @since 4.0.0
  33069. * @category Util
  33070. * @param {number} [n=0] The index of the argument to return.
  33071. * @returns {Function} Returns the new pass-thru function.
  33072. * @example
  33073. *
  33074. * var func = _.nthArg(1);
  33075. * func('a', 'b', 'c', 'd');
  33076. * // => 'b'
  33077. *
  33078. * var func = _.nthArg(-2);
  33079. * func('a', 'b', 'c', 'd');
  33080. * // => 'c'
  33081. */
  33082. function nthArg(n) {
  33083. n = toInteger(n);
  33084. return baseRest(function(args) {
  33085. return baseNth(args, n);
  33086. });
  33087. }
  33088. /**
  33089. * Creates a function that invokes `iteratees` with the arguments it receives
  33090. * and returns their results.
  33091. *
  33092. * @static
  33093. * @memberOf _
  33094. * @since 4.0.0
  33095. * @category Util
  33096. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33097. * The iteratees to invoke.
  33098. * @returns {Function} Returns the new function.
  33099. * @example
  33100. *
  33101. * var func = _.over([Math.max, Math.min]);
  33102. *
  33103. * func(1, 2, 3, 4);
  33104. * // => [4, 1]
  33105. */
  33106. var over = createOver(arrayMap);
  33107. /**
  33108. * Creates a function that checks if **all** of the `predicates` return
  33109. * truthy when invoked with the arguments it receives.
  33110. *
  33111. * @static
  33112. * @memberOf _
  33113. * @since 4.0.0
  33114. * @category Util
  33115. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33116. * The predicates to check.
  33117. * @returns {Function} Returns the new function.
  33118. * @example
  33119. *
  33120. * var func = _.overEvery([Boolean, isFinite]);
  33121. *
  33122. * func('1');
  33123. * // => true
  33124. *
  33125. * func(null);
  33126. * // => false
  33127. *
  33128. * func(NaN);
  33129. * // => false
  33130. */
  33131. var overEvery = createOver(arrayEvery);
  33132. /**
  33133. * Creates a function that checks if **any** of the `predicates` return
  33134. * truthy when invoked with the arguments it receives.
  33135. *
  33136. * @static
  33137. * @memberOf _
  33138. * @since 4.0.0
  33139. * @category Util
  33140. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33141. * The predicates to check.
  33142. * @returns {Function} Returns the new function.
  33143. * @example
  33144. *
  33145. * var func = _.overSome([Boolean, isFinite]);
  33146. *
  33147. * func('1');
  33148. * // => true
  33149. *
  33150. * func(null);
  33151. * // => true
  33152. *
  33153. * func(NaN);
  33154. * // => false
  33155. */
  33156. var overSome = createOver(arraySome);
  33157. /**
  33158. * Creates a function that returns the value at `path` of a given object.
  33159. *
  33160. * @static
  33161. * @memberOf _
  33162. * @since 2.4.0
  33163. * @category Util
  33164. * @param {Array|string} path The path of the property to get.
  33165. * @returns {Function} Returns the new accessor function.
  33166. * @example
  33167. *
  33168. * var objects = [
  33169. * { 'a': { 'b': 2 } },
  33170. * { 'a': { 'b': 1 } }
  33171. * ];
  33172. *
  33173. * _.map(objects, _.property('a.b'));
  33174. * // => [2, 1]
  33175. *
  33176. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33177. * // => [1, 2]
  33178. */
  33179. function property(path) {
  33180. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33181. }
  33182. /**
  33183. * The opposite of `_.property`; this method creates a function that returns
  33184. * the value at a given path of `object`.
  33185. *
  33186. * @static
  33187. * @memberOf _
  33188. * @since 3.0.0
  33189. * @category Util
  33190. * @param {Object} object The object to query.
  33191. * @returns {Function} Returns the new accessor function.
  33192. * @example
  33193. *
  33194. * var array = [0, 1, 2],
  33195. * object = { 'a': array, 'b': array, 'c': array };
  33196. *
  33197. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33198. * // => [2, 0]
  33199. *
  33200. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33201. * // => [2, 0]
  33202. */
  33203. function propertyOf(object) {
  33204. return function(path) {
  33205. return object == null ? undefined : baseGet(object, path);
  33206. };
  33207. }
  33208. /**
  33209. * Creates an array of numbers (positive and/or negative) progressing from
  33210. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33211. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33212. * it's set to `start` with `start` then set to `0`.
  33213. *
  33214. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33215. * floating-point values which can produce unexpected results.
  33216. *
  33217. * @static
  33218. * @since 0.1.0
  33219. * @memberOf _
  33220. * @category Util
  33221. * @param {number} [start=0] The start of the range.
  33222. * @param {number} end The end of the range.
  33223. * @param {number} [step=1] The value to increment or decrement by.
  33224. * @returns {Array} Returns the range of numbers.
  33225. * @see _.inRange, _.rangeRight
  33226. * @example
  33227. *
  33228. * _.range(4);
  33229. * // => [0, 1, 2, 3]
  33230. *
  33231. * _.range(-4);
  33232. * // => [0, -1, -2, -3]
  33233. *
  33234. * _.range(1, 5);
  33235. * // => [1, 2, 3, 4]
  33236. *
  33237. * _.range(0, 20, 5);
  33238. * // => [0, 5, 10, 15]
  33239. *
  33240. * _.range(0, -4, -1);
  33241. * // => [0, -1, -2, -3]
  33242. *
  33243. * _.range(1, 4, 0);
  33244. * // => [1, 1, 1]
  33245. *
  33246. * _.range(0);
  33247. * // => []
  33248. */
  33249. var range = createRange();
  33250. /**
  33251. * This method is like `_.range` except that it populates values in
  33252. * descending order.
  33253. *
  33254. * @static
  33255. * @memberOf _
  33256. * @since 4.0.0
  33257. * @category Util
  33258. * @param {number} [start=0] The start of the range.
  33259. * @param {number} end The end of the range.
  33260. * @param {number} [step=1] The value to increment or decrement by.
  33261. * @returns {Array} Returns the range of numbers.
  33262. * @see _.inRange, _.range
  33263. * @example
  33264. *
  33265. * _.rangeRight(4);
  33266. * // => [3, 2, 1, 0]
  33267. *
  33268. * _.rangeRight(-4);
  33269. * // => [-3, -2, -1, 0]
  33270. *
  33271. * _.rangeRight(1, 5);
  33272. * // => [4, 3, 2, 1]
  33273. *
  33274. * _.rangeRight(0, 20, 5);
  33275. * // => [15, 10, 5, 0]
  33276. *
  33277. * _.rangeRight(0, -4, -1);
  33278. * // => [-3, -2, -1, 0]
  33279. *
  33280. * _.rangeRight(1, 4, 0);
  33281. * // => [1, 1, 1]
  33282. *
  33283. * _.rangeRight(0);
  33284. * // => []
  33285. */
  33286. var rangeRight = createRange(true);
  33287. /**
  33288. * This method returns a new empty array.
  33289. *
  33290. * @static
  33291. * @memberOf _
  33292. * @since 4.13.0
  33293. * @category Util
  33294. * @returns {Array} Returns the new empty array.
  33295. * @example
  33296. *
  33297. * var arrays = _.times(2, _.stubArray);
  33298. *
  33299. * console.log(arrays);
  33300. * // => [[], []]
  33301. *
  33302. * console.log(arrays[0] === arrays[1]);
  33303. * // => false
  33304. */
  33305. function stubArray() {
  33306. return [];
  33307. }
  33308. /**
  33309. * This method returns `false`.
  33310. *
  33311. * @static
  33312. * @memberOf _
  33313. * @since 4.13.0
  33314. * @category Util
  33315. * @returns {boolean} Returns `false`.
  33316. * @example
  33317. *
  33318. * _.times(2, _.stubFalse);
  33319. * // => [false, false]
  33320. */
  33321. function stubFalse() {
  33322. return false;
  33323. }
  33324. /**
  33325. * This method returns a new empty object.
  33326. *
  33327. * @static
  33328. * @memberOf _
  33329. * @since 4.13.0
  33330. * @category Util
  33331. * @returns {Object} Returns the new empty object.
  33332. * @example
  33333. *
  33334. * var objects = _.times(2, _.stubObject);
  33335. *
  33336. * console.log(objects);
  33337. * // => [{}, {}]
  33338. *
  33339. * console.log(objects[0] === objects[1]);
  33340. * // => false
  33341. */
  33342. function stubObject() {
  33343. return {};
  33344. }
  33345. /**
  33346. * This method returns an empty string.
  33347. *
  33348. * @static
  33349. * @memberOf _
  33350. * @since 4.13.0
  33351. * @category Util
  33352. * @returns {string} Returns the empty string.
  33353. * @example
  33354. *
  33355. * _.times(2, _.stubString);
  33356. * // => ['', '']
  33357. */
  33358. function stubString() {
  33359. return '';
  33360. }
  33361. /**
  33362. * This method returns `true`.
  33363. *
  33364. * @static
  33365. * @memberOf _
  33366. * @since 4.13.0
  33367. * @category Util
  33368. * @returns {boolean} Returns `true`.
  33369. * @example
  33370. *
  33371. * _.times(2, _.stubTrue);
  33372. * // => [true, true]
  33373. */
  33374. function stubTrue() {
  33375. return true;
  33376. }
  33377. /**
  33378. * Invokes the iteratee `n` times, returning an array of the results of
  33379. * each invocation. The iteratee is invoked with one argument; (index).
  33380. *
  33381. * @static
  33382. * @since 0.1.0
  33383. * @memberOf _
  33384. * @category Util
  33385. * @param {number} n The number of times to invoke `iteratee`.
  33386. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33387. * @returns {Array} Returns the array of results.
  33388. * @example
  33389. *
  33390. * _.times(3, String);
  33391. * // => ['0', '1', '2']
  33392. *
  33393. * _.times(4, _.constant(0));
  33394. * // => [0, 0, 0, 0]
  33395. */
  33396. function times(n, iteratee) {
  33397. n = toInteger(n);
  33398. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33399. return [];
  33400. }
  33401. var index = MAX_ARRAY_LENGTH,
  33402. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33403. iteratee = getIteratee(iteratee);
  33404. n -= MAX_ARRAY_LENGTH;
  33405. var result = baseTimes(length, iteratee);
  33406. while (++index < n) {
  33407. iteratee(index);
  33408. }
  33409. return result;
  33410. }
  33411. /**
  33412. * Converts `value` to a property path array.
  33413. *
  33414. * @static
  33415. * @memberOf _
  33416. * @since 4.0.0
  33417. * @category Util
  33418. * @param {*} value The value to convert.
  33419. * @returns {Array} Returns the new property path array.
  33420. * @example
  33421. *
  33422. * _.toPath('a.b.c');
  33423. * // => ['a', 'b', 'c']
  33424. *
  33425. * _.toPath('a[0].b.c');
  33426. * // => ['a', '0', 'b', 'c']
  33427. */
  33428. function toPath(value) {
  33429. if (isArray(value)) {
  33430. return arrayMap(value, toKey);
  33431. }
  33432. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33433. }
  33434. /**
  33435. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33436. *
  33437. * @static
  33438. * @since 0.1.0
  33439. * @memberOf _
  33440. * @category Util
  33441. * @param {string} [prefix=''] The value to prefix the ID with.
  33442. * @returns {string} Returns the unique ID.
  33443. * @example
  33444. *
  33445. * _.uniqueId('contact_');
  33446. * // => 'contact_104'
  33447. *
  33448. * _.uniqueId();
  33449. * // => '105'
  33450. */
  33451. function uniqueId(prefix) {
  33452. var id = ++idCounter;
  33453. return toString(prefix) + id;
  33454. }
  33455. /*------------------------------------------------------------------------*/
  33456. /**
  33457. * Adds two numbers.
  33458. *
  33459. * @static
  33460. * @memberOf _
  33461. * @since 3.4.0
  33462. * @category Math
  33463. * @param {number} augend The first number in an addition.
  33464. * @param {number} addend The second number in an addition.
  33465. * @returns {number} Returns the total.
  33466. * @example
  33467. *
  33468. * _.add(6, 4);
  33469. * // => 10
  33470. */
  33471. var add = createMathOperation(function(augend, addend) {
  33472. return augend + addend;
  33473. }, 0);
  33474. /**
  33475. * Computes `number` rounded up to `precision`.
  33476. *
  33477. * @static
  33478. * @memberOf _
  33479. * @since 3.10.0
  33480. * @category Math
  33481. * @param {number} number The number to round up.
  33482. * @param {number} [precision=0] The precision to round up to.
  33483. * @returns {number} Returns the rounded up number.
  33484. * @example
  33485. *
  33486. * _.ceil(4.006);
  33487. * // => 5
  33488. *
  33489. * _.ceil(6.004, 2);
  33490. * // => 6.01
  33491. *
  33492. * _.ceil(6040, -2);
  33493. * // => 6100
  33494. */
  33495. var ceil = createRound('ceil');
  33496. /**
  33497. * Divide two numbers.
  33498. *
  33499. * @static
  33500. * @memberOf _
  33501. * @since 4.7.0
  33502. * @category Math
  33503. * @param {number} dividend The first number in a division.
  33504. * @param {number} divisor The second number in a division.
  33505. * @returns {number} Returns the quotient.
  33506. * @example
  33507. *
  33508. * _.divide(6, 4);
  33509. * // => 1.5
  33510. */
  33511. var divide = createMathOperation(function(dividend, divisor) {
  33512. return dividend / divisor;
  33513. }, 1);
  33514. /**
  33515. * Computes `number` rounded down to `precision`.
  33516. *
  33517. * @static
  33518. * @memberOf _
  33519. * @since 3.10.0
  33520. * @category Math
  33521. * @param {number} number The number to round down.
  33522. * @param {number} [precision=0] The precision to round down to.
  33523. * @returns {number} Returns the rounded down number.
  33524. * @example
  33525. *
  33526. * _.floor(4.006);
  33527. * // => 4
  33528. *
  33529. * _.floor(0.046, 2);
  33530. * // => 0.04
  33531. *
  33532. * _.floor(4060, -2);
  33533. * // => 4000
  33534. */
  33535. var floor = createRound('floor');
  33536. /**
  33537. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33538. * `undefined` is returned.
  33539. *
  33540. * @static
  33541. * @since 0.1.0
  33542. * @memberOf _
  33543. * @category Math
  33544. * @param {Array} array The array to iterate over.
  33545. * @returns {*} Returns the maximum value.
  33546. * @example
  33547. *
  33548. * _.max([4, 2, 8, 6]);
  33549. * // => 8
  33550. *
  33551. * _.max([]);
  33552. * // => undefined
  33553. */
  33554. function max(array) {
  33555. return (array && array.length)
  33556. ? baseExtremum(array, identity, baseGt)
  33557. : undefined;
  33558. }
  33559. /**
  33560. * This method is like `_.max` except that it accepts `iteratee` which is
  33561. * invoked for each element in `array` to generate the criterion by which
  33562. * the value is ranked. The iteratee is invoked with one argument: (value).
  33563. *
  33564. * @static
  33565. * @memberOf _
  33566. * @since 4.0.0
  33567. * @category Math
  33568. * @param {Array} array The array to iterate over.
  33569. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33570. * @returns {*} Returns the maximum value.
  33571. * @example
  33572. *
  33573. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33574. *
  33575. * _.maxBy(objects, function(o) { return o.n; });
  33576. * // => { 'n': 2 }
  33577. *
  33578. * // The `_.property` iteratee shorthand.
  33579. * _.maxBy(objects, 'n');
  33580. * // => { 'n': 2 }
  33581. */
  33582. function maxBy(array, iteratee) {
  33583. return (array && array.length)
  33584. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33585. : undefined;
  33586. }
  33587. /**
  33588. * Computes the mean of the values in `array`.
  33589. *
  33590. * @static
  33591. * @memberOf _
  33592. * @since 4.0.0
  33593. * @category Math
  33594. * @param {Array} array The array to iterate over.
  33595. * @returns {number} Returns the mean.
  33596. * @example
  33597. *
  33598. * _.mean([4, 2, 8, 6]);
  33599. * // => 5
  33600. */
  33601. function mean(array) {
  33602. return baseMean(array, identity);
  33603. }
  33604. /**
  33605. * This method is like `_.mean` except that it accepts `iteratee` which is
  33606. * invoked for each element in `array` to generate the value to be averaged.
  33607. * The iteratee is invoked with one argument: (value).
  33608. *
  33609. * @static
  33610. * @memberOf _
  33611. * @since 4.7.0
  33612. * @category Math
  33613. * @param {Array} array The array to iterate over.
  33614. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33615. * @returns {number} Returns the mean.
  33616. * @example
  33617. *
  33618. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33619. *
  33620. * _.meanBy(objects, function(o) { return o.n; });
  33621. * // => 5
  33622. *
  33623. * // The `_.property` iteratee shorthand.
  33624. * _.meanBy(objects, 'n');
  33625. * // => 5
  33626. */
  33627. function meanBy(array, iteratee) {
  33628. return baseMean(array, getIteratee(iteratee, 2));
  33629. }
  33630. /**
  33631. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33632. * `undefined` is returned.
  33633. *
  33634. * @static
  33635. * @since 0.1.0
  33636. * @memberOf _
  33637. * @category Math
  33638. * @param {Array} array The array to iterate over.
  33639. * @returns {*} Returns the minimum value.
  33640. * @example
  33641. *
  33642. * _.min([4, 2, 8, 6]);
  33643. * // => 2
  33644. *
  33645. * _.min([]);
  33646. * // => undefined
  33647. */
  33648. function min(array) {
  33649. return (array && array.length)
  33650. ? baseExtremum(array, identity, baseLt)
  33651. : undefined;
  33652. }
  33653. /**
  33654. * This method is like `_.min` except that it accepts `iteratee` which is
  33655. * invoked for each element in `array` to generate the criterion by which
  33656. * the value is ranked. The iteratee is invoked with one argument: (value).
  33657. *
  33658. * @static
  33659. * @memberOf _
  33660. * @since 4.0.0
  33661. * @category Math
  33662. * @param {Array} array The array to iterate over.
  33663. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33664. * @returns {*} Returns the minimum value.
  33665. * @example
  33666. *
  33667. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33668. *
  33669. * _.minBy(objects, function(o) { return o.n; });
  33670. * // => { 'n': 1 }
  33671. *
  33672. * // The `_.property` iteratee shorthand.
  33673. * _.minBy(objects, 'n');
  33674. * // => { 'n': 1 }
  33675. */
  33676. function minBy(array, iteratee) {
  33677. return (array && array.length)
  33678. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33679. : undefined;
  33680. }
  33681. /**
  33682. * Multiply two numbers.
  33683. *
  33684. * @static
  33685. * @memberOf _
  33686. * @since 4.7.0
  33687. * @category Math
  33688. * @param {number} multiplier The first number in a multiplication.
  33689. * @param {number} multiplicand The second number in a multiplication.
  33690. * @returns {number} Returns the product.
  33691. * @example
  33692. *
  33693. * _.multiply(6, 4);
  33694. * // => 24
  33695. */
  33696. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33697. return multiplier * multiplicand;
  33698. }, 1);
  33699. /**
  33700. * Computes `number` rounded to `precision`.
  33701. *
  33702. * @static
  33703. * @memberOf _
  33704. * @since 3.10.0
  33705. * @category Math
  33706. * @param {number} number The number to round.
  33707. * @param {number} [precision=0] The precision to round to.
  33708. * @returns {number} Returns the rounded number.
  33709. * @example
  33710. *
  33711. * _.round(4.006);
  33712. * // => 4
  33713. *
  33714. * _.round(4.006, 2);
  33715. * // => 4.01
  33716. *
  33717. * _.round(4060, -2);
  33718. * // => 4100
  33719. */
  33720. var round = createRound('round');
  33721. /**
  33722. * Subtract two numbers.
  33723. *
  33724. * @static
  33725. * @memberOf _
  33726. * @since 4.0.0
  33727. * @category Math
  33728. * @param {number} minuend The first number in a subtraction.
  33729. * @param {number} subtrahend The second number in a subtraction.
  33730. * @returns {number} Returns the difference.
  33731. * @example
  33732. *
  33733. * _.subtract(6, 4);
  33734. * // => 2
  33735. */
  33736. var subtract = createMathOperation(function(minuend, subtrahend) {
  33737. return minuend - subtrahend;
  33738. }, 0);
  33739. /**
  33740. * Computes the sum of the values in `array`.
  33741. *
  33742. * @static
  33743. * @memberOf _
  33744. * @since 3.4.0
  33745. * @category Math
  33746. * @param {Array} array The array to iterate over.
  33747. * @returns {number} Returns the sum.
  33748. * @example
  33749. *
  33750. * _.sum([4, 2, 8, 6]);
  33751. * // => 20
  33752. */
  33753. function sum(array) {
  33754. return (array && array.length)
  33755. ? baseSum(array, identity)
  33756. : 0;
  33757. }
  33758. /**
  33759. * This method is like `_.sum` except that it accepts `iteratee` which is
  33760. * invoked for each element in `array` to generate the value to be summed.
  33761. * The iteratee is invoked with one argument: (value).
  33762. *
  33763. * @static
  33764. * @memberOf _
  33765. * @since 4.0.0
  33766. * @category Math
  33767. * @param {Array} array The array to iterate over.
  33768. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33769. * @returns {number} Returns the sum.
  33770. * @example
  33771. *
  33772. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33773. *
  33774. * _.sumBy(objects, function(o) { return o.n; });
  33775. * // => 20
  33776. *
  33777. * // The `_.property` iteratee shorthand.
  33778. * _.sumBy(objects, 'n');
  33779. * // => 20
  33780. */
  33781. function sumBy(array, iteratee) {
  33782. return (array && array.length)
  33783. ? baseSum(array, getIteratee(iteratee, 2))
  33784. : 0;
  33785. }
  33786. /*------------------------------------------------------------------------*/
  33787. // Add methods that return wrapped values in chain sequences.
  33788. lodash.after = after;
  33789. lodash.ary = ary;
  33790. lodash.assign = assign;
  33791. lodash.assignIn = assignIn;
  33792. lodash.assignInWith = assignInWith;
  33793. lodash.assignWith = assignWith;
  33794. lodash.at = at;
  33795. lodash.before = before;
  33796. lodash.bind = bind;
  33797. lodash.bindAll = bindAll;
  33798. lodash.bindKey = bindKey;
  33799. lodash.castArray = castArray;
  33800. lodash.chain = chain;
  33801. lodash.chunk = chunk;
  33802. lodash.compact = compact;
  33803. lodash.concat = concat;
  33804. lodash.cond = cond;
  33805. lodash.conforms = conforms;
  33806. lodash.constant = constant;
  33807. lodash.countBy = countBy;
  33808. lodash.create = create;
  33809. lodash.curry = curry;
  33810. lodash.curryRight = curryRight;
  33811. lodash.debounce = debounce;
  33812. lodash.defaults = defaults;
  33813. lodash.defaultsDeep = defaultsDeep;
  33814. lodash.defer = defer;
  33815. lodash.delay = delay;
  33816. lodash.difference = difference;
  33817. lodash.differenceBy = differenceBy;
  33818. lodash.differenceWith = differenceWith;
  33819. lodash.drop = drop;
  33820. lodash.dropRight = dropRight;
  33821. lodash.dropRightWhile = dropRightWhile;
  33822. lodash.dropWhile = dropWhile;
  33823. lodash.fill = fill;
  33824. lodash.filter = filter;
  33825. lodash.flatMap = flatMap;
  33826. lodash.flatMapDeep = flatMapDeep;
  33827. lodash.flatMapDepth = flatMapDepth;
  33828. lodash.flatten = flatten;
  33829. lodash.flattenDeep = flattenDeep;
  33830. lodash.flattenDepth = flattenDepth;
  33831. lodash.flip = flip;
  33832. lodash.flow = flow;
  33833. lodash.flowRight = flowRight;
  33834. lodash.fromPairs = fromPairs;
  33835. lodash.functions = functions;
  33836. lodash.functionsIn = functionsIn;
  33837. lodash.groupBy = groupBy;
  33838. lodash.initial = initial;
  33839. lodash.intersection = intersection;
  33840. lodash.intersectionBy = intersectionBy;
  33841. lodash.intersectionWith = intersectionWith;
  33842. lodash.invert = invert;
  33843. lodash.invertBy = invertBy;
  33844. lodash.invokeMap = invokeMap;
  33845. lodash.iteratee = iteratee;
  33846. lodash.keyBy = keyBy;
  33847. lodash.keys = keys;
  33848. lodash.keysIn = keysIn;
  33849. lodash.map = map;
  33850. lodash.mapKeys = mapKeys;
  33851. lodash.mapValues = mapValues;
  33852. lodash.matches = matches;
  33853. lodash.matchesProperty = matchesProperty;
  33854. lodash.memoize = memoize;
  33855. lodash.merge = merge;
  33856. lodash.mergeWith = mergeWith;
  33857. lodash.method = method;
  33858. lodash.methodOf = methodOf;
  33859. lodash.mixin = mixin;
  33860. lodash.negate = negate;
  33861. lodash.nthArg = nthArg;
  33862. lodash.omit = omit;
  33863. lodash.omitBy = omitBy;
  33864. lodash.once = once;
  33865. lodash.orderBy = orderBy;
  33866. lodash.over = over;
  33867. lodash.overArgs = overArgs;
  33868. lodash.overEvery = overEvery;
  33869. lodash.overSome = overSome;
  33870. lodash.partial = partial;
  33871. lodash.partialRight = partialRight;
  33872. lodash.partition = partition;
  33873. lodash.pick = pick;
  33874. lodash.pickBy = pickBy;
  33875. lodash.property = property;
  33876. lodash.propertyOf = propertyOf;
  33877. lodash.pull = pull;
  33878. lodash.pullAll = pullAll;
  33879. lodash.pullAllBy = pullAllBy;
  33880. lodash.pullAllWith = pullAllWith;
  33881. lodash.pullAt = pullAt;
  33882. lodash.range = range;
  33883. lodash.rangeRight = rangeRight;
  33884. lodash.rearg = rearg;
  33885. lodash.reject = reject;
  33886. lodash.remove = remove;
  33887. lodash.rest = rest;
  33888. lodash.reverse = reverse;
  33889. lodash.sampleSize = sampleSize;
  33890. lodash.set = set;
  33891. lodash.setWith = setWith;
  33892. lodash.shuffle = shuffle;
  33893. lodash.slice = slice;
  33894. lodash.sortBy = sortBy;
  33895. lodash.sortedUniq = sortedUniq;
  33896. lodash.sortedUniqBy = sortedUniqBy;
  33897. lodash.split = split;
  33898. lodash.spread = spread;
  33899. lodash.tail = tail;
  33900. lodash.take = take;
  33901. lodash.takeRight = takeRight;
  33902. lodash.takeRightWhile = takeRightWhile;
  33903. lodash.takeWhile = takeWhile;
  33904. lodash.tap = tap;
  33905. lodash.throttle = throttle;
  33906. lodash.thru = thru;
  33907. lodash.toArray = toArray;
  33908. lodash.toPairs = toPairs;
  33909. lodash.toPairsIn = toPairsIn;
  33910. lodash.toPath = toPath;
  33911. lodash.toPlainObject = toPlainObject;
  33912. lodash.transform = transform;
  33913. lodash.unary = unary;
  33914. lodash.union = union;
  33915. lodash.unionBy = unionBy;
  33916. lodash.unionWith = unionWith;
  33917. lodash.uniq = uniq;
  33918. lodash.uniqBy = uniqBy;
  33919. lodash.uniqWith = uniqWith;
  33920. lodash.unset = unset;
  33921. lodash.unzip = unzip;
  33922. lodash.unzipWith = unzipWith;
  33923. lodash.update = update;
  33924. lodash.updateWith = updateWith;
  33925. lodash.values = values;
  33926. lodash.valuesIn = valuesIn;
  33927. lodash.without = without;
  33928. lodash.words = words;
  33929. lodash.wrap = wrap;
  33930. lodash.xor = xor;
  33931. lodash.xorBy = xorBy;
  33932. lodash.xorWith = xorWith;
  33933. lodash.zip = zip;
  33934. lodash.zipObject = zipObject;
  33935. lodash.zipObjectDeep = zipObjectDeep;
  33936. lodash.zipWith = zipWith;
  33937. // Add aliases.
  33938. lodash.entries = toPairs;
  33939. lodash.entriesIn = toPairsIn;
  33940. lodash.extend = assignIn;
  33941. lodash.extendWith = assignInWith;
  33942. // Add methods to `lodash.prototype`.
  33943. mixin(lodash, lodash);
  33944. /*------------------------------------------------------------------------*/
  33945. // Add methods that return unwrapped values in chain sequences.
  33946. lodash.add = add;
  33947. lodash.attempt = attempt;
  33948. lodash.camelCase = camelCase;
  33949. lodash.capitalize = capitalize;
  33950. lodash.ceil = ceil;
  33951. lodash.clamp = clamp;
  33952. lodash.clone = clone;
  33953. lodash.cloneDeep = cloneDeep;
  33954. lodash.cloneDeepWith = cloneDeepWith;
  33955. lodash.cloneWith = cloneWith;
  33956. lodash.conformsTo = conformsTo;
  33957. lodash.deburr = deburr;
  33958. lodash.defaultTo = defaultTo;
  33959. lodash.divide = divide;
  33960. lodash.endsWith = endsWith;
  33961. lodash.eq = eq;
  33962. lodash.escape = escape;
  33963. lodash.escapeRegExp = escapeRegExp;
  33964. lodash.every = every;
  33965. lodash.find = find;
  33966. lodash.findIndex = findIndex;
  33967. lodash.findKey = findKey;
  33968. lodash.findLast = findLast;
  33969. lodash.findLastIndex = findLastIndex;
  33970. lodash.findLastKey = findLastKey;
  33971. lodash.floor = floor;
  33972. lodash.forEach = forEach;
  33973. lodash.forEachRight = forEachRight;
  33974. lodash.forIn = forIn;
  33975. lodash.forInRight = forInRight;
  33976. lodash.forOwn = forOwn;
  33977. lodash.forOwnRight = forOwnRight;
  33978. lodash.get = get;
  33979. lodash.gt = gt;
  33980. lodash.gte = gte;
  33981. lodash.has = has;
  33982. lodash.hasIn = hasIn;
  33983. lodash.head = head;
  33984. lodash.identity = identity;
  33985. lodash.includes = includes;
  33986. lodash.indexOf = indexOf;
  33987. lodash.inRange = inRange;
  33988. lodash.invoke = invoke;
  33989. lodash.isArguments = isArguments;
  33990. lodash.isArray = isArray;
  33991. lodash.isArrayBuffer = isArrayBuffer;
  33992. lodash.isArrayLike = isArrayLike;
  33993. lodash.isArrayLikeObject = isArrayLikeObject;
  33994. lodash.isBoolean = isBoolean;
  33995. lodash.isBuffer = isBuffer;
  33996. lodash.isDate = isDate;
  33997. lodash.isElement = isElement;
  33998. lodash.isEmpty = isEmpty;
  33999. lodash.isEqual = isEqual;
  34000. lodash.isEqualWith = isEqualWith;
  34001. lodash.isError = isError;
  34002. lodash.isFinite = isFinite;
  34003. lodash.isFunction = isFunction;
  34004. lodash.isInteger = isInteger;
  34005. lodash.isLength = isLength;
  34006. lodash.isMap = isMap;
  34007. lodash.isMatch = isMatch;
  34008. lodash.isMatchWith = isMatchWith;
  34009. lodash.isNaN = isNaN;
  34010. lodash.isNative = isNative;
  34011. lodash.isNil = isNil;
  34012. lodash.isNull = isNull;
  34013. lodash.isNumber = isNumber;
  34014. lodash.isObject = isObject;
  34015. lodash.isObjectLike = isObjectLike;
  34016. lodash.isPlainObject = isPlainObject;
  34017. lodash.isRegExp = isRegExp;
  34018. lodash.isSafeInteger = isSafeInteger;
  34019. lodash.isSet = isSet;
  34020. lodash.isString = isString;
  34021. lodash.isSymbol = isSymbol;
  34022. lodash.isTypedArray = isTypedArray;
  34023. lodash.isUndefined = isUndefined;
  34024. lodash.isWeakMap = isWeakMap;
  34025. lodash.isWeakSet = isWeakSet;
  34026. lodash.join = join;
  34027. lodash.kebabCase = kebabCase;
  34028. lodash.last = last;
  34029. lodash.lastIndexOf = lastIndexOf;
  34030. lodash.lowerCase = lowerCase;
  34031. lodash.lowerFirst = lowerFirst;
  34032. lodash.lt = lt;
  34033. lodash.lte = lte;
  34034. lodash.max = max;
  34035. lodash.maxBy = maxBy;
  34036. lodash.mean = mean;
  34037. lodash.meanBy = meanBy;
  34038. lodash.min = min;
  34039. lodash.minBy = minBy;
  34040. lodash.stubArray = stubArray;
  34041. lodash.stubFalse = stubFalse;
  34042. lodash.stubObject = stubObject;
  34043. lodash.stubString = stubString;
  34044. lodash.stubTrue = stubTrue;
  34045. lodash.multiply = multiply;
  34046. lodash.nth = nth;
  34047. lodash.noConflict = noConflict;
  34048. lodash.noop = noop;
  34049. lodash.now = now;
  34050. lodash.pad = pad;
  34051. lodash.padEnd = padEnd;
  34052. lodash.padStart = padStart;
  34053. lodash.parseInt = parseInt;
  34054. lodash.random = random;
  34055. lodash.reduce = reduce;
  34056. lodash.reduceRight = reduceRight;
  34057. lodash.repeat = repeat;
  34058. lodash.replace = replace;
  34059. lodash.result = result;
  34060. lodash.round = round;
  34061. lodash.runInContext = runInContext;
  34062. lodash.sample = sample;
  34063. lodash.size = size;
  34064. lodash.snakeCase = snakeCase;
  34065. lodash.some = some;
  34066. lodash.sortedIndex = sortedIndex;
  34067. lodash.sortedIndexBy = sortedIndexBy;
  34068. lodash.sortedIndexOf = sortedIndexOf;
  34069. lodash.sortedLastIndex = sortedLastIndex;
  34070. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34071. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34072. lodash.startCase = startCase;
  34073. lodash.startsWith = startsWith;
  34074. lodash.subtract = subtract;
  34075. lodash.sum = sum;
  34076. lodash.sumBy = sumBy;
  34077. lodash.template = template;
  34078. lodash.times = times;
  34079. lodash.toFinite = toFinite;
  34080. lodash.toInteger = toInteger;
  34081. lodash.toLength = toLength;
  34082. lodash.toLower = toLower;
  34083. lodash.toNumber = toNumber;
  34084. lodash.toSafeInteger = toSafeInteger;
  34085. lodash.toString = toString;
  34086. lodash.toUpper = toUpper;
  34087. lodash.trim = trim;
  34088. lodash.trimEnd = trimEnd;
  34089. lodash.trimStart = trimStart;
  34090. lodash.truncate = truncate;
  34091. lodash.unescape = unescape;
  34092. lodash.uniqueId = uniqueId;
  34093. lodash.upperCase = upperCase;
  34094. lodash.upperFirst = upperFirst;
  34095. // Add aliases.
  34096. lodash.each = forEach;
  34097. lodash.eachRight = forEachRight;
  34098. lodash.first = head;
  34099. mixin(lodash, (function() {
  34100. var source = {};
  34101. baseForOwn(lodash, function(func, methodName) {
  34102. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34103. source[methodName] = func;
  34104. }
  34105. });
  34106. return source;
  34107. }()), { 'chain': false });
  34108. /*------------------------------------------------------------------------*/
  34109. /**
  34110. * The semantic version number.
  34111. *
  34112. * @static
  34113. * @memberOf _
  34114. * @type {string}
  34115. */
  34116. lodash.VERSION = VERSION;
  34117. // Assign default placeholders.
  34118. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34119. lodash[methodName].placeholder = lodash;
  34120. });
  34121. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34122. arrayEach(['drop', 'take'], function(methodName, index) {
  34123. LazyWrapper.prototype[methodName] = function(n) {
  34124. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34125. var result = (this.__filtered__ && !index)
  34126. ? new LazyWrapper(this)
  34127. : this.clone();
  34128. if (result.__filtered__) {
  34129. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34130. } else {
  34131. result.__views__.push({
  34132. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34133. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34134. });
  34135. }
  34136. return result;
  34137. };
  34138. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34139. return this.reverse()[methodName](n).reverse();
  34140. };
  34141. });
  34142. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34143. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34144. var type = index + 1,
  34145. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34146. LazyWrapper.prototype[methodName] = function(iteratee) {
  34147. var result = this.clone();
  34148. result.__iteratees__.push({
  34149. 'iteratee': getIteratee(iteratee, 3),
  34150. 'type': type
  34151. });
  34152. result.__filtered__ = result.__filtered__ || isFilter;
  34153. return result;
  34154. };
  34155. });
  34156. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34157. arrayEach(['head', 'last'], function(methodName, index) {
  34158. var takeName = 'take' + (index ? 'Right' : '');
  34159. LazyWrapper.prototype[methodName] = function() {
  34160. return this[takeName](1).value()[0];
  34161. };
  34162. });
  34163. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34164. arrayEach(['initial', 'tail'], function(methodName, index) {
  34165. var dropName = 'drop' + (index ? '' : 'Right');
  34166. LazyWrapper.prototype[methodName] = function() {
  34167. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34168. };
  34169. });
  34170. LazyWrapper.prototype.compact = function() {
  34171. return this.filter(identity);
  34172. };
  34173. LazyWrapper.prototype.find = function(predicate) {
  34174. return this.filter(predicate).head();
  34175. };
  34176. LazyWrapper.prototype.findLast = function(predicate) {
  34177. return this.reverse().find(predicate);
  34178. };
  34179. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34180. if (typeof path == 'function') {
  34181. return new LazyWrapper(this);
  34182. }
  34183. return this.map(function(value) {
  34184. return baseInvoke(value, path, args);
  34185. });
  34186. });
  34187. LazyWrapper.prototype.reject = function(predicate) {
  34188. return this.filter(negate(getIteratee(predicate)));
  34189. };
  34190. LazyWrapper.prototype.slice = function(start, end) {
  34191. start = toInteger(start);
  34192. var result = this;
  34193. if (result.__filtered__ && (start > 0 || end < 0)) {
  34194. return new LazyWrapper(result);
  34195. }
  34196. if (start < 0) {
  34197. result = result.takeRight(-start);
  34198. } else if (start) {
  34199. result = result.drop(start);
  34200. }
  34201. if (end !== undefined) {
  34202. end = toInteger(end);
  34203. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34204. }
  34205. return result;
  34206. };
  34207. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34208. return this.reverse().takeWhile(predicate).reverse();
  34209. };
  34210. LazyWrapper.prototype.toArray = function() {
  34211. return this.take(MAX_ARRAY_LENGTH);
  34212. };
  34213. // Add `LazyWrapper` methods to `lodash.prototype`.
  34214. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34215. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34216. isTaker = /^(?:head|last)$/.test(methodName),
  34217. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34218. retUnwrapped = isTaker || /^find/.test(methodName);
  34219. if (!lodashFunc) {
  34220. return;
  34221. }
  34222. lodash.prototype[methodName] = function() {
  34223. var value = this.__wrapped__,
  34224. args = isTaker ? [1] : arguments,
  34225. isLazy = value instanceof LazyWrapper,
  34226. iteratee = args[0],
  34227. useLazy = isLazy || isArray(value);
  34228. var interceptor = function(value) {
  34229. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34230. return (isTaker && chainAll) ? result[0] : result;
  34231. };
  34232. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34233. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34234. isLazy = useLazy = false;
  34235. }
  34236. var chainAll = this.__chain__,
  34237. isHybrid = !!this.__actions__.length,
  34238. isUnwrapped = retUnwrapped && !chainAll,
  34239. onlyLazy = isLazy && !isHybrid;
  34240. if (!retUnwrapped && useLazy) {
  34241. value = onlyLazy ? value : new LazyWrapper(this);
  34242. var result = func.apply(value, args);
  34243. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34244. return new LodashWrapper(result, chainAll);
  34245. }
  34246. if (isUnwrapped && onlyLazy) {
  34247. return func.apply(this, args);
  34248. }
  34249. result = this.thru(interceptor);
  34250. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34251. };
  34252. });
  34253. // Add `Array` methods to `lodash.prototype`.
  34254. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34255. var func = arrayProto[methodName],
  34256. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34257. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34258. lodash.prototype[methodName] = function() {
  34259. var args = arguments;
  34260. if (retUnwrapped && !this.__chain__) {
  34261. var value = this.value();
  34262. return func.apply(isArray(value) ? value : [], args);
  34263. }
  34264. return this[chainName](function(value) {
  34265. return func.apply(isArray(value) ? value : [], args);
  34266. });
  34267. };
  34268. });
  34269. // Map minified method names to their real names.
  34270. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34271. var lodashFunc = lodash[methodName];
  34272. if (lodashFunc) {
  34273. var key = lodashFunc.name + '';
  34274. if (!hasOwnProperty.call(realNames, key)) {
  34275. realNames[key] = [];
  34276. }
  34277. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34278. }
  34279. });
  34280. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34281. 'name': 'wrapper',
  34282. 'func': undefined
  34283. }];
  34284. // Add methods to `LazyWrapper`.
  34285. LazyWrapper.prototype.clone = lazyClone;
  34286. LazyWrapper.prototype.reverse = lazyReverse;
  34287. LazyWrapper.prototype.value = lazyValue;
  34288. // Add chain sequence methods to the `lodash` wrapper.
  34289. lodash.prototype.at = wrapperAt;
  34290. lodash.prototype.chain = wrapperChain;
  34291. lodash.prototype.commit = wrapperCommit;
  34292. lodash.prototype.next = wrapperNext;
  34293. lodash.prototype.plant = wrapperPlant;
  34294. lodash.prototype.reverse = wrapperReverse;
  34295. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34296. // Add lazy aliases.
  34297. lodash.prototype.first = lodash.prototype.head;
  34298. if (symIterator) {
  34299. lodash.prototype[symIterator] = wrapperToIterator;
  34300. }
  34301. return lodash;
  34302. });
  34303. /*--------------------------------------------------------------------------*/
  34304. // Export lodash.
  34305. var _ = runInContext();
  34306. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34307. if (true) {
  34308. // Expose Lodash on the global object to prevent errors when Lodash is
  34309. // loaded by a script tag in the presence of an AMD loader.
  34310. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34311. // Use `_.noConflict` to remove Lodash from the global object.
  34312. root._ = _;
  34313. // Define as an anonymous module so, through path mapping, it can be
  34314. // referenced as the "underscore" module.
  34315. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34316. return _;
  34317. }).call(exports, __webpack_require__, exports, module),
  34318. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34319. }
  34320. // Check for `exports` after `define` in case a build optimizer adds it.
  34321. else {}
  34322. }.call(this));
  34323. /* 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)))
  34324. /***/ }),
  34325. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34326. /*!***************************************************!*\
  34327. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34328. \***************************************************/
  34329. /*! exports provided: default */
  34330. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34331. "use strict";
  34332. __webpack_require__.r(__webpack_exports__);
  34333. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34334. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34335. * @version 1.16.1
  34336. * @license
  34337. * Copyright (c) 2016 Federico Zivolo and contributors
  34338. *
  34339. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34340. * of this software and associated documentation files (the "Software"), to deal
  34341. * in the Software without restriction, including without limitation the rights
  34342. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34343. * copies of the Software, and to permit persons to whom the Software is
  34344. * furnished to do so, subject to the following conditions:
  34345. *
  34346. * The above copyright notice and this permission notice shall be included in all
  34347. * copies or substantial portions of the Software.
  34348. *
  34349. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34350. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34351. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34352. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34353. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34354. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34355. * SOFTWARE.
  34356. */
  34357. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34358. var timeoutDuration = function () {
  34359. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34360. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34361. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34362. return 1;
  34363. }
  34364. }
  34365. return 0;
  34366. }();
  34367. function microtaskDebounce(fn) {
  34368. var called = false;
  34369. return function () {
  34370. if (called) {
  34371. return;
  34372. }
  34373. called = true;
  34374. window.Promise.resolve().then(function () {
  34375. called = false;
  34376. fn();
  34377. });
  34378. };
  34379. }
  34380. function taskDebounce(fn) {
  34381. var scheduled = false;
  34382. return function () {
  34383. if (!scheduled) {
  34384. scheduled = true;
  34385. setTimeout(function () {
  34386. scheduled = false;
  34387. fn();
  34388. }, timeoutDuration);
  34389. }
  34390. };
  34391. }
  34392. var supportsMicroTasks = isBrowser && window.Promise;
  34393. /**
  34394. * Create a debounced version of a method, that's asynchronously deferred
  34395. * but called in the minimum time possible.
  34396. *
  34397. * @method
  34398. * @memberof Popper.Utils
  34399. * @argument {Function} fn
  34400. * @returns {Function}
  34401. */
  34402. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34403. /**
  34404. * Check if the given variable is a function
  34405. * @method
  34406. * @memberof Popper.Utils
  34407. * @argument {Any} functionToCheck - variable to check
  34408. * @returns {Boolean} answer to: is a function?
  34409. */
  34410. function isFunction(functionToCheck) {
  34411. var getType = {};
  34412. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34413. }
  34414. /**
  34415. * Get CSS computed property of the given element
  34416. * @method
  34417. * @memberof Popper.Utils
  34418. * @argument {Eement} element
  34419. * @argument {String} property
  34420. */
  34421. function getStyleComputedProperty(element, property) {
  34422. if (element.nodeType !== 1) {
  34423. return [];
  34424. }
  34425. // NOTE: 1 DOM access here
  34426. var window = element.ownerDocument.defaultView;
  34427. var css = window.getComputedStyle(element, null);
  34428. return property ? css[property] : css;
  34429. }
  34430. /**
  34431. * Returns the parentNode or the host of the element
  34432. * @method
  34433. * @memberof Popper.Utils
  34434. * @argument {Element} element
  34435. * @returns {Element} parent
  34436. */
  34437. function getParentNode(element) {
  34438. if (element.nodeName === 'HTML') {
  34439. return element;
  34440. }
  34441. return element.parentNode || element.host;
  34442. }
  34443. /**
  34444. * Returns the scrolling parent of the given element
  34445. * @method
  34446. * @memberof Popper.Utils
  34447. * @argument {Element} element
  34448. * @returns {Element} scroll parent
  34449. */
  34450. function getScrollParent(element) {
  34451. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34452. if (!element) {
  34453. return document.body;
  34454. }
  34455. switch (element.nodeName) {
  34456. case 'HTML':
  34457. case 'BODY':
  34458. return element.ownerDocument.body;
  34459. case '#document':
  34460. return element.body;
  34461. }
  34462. // Firefox want us to check `-x` and `-y` variations as well
  34463. var _getStyleComputedProp = getStyleComputedProperty(element),
  34464. overflow = _getStyleComputedProp.overflow,
  34465. overflowX = _getStyleComputedProp.overflowX,
  34466. overflowY = _getStyleComputedProp.overflowY;
  34467. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34468. return element;
  34469. }
  34470. return getScrollParent(getParentNode(element));
  34471. }
  34472. /**
  34473. * Returns the reference node of the reference object, or the reference object itself.
  34474. * @method
  34475. * @memberof Popper.Utils
  34476. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34477. * @returns {Element} parent
  34478. */
  34479. function getReferenceNode(reference) {
  34480. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34481. }
  34482. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34483. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34484. /**
  34485. * Determines if the browser is Internet Explorer
  34486. * @method
  34487. * @memberof Popper.Utils
  34488. * @param {Number} version to check
  34489. * @returns {Boolean} isIE
  34490. */
  34491. function isIE(version) {
  34492. if (version === 11) {
  34493. return isIE11;
  34494. }
  34495. if (version === 10) {
  34496. return isIE10;
  34497. }
  34498. return isIE11 || isIE10;
  34499. }
  34500. /**
  34501. * Returns the offset parent of the given element
  34502. * @method
  34503. * @memberof Popper.Utils
  34504. * @argument {Element} element
  34505. * @returns {Element} offset parent
  34506. */
  34507. function getOffsetParent(element) {
  34508. if (!element) {
  34509. return document.documentElement;
  34510. }
  34511. var noOffsetParent = isIE(10) ? document.body : null;
  34512. // NOTE: 1 DOM access here
  34513. var offsetParent = element.offsetParent || null;
  34514. // Skip hidden elements which don't have an offsetParent
  34515. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34516. offsetParent = (element = element.nextElementSibling).offsetParent;
  34517. }
  34518. var nodeName = offsetParent && offsetParent.nodeName;
  34519. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34520. return element ? element.ownerDocument.documentElement : document.documentElement;
  34521. }
  34522. // .offsetParent will return the closest TH, TD or TABLE in case
  34523. // no offsetParent is present, I hate this job...
  34524. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34525. return getOffsetParent(offsetParent);
  34526. }
  34527. return offsetParent;
  34528. }
  34529. function isOffsetContainer(element) {
  34530. var nodeName = element.nodeName;
  34531. if (nodeName === 'BODY') {
  34532. return false;
  34533. }
  34534. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34535. }
  34536. /**
  34537. * Finds the root node (document, shadowDOM root) of the given element
  34538. * @method
  34539. * @memberof Popper.Utils
  34540. * @argument {Element} node
  34541. * @returns {Element} root node
  34542. */
  34543. function getRoot(node) {
  34544. if (node.parentNode !== null) {
  34545. return getRoot(node.parentNode);
  34546. }
  34547. return node;
  34548. }
  34549. /**
  34550. * Finds the offset parent common to the two provided nodes
  34551. * @method
  34552. * @memberof Popper.Utils
  34553. * @argument {Element} element1
  34554. * @argument {Element} element2
  34555. * @returns {Element} common offset parent
  34556. */
  34557. function findCommonOffsetParent(element1, element2) {
  34558. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34559. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34560. return document.documentElement;
  34561. }
  34562. // Here we make sure to give as "start" the element that comes first in the DOM
  34563. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34564. var start = order ? element1 : element2;
  34565. var end = order ? element2 : element1;
  34566. // Get common ancestor container
  34567. var range = document.createRange();
  34568. range.setStart(start, 0);
  34569. range.setEnd(end, 0);
  34570. var commonAncestorContainer = range.commonAncestorContainer;
  34571. // Both nodes are inside #document
  34572. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34573. if (isOffsetContainer(commonAncestorContainer)) {
  34574. return commonAncestorContainer;
  34575. }
  34576. return getOffsetParent(commonAncestorContainer);
  34577. }
  34578. // one of the nodes is inside shadowDOM, find which one
  34579. var element1root = getRoot(element1);
  34580. if (element1root.host) {
  34581. return findCommonOffsetParent(element1root.host, element2);
  34582. } else {
  34583. return findCommonOffsetParent(element1, getRoot(element2).host);
  34584. }
  34585. }
  34586. /**
  34587. * Gets the scroll value of the given element in the given side (top and left)
  34588. * @method
  34589. * @memberof Popper.Utils
  34590. * @argument {Element} element
  34591. * @argument {String} side `top` or `left`
  34592. * @returns {number} amount of scrolled pixels
  34593. */
  34594. function getScroll(element) {
  34595. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34596. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34597. var nodeName = element.nodeName;
  34598. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34599. var html = element.ownerDocument.documentElement;
  34600. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34601. return scrollingElement[upperSide];
  34602. }
  34603. return element[upperSide];
  34604. }
  34605. /*
  34606. * Sum or subtract the element scroll values (left and top) from a given rect object
  34607. * @method
  34608. * @memberof Popper.Utils
  34609. * @param {Object} rect - Rect object you want to change
  34610. * @param {HTMLElement} element - The element from the function reads the scroll values
  34611. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34612. * @return {Object} rect - The modifier rect object
  34613. */
  34614. function includeScroll(rect, element) {
  34615. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34616. var scrollTop = getScroll(element, 'top');
  34617. var scrollLeft = getScroll(element, 'left');
  34618. var modifier = subtract ? -1 : 1;
  34619. rect.top += scrollTop * modifier;
  34620. rect.bottom += scrollTop * modifier;
  34621. rect.left += scrollLeft * modifier;
  34622. rect.right += scrollLeft * modifier;
  34623. return rect;
  34624. }
  34625. /*
  34626. * Helper to detect borders of a given element
  34627. * @method
  34628. * @memberof Popper.Utils
  34629. * @param {CSSStyleDeclaration} styles
  34630. * Result of `getStyleComputedProperty` on the given element
  34631. * @param {String} axis - `x` or `y`
  34632. * @return {number} borders - The borders size of the given axis
  34633. */
  34634. function getBordersSize(styles, axis) {
  34635. var sideA = axis === 'x' ? 'Left' : 'Top';
  34636. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34637. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34638. }
  34639. function getSize(axis, body, html, computedStyle) {
  34640. 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);
  34641. }
  34642. function getWindowSizes(document) {
  34643. var body = document.body;
  34644. var html = document.documentElement;
  34645. var computedStyle = isIE(10) && getComputedStyle(html);
  34646. return {
  34647. height: getSize('Height', body, html, computedStyle),
  34648. width: getSize('Width', body, html, computedStyle)
  34649. };
  34650. }
  34651. var classCallCheck = function (instance, Constructor) {
  34652. if (!(instance instanceof Constructor)) {
  34653. throw new TypeError("Cannot call a class as a function");
  34654. }
  34655. };
  34656. var createClass = function () {
  34657. function defineProperties(target, props) {
  34658. for (var i = 0; i < props.length; i++) {
  34659. var descriptor = props[i];
  34660. descriptor.enumerable = descriptor.enumerable || false;
  34661. descriptor.configurable = true;
  34662. if ("value" in descriptor) descriptor.writable = true;
  34663. Object.defineProperty(target, descriptor.key, descriptor);
  34664. }
  34665. }
  34666. return function (Constructor, protoProps, staticProps) {
  34667. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34668. if (staticProps) defineProperties(Constructor, staticProps);
  34669. return Constructor;
  34670. };
  34671. }();
  34672. var defineProperty = function (obj, key, value) {
  34673. if (key in obj) {
  34674. Object.defineProperty(obj, key, {
  34675. value: value,
  34676. enumerable: true,
  34677. configurable: true,
  34678. writable: true
  34679. });
  34680. } else {
  34681. obj[key] = value;
  34682. }
  34683. return obj;
  34684. };
  34685. var _extends = Object.assign || function (target) {
  34686. for (var i = 1; i < arguments.length; i++) {
  34687. var source = arguments[i];
  34688. for (var key in source) {
  34689. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34690. target[key] = source[key];
  34691. }
  34692. }
  34693. }
  34694. return target;
  34695. };
  34696. /**
  34697. * Given element offsets, generate an output similar to getBoundingClientRect
  34698. * @method
  34699. * @memberof Popper.Utils
  34700. * @argument {Object} offsets
  34701. * @returns {Object} ClientRect like output
  34702. */
  34703. function getClientRect(offsets) {
  34704. return _extends({}, offsets, {
  34705. right: offsets.left + offsets.width,
  34706. bottom: offsets.top + offsets.height
  34707. });
  34708. }
  34709. /**
  34710. * Get bounding client rect of given element
  34711. * @method
  34712. * @memberof Popper.Utils
  34713. * @param {HTMLElement} element
  34714. * @return {Object} client rect
  34715. */
  34716. function getBoundingClientRect(element) {
  34717. var rect = {};
  34718. // IE10 10 FIX: Please, don't ask, the element isn't
  34719. // considered in DOM in some circumstances...
  34720. // This isn't reproducible in IE10 compatibility mode of IE11
  34721. try {
  34722. if (isIE(10)) {
  34723. rect = element.getBoundingClientRect();
  34724. var scrollTop = getScroll(element, 'top');
  34725. var scrollLeft = getScroll(element, 'left');
  34726. rect.top += scrollTop;
  34727. rect.left += scrollLeft;
  34728. rect.bottom += scrollTop;
  34729. rect.right += scrollLeft;
  34730. } else {
  34731. rect = element.getBoundingClientRect();
  34732. }
  34733. } catch (e) {}
  34734. var result = {
  34735. left: rect.left,
  34736. top: rect.top,
  34737. width: rect.right - rect.left,
  34738. height: rect.bottom - rect.top
  34739. };
  34740. // subtract scrollbar size from sizes
  34741. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34742. var width = sizes.width || element.clientWidth || result.width;
  34743. var height = sizes.height || element.clientHeight || result.height;
  34744. var horizScrollbar = element.offsetWidth - width;
  34745. var vertScrollbar = element.offsetHeight - height;
  34746. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34747. // we make this check conditional for performance reasons
  34748. if (horizScrollbar || vertScrollbar) {
  34749. var styles = getStyleComputedProperty(element);
  34750. horizScrollbar -= getBordersSize(styles, 'x');
  34751. vertScrollbar -= getBordersSize(styles, 'y');
  34752. result.width -= horizScrollbar;
  34753. result.height -= vertScrollbar;
  34754. }
  34755. return getClientRect(result);
  34756. }
  34757. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34758. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34759. var isIE10 = isIE(10);
  34760. var isHTML = parent.nodeName === 'HTML';
  34761. var childrenRect = getBoundingClientRect(children);
  34762. var parentRect = getBoundingClientRect(parent);
  34763. var scrollParent = getScrollParent(children);
  34764. var styles = getStyleComputedProperty(parent);
  34765. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34766. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34767. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34768. if (fixedPosition && isHTML) {
  34769. parentRect.top = Math.max(parentRect.top, 0);
  34770. parentRect.left = Math.max(parentRect.left, 0);
  34771. }
  34772. var offsets = getClientRect({
  34773. top: childrenRect.top - parentRect.top - borderTopWidth,
  34774. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34775. width: childrenRect.width,
  34776. height: childrenRect.height
  34777. });
  34778. offsets.marginTop = 0;
  34779. offsets.marginLeft = 0;
  34780. // Subtract margins of documentElement in case it's being used as parent
  34781. // we do this only on HTML because it's the only element that behaves
  34782. // differently when margins are applied to it. The margins are included in
  34783. // the box of the documentElement, in the other cases not.
  34784. if (!isIE10 && isHTML) {
  34785. var marginTop = parseFloat(styles.marginTop);
  34786. var marginLeft = parseFloat(styles.marginLeft);
  34787. offsets.top -= borderTopWidth - marginTop;
  34788. offsets.bottom -= borderTopWidth - marginTop;
  34789. offsets.left -= borderLeftWidth - marginLeft;
  34790. offsets.right -= borderLeftWidth - marginLeft;
  34791. // Attach marginTop and marginLeft because in some circumstances we may need them
  34792. offsets.marginTop = marginTop;
  34793. offsets.marginLeft = marginLeft;
  34794. }
  34795. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34796. offsets = includeScroll(offsets, parent);
  34797. }
  34798. return offsets;
  34799. }
  34800. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34801. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34802. var html = element.ownerDocument.documentElement;
  34803. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34804. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34805. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34806. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34807. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34808. var offset = {
  34809. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34810. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34811. width: width,
  34812. height: height
  34813. };
  34814. return getClientRect(offset);
  34815. }
  34816. /**
  34817. * Check if the given element is fixed or is inside a fixed parent
  34818. * @method
  34819. * @memberof Popper.Utils
  34820. * @argument {Element} element
  34821. * @argument {Element} customContainer
  34822. * @returns {Boolean} answer to "isFixed?"
  34823. */
  34824. function isFixed(element) {
  34825. var nodeName = element.nodeName;
  34826. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34827. return false;
  34828. }
  34829. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34830. return true;
  34831. }
  34832. var parentNode = getParentNode(element);
  34833. if (!parentNode) {
  34834. return false;
  34835. }
  34836. return isFixed(parentNode);
  34837. }
  34838. /**
  34839. * Finds the first parent of an element that has a transformed property defined
  34840. * @method
  34841. * @memberof Popper.Utils
  34842. * @argument {Element} element
  34843. * @returns {Element} first transformed parent or documentElement
  34844. */
  34845. function getFixedPositionOffsetParent(element) {
  34846. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34847. if (!element || !element.parentElement || isIE()) {
  34848. return document.documentElement;
  34849. }
  34850. var el = element.parentElement;
  34851. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34852. el = el.parentElement;
  34853. }
  34854. return el || document.documentElement;
  34855. }
  34856. /**
  34857. * Computed the boundaries limits and return them
  34858. * @method
  34859. * @memberof Popper.Utils
  34860. * @param {HTMLElement} popper
  34861. * @param {HTMLElement} reference
  34862. * @param {number} padding
  34863. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34864. * @param {Boolean} fixedPosition - Is in fixed position mode
  34865. * @returns {Object} Coordinates of the boundaries
  34866. */
  34867. function getBoundaries(popper, reference, padding, boundariesElement) {
  34868. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34869. // NOTE: 1 DOM access here
  34870. var boundaries = { top: 0, left: 0 };
  34871. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34872. // Handle viewport case
  34873. if (boundariesElement === 'viewport') {
  34874. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34875. } else {
  34876. // Handle other cases based on DOM element used as boundaries
  34877. var boundariesNode = void 0;
  34878. if (boundariesElement === 'scrollParent') {
  34879. boundariesNode = getScrollParent(getParentNode(reference));
  34880. if (boundariesNode.nodeName === 'BODY') {
  34881. boundariesNode = popper.ownerDocument.documentElement;
  34882. }
  34883. } else if (boundariesElement === 'window') {
  34884. boundariesNode = popper.ownerDocument.documentElement;
  34885. } else {
  34886. boundariesNode = boundariesElement;
  34887. }
  34888. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34889. // In case of HTML, we need a different computation
  34890. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34891. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34892. height = _getWindowSizes.height,
  34893. width = _getWindowSizes.width;
  34894. boundaries.top += offsets.top - offsets.marginTop;
  34895. boundaries.bottom = height + offsets.top;
  34896. boundaries.left += offsets.left - offsets.marginLeft;
  34897. boundaries.right = width + offsets.left;
  34898. } else {
  34899. // for all the other DOM elements, this one is good
  34900. boundaries = offsets;
  34901. }
  34902. }
  34903. // Add paddings
  34904. padding = padding || 0;
  34905. var isPaddingNumber = typeof padding === 'number';
  34906. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34907. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34908. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34909. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34910. return boundaries;
  34911. }
  34912. function getArea(_ref) {
  34913. var width = _ref.width,
  34914. height = _ref.height;
  34915. return width * height;
  34916. }
  34917. /**
  34918. * Utility used to transform the `auto` placement to the placement with more
  34919. * available space.
  34920. * @method
  34921. * @memberof Popper.Utils
  34922. * @argument {Object} data - The data object generated by update method
  34923. * @argument {Object} options - Modifiers configuration and options
  34924. * @returns {Object} The data object, properly modified
  34925. */
  34926. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34927. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34928. if (placement.indexOf('auto') === -1) {
  34929. return placement;
  34930. }
  34931. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34932. var rects = {
  34933. top: {
  34934. width: boundaries.width,
  34935. height: refRect.top - boundaries.top
  34936. },
  34937. right: {
  34938. width: boundaries.right - refRect.right,
  34939. height: boundaries.height
  34940. },
  34941. bottom: {
  34942. width: boundaries.width,
  34943. height: boundaries.bottom - refRect.bottom
  34944. },
  34945. left: {
  34946. width: refRect.left - boundaries.left,
  34947. height: boundaries.height
  34948. }
  34949. };
  34950. var sortedAreas = Object.keys(rects).map(function (key) {
  34951. return _extends({
  34952. key: key
  34953. }, rects[key], {
  34954. area: getArea(rects[key])
  34955. });
  34956. }).sort(function (a, b) {
  34957. return b.area - a.area;
  34958. });
  34959. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34960. var width = _ref2.width,
  34961. height = _ref2.height;
  34962. return width >= popper.clientWidth && height >= popper.clientHeight;
  34963. });
  34964. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34965. var variation = placement.split('-')[1];
  34966. return computedPlacement + (variation ? '-' + variation : '');
  34967. }
  34968. /**
  34969. * Get offsets to the reference element
  34970. * @method
  34971. * @memberof Popper.Utils
  34972. * @param {Object} state
  34973. * @param {Element} popper - the popper element
  34974. * @param {Element} reference - the reference element (the popper will be relative to this)
  34975. * @param {Element} fixedPosition - is in fixed position mode
  34976. * @returns {Object} An object containing the offsets which will be applied to the popper
  34977. */
  34978. function getReferenceOffsets(state, popper, reference) {
  34979. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34980. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34981. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34982. }
  34983. /**
  34984. * Get the outer sizes of the given element (offset size + margins)
  34985. * @method
  34986. * @memberof Popper.Utils
  34987. * @argument {Element} element
  34988. * @returns {Object} object containing width and height properties
  34989. */
  34990. function getOuterSizes(element) {
  34991. var window = element.ownerDocument.defaultView;
  34992. var styles = window.getComputedStyle(element);
  34993. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34994. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34995. var result = {
  34996. width: element.offsetWidth + y,
  34997. height: element.offsetHeight + x
  34998. };
  34999. return result;
  35000. }
  35001. /**
  35002. * Get the opposite placement of the given one
  35003. * @method
  35004. * @memberof Popper.Utils
  35005. * @argument {String} placement
  35006. * @returns {String} flipped placement
  35007. */
  35008. function getOppositePlacement(placement) {
  35009. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35010. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35011. return hash[matched];
  35012. });
  35013. }
  35014. /**
  35015. * Get offsets to the popper
  35016. * @method
  35017. * @memberof Popper.Utils
  35018. * @param {Object} position - CSS position the Popper will get applied
  35019. * @param {HTMLElement} popper - the popper element
  35020. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35021. * @param {String} placement - one of the valid placement options
  35022. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35023. */
  35024. function getPopperOffsets(popper, referenceOffsets, placement) {
  35025. placement = placement.split('-')[0];
  35026. // Get popper node sizes
  35027. var popperRect = getOuterSizes(popper);
  35028. // Add position, width and height to our offsets object
  35029. var popperOffsets = {
  35030. width: popperRect.width,
  35031. height: popperRect.height
  35032. };
  35033. // depending by the popper placement we have to compute its offsets slightly differently
  35034. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35035. var mainSide = isHoriz ? 'top' : 'left';
  35036. var secondarySide = isHoriz ? 'left' : 'top';
  35037. var measurement = isHoriz ? 'height' : 'width';
  35038. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35039. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35040. if (placement === secondarySide) {
  35041. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35042. } else {
  35043. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35044. }
  35045. return popperOffsets;
  35046. }
  35047. /**
  35048. * Mimics the `find` method of Array
  35049. * @method
  35050. * @memberof Popper.Utils
  35051. * @argument {Array} arr
  35052. * @argument prop
  35053. * @argument value
  35054. * @returns index or -1
  35055. */
  35056. function find(arr, check) {
  35057. // use native find if supported
  35058. if (Array.prototype.find) {
  35059. return arr.find(check);
  35060. }
  35061. // use `filter` to obtain the same behavior of `find`
  35062. return arr.filter(check)[0];
  35063. }
  35064. /**
  35065. * Return the index of the matching object
  35066. * @method
  35067. * @memberof Popper.Utils
  35068. * @argument {Array} arr
  35069. * @argument prop
  35070. * @argument value
  35071. * @returns index or -1
  35072. */
  35073. function findIndex(arr, prop, value) {
  35074. // use native findIndex if supported
  35075. if (Array.prototype.findIndex) {
  35076. return arr.findIndex(function (cur) {
  35077. return cur[prop] === value;
  35078. });
  35079. }
  35080. // use `find` + `indexOf` if `findIndex` isn't supported
  35081. var match = find(arr, function (obj) {
  35082. return obj[prop] === value;
  35083. });
  35084. return arr.indexOf(match);
  35085. }
  35086. /**
  35087. * Loop trough the list of modifiers and run them in order,
  35088. * each of them will then edit the data object.
  35089. * @method
  35090. * @memberof Popper.Utils
  35091. * @param {dataObject} data
  35092. * @param {Array} modifiers
  35093. * @param {String} ends - Optional modifier name used as stopper
  35094. * @returns {dataObject}
  35095. */
  35096. function runModifiers(modifiers, data, ends) {
  35097. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35098. modifiersToRun.forEach(function (modifier) {
  35099. if (modifier['function']) {
  35100. // eslint-disable-line dot-notation
  35101. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35102. }
  35103. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35104. if (modifier.enabled && isFunction(fn)) {
  35105. // Add properties to offsets to make them a complete clientRect object
  35106. // we do this before each modifier to make sure the previous one doesn't
  35107. // mess with these values
  35108. data.offsets.popper = getClientRect(data.offsets.popper);
  35109. data.offsets.reference = getClientRect(data.offsets.reference);
  35110. data = fn(data, modifier);
  35111. }
  35112. });
  35113. return data;
  35114. }
  35115. /**
  35116. * Updates the position of the popper, computing the new offsets and applying
  35117. * the new style.<br />
  35118. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35119. * @method
  35120. * @memberof Popper
  35121. */
  35122. function update() {
  35123. // if popper is destroyed, don't perform any further update
  35124. if (this.state.isDestroyed) {
  35125. return;
  35126. }
  35127. var data = {
  35128. instance: this,
  35129. styles: {},
  35130. arrowStyles: {},
  35131. attributes: {},
  35132. flipped: false,
  35133. offsets: {}
  35134. };
  35135. // compute reference element offsets
  35136. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35137. // compute auto placement, store placement inside the data object,
  35138. // modifiers will be able to edit `placement` if needed
  35139. // and refer to originalPlacement to know the original value
  35140. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35141. // store the computed placement inside `originalPlacement`
  35142. data.originalPlacement = data.placement;
  35143. data.positionFixed = this.options.positionFixed;
  35144. // compute the popper offsets
  35145. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35146. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35147. // run the modifiers
  35148. data = runModifiers(this.modifiers, data);
  35149. // the first `update` will call `onCreate` callback
  35150. // the other ones will call `onUpdate` callback
  35151. if (!this.state.isCreated) {
  35152. this.state.isCreated = true;
  35153. this.options.onCreate(data);
  35154. } else {
  35155. this.options.onUpdate(data);
  35156. }
  35157. }
  35158. /**
  35159. * Helper used to know if the given modifier is enabled.
  35160. * @method
  35161. * @memberof Popper.Utils
  35162. * @returns {Boolean}
  35163. */
  35164. function isModifierEnabled(modifiers, modifierName) {
  35165. return modifiers.some(function (_ref) {
  35166. var name = _ref.name,
  35167. enabled = _ref.enabled;
  35168. return enabled && name === modifierName;
  35169. });
  35170. }
  35171. /**
  35172. * Get the prefixed supported property name
  35173. * @method
  35174. * @memberof Popper.Utils
  35175. * @argument {String} property (camelCase)
  35176. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35177. */
  35178. function getSupportedPropertyName(property) {
  35179. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35180. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35181. for (var i = 0; i < prefixes.length; i++) {
  35182. var prefix = prefixes[i];
  35183. var toCheck = prefix ? '' + prefix + upperProp : property;
  35184. if (typeof document.body.style[toCheck] !== 'undefined') {
  35185. return toCheck;
  35186. }
  35187. }
  35188. return null;
  35189. }
  35190. /**
  35191. * Destroys the popper.
  35192. * @method
  35193. * @memberof Popper
  35194. */
  35195. function destroy() {
  35196. this.state.isDestroyed = true;
  35197. // touch DOM only if `applyStyle` modifier is enabled
  35198. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35199. this.popper.removeAttribute('x-placement');
  35200. this.popper.style.position = '';
  35201. this.popper.style.top = '';
  35202. this.popper.style.left = '';
  35203. this.popper.style.right = '';
  35204. this.popper.style.bottom = '';
  35205. this.popper.style.willChange = '';
  35206. this.popper.style[getSupportedPropertyName('transform')] = '';
  35207. }
  35208. this.disableEventListeners();
  35209. // remove the popper if user explicitly asked for the deletion on destroy
  35210. // do not use `remove` because IE11 doesn't support it
  35211. if (this.options.removeOnDestroy) {
  35212. this.popper.parentNode.removeChild(this.popper);
  35213. }
  35214. return this;
  35215. }
  35216. /**
  35217. * Get the window associated with the element
  35218. * @argument {Element} element
  35219. * @returns {Window}
  35220. */
  35221. function getWindow(element) {
  35222. var ownerDocument = element.ownerDocument;
  35223. return ownerDocument ? ownerDocument.defaultView : window;
  35224. }
  35225. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35226. var isBody = scrollParent.nodeName === 'BODY';
  35227. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35228. target.addEventListener(event, callback, { passive: true });
  35229. if (!isBody) {
  35230. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35231. }
  35232. scrollParents.push(target);
  35233. }
  35234. /**
  35235. * Setup needed event listeners used to update the popper position
  35236. * @method
  35237. * @memberof Popper.Utils
  35238. * @private
  35239. */
  35240. function setupEventListeners(reference, options, state, updateBound) {
  35241. // Resize event listener on window
  35242. state.updateBound = updateBound;
  35243. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35244. // Scroll event listener on scroll parents
  35245. var scrollElement = getScrollParent(reference);
  35246. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35247. state.scrollElement = scrollElement;
  35248. state.eventsEnabled = true;
  35249. return state;
  35250. }
  35251. /**
  35252. * It will add resize/scroll events and start recalculating
  35253. * position of the popper element when they are triggered.
  35254. * @method
  35255. * @memberof Popper
  35256. */
  35257. function enableEventListeners() {
  35258. if (!this.state.eventsEnabled) {
  35259. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35260. }
  35261. }
  35262. /**
  35263. * Remove event listeners used to update the popper position
  35264. * @method
  35265. * @memberof Popper.Utils
  35266. * @private
  35267. */
  35268. function removeEventListeners(reference, state) {
  35269. // Remove resize event listener on window
  35270. getWindow(reference).removeEventListener('resize', state.updateBound);
  35271. // Remove scroll event listener on scroll parents
  35272. state.scrollParents.forEach(function (target) {
  35273. target.removeEventListener('scroll', state.updateBound);
  35274. });
  35275. // Reset state
  35276. state.updateBound = null;
  35277. state.scrollParents = [];
  35278. state.scrollElement = null;
  35279. state.eventsEnabled = false;
  35280. return state;
  35281. }
  35282. /**
  35283. * It will remove resize/scroll events and won't recalculate popper position
  35284. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35285. * unless you call `update` method manually.
  35286. * @method
  35287. * @memberof Popper
  35288. */
  35289. function disableEventListeners() {
  35290. if (this.state.eventsEnabled) {
  35291. cancelAnimationFrame(this.scheduleUpdate);
  35292. this.state = removeEventListeners(this.reference, this.state);
  35293. }
  35294. }
  35295. /**
  35296. * Tells if a given input is a number
  35297. * @method
  35298. * @memberof Popper.Utils
  35299. * @param {*} input to check
  35300. * @return {Boolean}
  35301. */
  35302. function isNumeric(n) {
  35303. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35304. }
  35305. /**
  35306. * Set the style to the given popper
  35307. * @method
  35308. * @memberof Popper.Utils
  35309. * @argument {Element} element - Element to apply the style to
  35310. * @argument {Object} styles
  35311. * Object with a list of properties and values which will be applied to the element
  35312. */
  35313. function setStyles(element, styles) {
  35314. Object.keys(styles).forEach(function (prop) {
  35315. var unit = '';
  35316. // add unit if the value is numeric and is one of the following
  35317. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35318. unit = 'px';
  35319. }
  35320. element.style[prop] = styles[prop] + unit;
  35321. });
  35322. }
  35323. /**
  35324. * Set the attributes to the given popper
  35325. * @method
  35326. * @memberof Popper.Utils
  35327. * @argument {Element} element - Element to apply the attributes to
  35328. * @argument {Object} styles
  35329. * Object with a list of properties and values which will be applied to the element
  35330. */
  35331. function setAttributes(element, attributes) {
  35332. Object.keys(attributes).forEach(function (prop) {
  35333. var value = attributes[prop];
  35334. if (value !== false) {
  35335. element.setAttribute(prop, attributes[prop]);
  35336. } else {
  35337. element.removeAttribute(prop);
  35338. }
  35339. });
  35340. }
  35341. /**
  35342. * @function
  35343. * @memberof Modifiers
  35344. * @argument {Object} data - The data object generated by `update` method
  35345. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35346. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35347. * @argument {Object} options - Modifiers configuration and options
  35348. * @returns {Object} The same data object
  35349. */
  35350. function applyStyle(data) {
  35351. // any property present in `data.styles` will be applied to the popper,
  35352. // in this way we can make the 3rd party modifiers add custom styles to it
  35353. // Be aware, modifiers could override the properties defined in the previous
  35354. // lines of this modifier!
  35355. setStyles(data.instance.popper, data.styles);
  35356. // any property present in `data.attributes` will be applied to the popper,
  35357. // they will be set as HTML attributes of the element
  35358. setAttributes(data.instance.popper, data.attributes);
  35359. // if arrowElement is defined and arrowStyles has some properties
  35360. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35361. setStyles(data.arrowElement, data.arrowStyles);
  35362. }
  35363. return data;
  35364. }
  35365. /**
  35366. * Set the x-placement attribute before everything else because it could be used
  35367. * to add margins to the popper margins needs to be calculated to get the
  35368. * correct popper offsets.
  35369. * @method
  35370. * @memberof Popper.modifiers
  35371. * @param {HTMLElement} reference - The reference element used to position the popper
  35372. * @param {HTMLElement} popper - The HTML element used as popper
  35373. * @param {Object} options - Popper.js options
  35374. */
  35375. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35376. // compute reference element offsets
  35377. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35378. // compute auto placement, store placement inside the data object,
  35379. // modifiers will be able to edit `placement` if needed
  35380. // and refer to originalPlacement to know the original value
  35381. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35382. popper.setAttribute('x-placement', placement);
  35383. // Apply `position` to popper before anything else because
  35384. // without the position applied we can't guarantee correct computations
  35385. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35386. return options;
  35387. }
  35388. /**
  35389. * @function
  35390. * @memberof Popper.Utils
  35391. * @argument {Object} data - The data object generated by `update` method
  35392. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35393. * @returns {Object} The popper's position offsets rounded
  35394. *
  35395. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35396. * good as it can be within reason.
  35397. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35398. *
  35399. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35400. * as well on High DPI screens).
  35401. *
  35402. * Firefox prefers no rounding for positioning and does not have blurriness on
  35403. * high DPI screens.
  35404. *
  35405. * Only horizontal placement and left/right values need to be considered.
  35406. */
  35407. function getRoundedOffsets(data, shouldRound) {
  35408. var _data$offsets = data.offsets,
  35409. popper = _data$offsets.popper,
  35410. reference = _data$offsets.reference;
  35411. var round = Math.round,
  35412. floor = Math.floor;
  35413. var noRound = function noRound(v) {
  35414. return v;
  35415. };
  35416. var referenceWidth = round(reference.width);
  35417. var popperWidth = round(popper.width);
  35418. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35419. var isVariation = data.placement.indexOf('-') !== -1;
  35420. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35421. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35422. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35423. var verticalToInteger = !shouldRound ? noRound : round;
  35424. return {
  35425. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35426. top: verticalToInteger(popper.top),
  35427. bottom: verticalToInteger(popper.bottom),
  35428. right: horizontalToInteger(popper.right)
  35429. };
  35430. }
  35431. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35432. /**
  35433. * @function
  35434. * @memberof Modifiers
  35435. * @argument {Object} data - The data object generated by `update` method
  35436. * @argument {Object} options - Modifiers configuration and options
  35437. * @returns {Object} The data object, properly modified
  35438. */
  35439. function computeStyle(data, options) {
  35440. var x = options.x,
  35441. y = options.y;
  35442. var popper = data.offsets.popper;
  35443. // Remove this legacy support in Popper.js v2
  35444. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35445. return modifier.name === 'applyStyle';
  35446. }).gpuAcceleration;
  35447. if (legacyGpuAccelerationOption !== undefined) {
  35448. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35449. }
  35450. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35451. var offsetParent = getOffsetParent(data.instance.popper);
  35452. var offsetParentRect = getBoundingClientRect(offsetParent);
  35453. // Styles
  35454. var styles = {
  35455. position: popper.position
  35456. };
  35457. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35458. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35459. var sideB = y === 'right' ? 'left' : 'right';
  35460. // if gpuAcceleration is set to `true` and transform is supported,
  35461. // we use `translate3d` to apply the position to the popper we
  35462. // automatically use the supported prefixed version if needed
  35463. var prefixedProperty = getSupportedPropertyName('transform');
  35464. // now, let's make a step back and look at this code closely (wtf?)
  35465. // If the content of the popper grows once it's been positioned, it
  35466. // may happen that the popper gets misplaced because of the new content
  35467. // overflowing its reference element
  35468. // To avoid this problem, we provide two options (x and y), which allow
  35469. // the consumer to define the offset origin.
  35470. // If we position a popper on top of a reference element, we can set
  35471. // `x` to `top` to make the popper grow towards its top instead of
  35472. // its bottom.
  35473. var left = void 0,
  35474. top = void 0;
  35475. if (sideA === 'bottom') {
  35476. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35477. // and not the bottom of the html element
  35478. if (offsetParent.nodeName === 'HTML') {
  35479. top = -offsetParent.clientHeight + offsets.bottom;
  35480. } else {
  35481. top = -offsetParentRect.height + offsets.bottom;
  35482. }
  35483. } else {
  35484. top = offsets.top;
  35485. }
  35486. if (sideB === 'right') {
  35487. if (offsetParent.nodeName === 'HTML') {
  35488. left = -offsetParent.clientWidth + offsets.right;
  35489. } else {
  35490. left = -offsetParentRect.width + offsets.right;
  35491. }
  35492. } else {
  35493. left = offsets.left;
  35494. }
  35495. if (gpuAcceleration && prefixedProperty) {
  35496. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35497. styles[sideA] = 0;
  35498. styles[sideB] = 0;
  35499. styles.willChange = 'transform';
  35500. } else {
  35501. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35502. var invertTop = sideA === 'bottom' ? -1 : 1;
  35503. var invertLeft = sideB === 'right' ? -1 : 1;
  35504. styles[sideA] = top * invertTop;
  35505. styles[sideB] = left * invertLeft;
  35506. styles.willChange = sideA + ', ' + sideB;
  35507. }
  35508. // Attributes
  35509. var attributes = {
  35510. 'x-placement': data.placement
  35511. };
  35512. // Update `data` attributes, styles and arrowStyles
  35513. data.attributes = _extends({}, attributes, data.attributes);
  35514. data.styles = _extends({}, styles, data.styles);
  35515. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35516. return data;
  35517. }
  35518. /**
  35519. * Helper used to know if the given modifier depends from another one.<br />
  35520. * It checks if the needed modifier is listed and enabled.
  35521. * @method
  35522. * @memberof Popper.Utils
  35523. * @param {Array} modifiers - list of modifiers
  35524. * @param {String} requestingName - name of requesting modifier
  35525. * @param {String} requestedName - name of requested modifier
  35526. * @returns {Boolean}
  35527. */
  35528. function isModifierRequired(modifiers, requestingName, requestedName) {
  35529. var requesting = find(modifiers, function (_ref) {
  35530. var name = _ref.name;
  35531. return name === requestingName;
  35532. });
  35533. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35534. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35535. });
  35536. if (!isRequired) {
  35537. var _requesting = '`' + requestingName + '`';
  35538. var requested = '`' + requestedName + '`';
  35539. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35540. }
  35541. return isRequired;
  35542. }
  35543. /**
  35544. * @function
  35545. * @memberof Modifiers
  35546. * @argument {Object} data - The data object generated by update method
  35547. * @argument {Object} options - Modifiers configuration and options
  35548. * @returns {Object} The data object, properly modified
  35549. */
  35550. function arrow(data, options) {
  35551. var _data$offsets$arrow;
  35552. // arrow depends on keepTogether in order to work
  35553. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35554. return data;
  35555. }
  35556. var arrowElement = options.element;
  35557. // if arrowElement is a string, suppose it's a CSS selector
  35558. if (typeof arrowElement === 'string') {
  35559. arrowElement = data.instance.popper.querySelector(arrowElement);
  35560. // if arrowElement is not found, don't run the modifier
  35561. if (!arrowElement) {
  35562. return data;
  35563. }
  35564. } else {
  35565. // if the arrowElement isn't a query selector we must check that the
  35566. // provided DOM node is child of its popper node
  35567. if (!data.instance.popper.contains(arrowElement)) {
  35568. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35569. return data;
  35570. }
  35571. }
  35572. var placement = data.placement.split('-')[0];
  35573. var _data$offsets = data.offsets,
  35574. popper = _data$offsets.popper,
  35575. reference = _data$offsets.reference;
  35576. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35577. var len = isVertical ? 'height' : 'width';
  35578. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35579. var side = sideCapitalized.toLowerCase();
  35580. var altSide = isVertical ? 'left' : 'top';
  35581. var opSide = isVertical ? 'bottom' : 'right';
  35582. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35583. //
  35584. // extends keepTogether behavior making sure the popper and its
  35585. // reference have enough pixels in conjunction
  35586. //
  35587. // top/left side
  35588. if (reference[opSide] - arrowElementSize < popper[side]) {
  35589. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35590. }
  35591. // bottom/right side
  35592. if (reference[side] + arrowElementSize > popper[opSide]) {
  35593. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35594. }
  35595. data.offsets.popper = getClientRect(data.offsets.popper);
  35596. // compute center of the popper
  35597. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35598. // Compute the sideValue using the updated popper offsets
  35599. // take popper margin in account because we don't have this info available
  35600. var css = getStyleComputedProperty(data.instance.popper);
  35601. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35602. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35603. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35604. // prevent arrowElement from being placed not contiguously to its popper
  35605. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35606. data.arrowElement = arrowElement;
  35607. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35608. return data;
  35609. }
  35610. /**
  35611. * Get the opposite placement variation of the given one
  35612. * @method
  35613. * @memberof Popper.Utils
  35614. * @argument {String} placement variation
  35615. * @returns {String} flipped placement variation
  35616. */
  35617. function getOppositeVariation(variation) {
  35618. if (variation === 'end') {
  35619. return 'start';
  35620. } else if (variation === 'start') {
  35621. return 'end';
  35622. }
  35623. return variation;
  35624. }
  35625. /**
  35626. * List of accepted placements to use as values of the `placement` option.<br />
  35627. * Valid placements are:
  35628. * - `auto`
  35629. * - `top`
  35630. * - `right`
  35631. * - `bottom`
  35632. * - `left`
  35633. *
  35634. * Each placement can have a variation from this list:
  35635. * - `-start`
  35636. * - `-end`
  35637. *
  35638. * Variations are interpreted easily if you think of them as the left to right
  35639. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35640. * is right.<br />
  35641. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35642. *
  35643. * Some valid examples are:
  35644. * - `top-end` (on top of reference, right aligned)
  35645. * - `right-start` (on right of reference, top aligned)
  35646. * - `bottom` (on bottom, centered)
  35647. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35648. *
  35649. * @static
  35650. * @type {Array}
  35651. * @enum {String}
  35652. * @readonly
  35653. * @method placements
  35654. * @memberof Popper
  35655. */
  35656. 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'];
  35657. // Get rid of `auto` `auto-start` and `auto-end`
  35658. var validPlacements = placements.slice(3);
  35659. /**
  35660. * Given an initial placement, returns all the subsequent placements
  35661. * clockwise (or counter-clockwise).
  35662. *
  35663. * @method
  35664. * @memberof Popper.Utils
  35665. * @argument {String} placement - A valid placement (it accepts variations)
  35666. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35667. * @returns {Array} placements including their variations
  35668. */
  35669. function clockwise(placement) {
  35670. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35671. var index = validPlacements.indexOf(placement);
  35672. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35673. return counter ? arr.reverse() : arr;
  35674. }
  35675. var BEHAVIORS = {
  35676. FLIP: 'flip',
  35677. CLOCKWISE: 'clockwise',
  35678. COUNTERCLOCKWISE: 'counterclockwise'
  35679. };
  35680. /**
  35681. * @function
  35682. * @memberof Modifiers
  35683. * @argument {Object} data - The data object generated by update method
  35684. * @argument {Object} options - Modifiers configuration and options
  35685. * @returns {Object} The data object, properly modified
  35686. */
  35687. function flip(data, options) {
  35688. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35689. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35690. return data;
  35691. }
  35692. if (data.flipped && data.placement === data.originalPlacement) {
  35693. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35694. return data;
  35695. }
  35696. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35697. var placement = data.placement.split('-')[0];
  35698. var placementOpposite = getOppositePlacement(placement);
  35699. var variation = data.placement.split('-')[1] || '';
  35700. var flipOrder = [];
  35701. switch (options.behavior) {
  35702. case BEHAVIORS.FLIP:
  35703. flipOrder = [placement, placementOpposite];
  35704. break;
  35705. case BEHAVIORS.CLOCKWISE:
  35706. flipOrder = clockwise(placement);
  35707. break;
  35708. case BEHAVIORS.COUNTERCLOCKWISE:
  35709. flipOrder = clockwise(placement, true);
  35710. break;
  35711. default:
  35712. flipOrder = options.behavior;
  35713. }
  35714. flipOrder.forEach(function (step, index) {
  35715. if (placement !== step || flipOrder.length === index + 1) {
  35716. return data;
  35717. }
  35718. placement = data.placement.split('-')[0];
  35719. placementOpposite = getOppositePlacement(placement);
  35720. var popperOffsets = data.offsets.popper;
  35721. var refOffsets = data.offsets.reference;
  35722. // using floor because the reference offsets may contain decimals we are not going to consider here
  35723. var floor = Math.floor;
  35724. 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);
  35725. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35726. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35727. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35728. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35729. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35730. // flip the variation if required
  35731. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35732. // flips variation if reference element overflows boundaries
  35733. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35734. // flips variation if popper content overflows boundaries
  35735. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35736. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35737. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35738. // this boolean to detect any flip loop
  35739. data.flipped = true;
  35740. if (overlapsRef || overflowsBoundaries) {
  35741. placement = flipOrder[index + 1];
  35742. }
  35743. if (flippedVariation) {
  35744. variation = getOppositeVariation(variation);
  35745. }
  35746. data.placement = placement + (variation ? '-' + variation : '');
  35747. // this object contains `position`, we want to preserve it along with
  35748. // any additional property we may add in the future
  35749. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35750. data = runModifiers(data.instance.modifiers, data, 'flip');
  35751. }
  35752. });
  35753. return data;
  35754. }
  35755. /**
  35756. * @function
  35757. * @memberof Modifiers
  35758. * @argument {Object} data - The data object generated by update method
  35759. * @argument {Object} options - Modifiers configuration and options
  35760. * @returns {Object} The data object, properly modified
  35761. */
  35762. function keepTogether(data) {
  35763. var _data$offsets = data.offsets,
  35764. popper = _data$offsets.popper,
  35765. reference = _data$offsets.reference;
  35766. var placement = data.placement.split('-')[0];
  35767. var floor = Math.floor;
  35768. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35769. var side = isVertical ? 'right' : 'bottom';
  35770. var opSide = isVertical ? 'left' : 'top';
  35771. var measurement = isVertical ? 'width' : 'height';
  35772. if (popper[side] < floor(reference[opSide])) {
  35773. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35774. }
  35775. if (popper[opSide] > floor(reference[side])) {
  35776. data.offsets.popper[opSide] = floor(reference[side]);
  35777. }
  35778. return data;
  35779. }
  35780. /**
  35781. * Converts a string containing value + unit into a px value number
  35782. * @function
  35783. * @memberof {modifiers~offset}
  35784. * @private
  35785. * @argument {String} str - Value + unit string
  35786. * @argument {String} measurement - `height` or `width`
  35787. * @argument {Object} popperOffsets
  35788. * @argument {Object} referenceOffsets
  35789. * @returns {Number|String}
  35790. * Value in pixels, or original string if no values were extracted
  35791. */
  35792. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35793. // separate value from unit
  35794. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35795. var value = +split[1];
  35796. var unit = split[2];
  35797. // If it's not a number it's an operator, I guess
  35798. if (!value) {
  35799. return str;
  35800. }
  35801. if (unit.indexOf('%') === 0) {
  35802. var element = void 0;
  35803. switch (unit) {
  35804. case '%p':
  35805. element = popperOffsets;
  35806. break;
  35807. case '%':
  35808. case '%r':
  35809. default:
  35810. element = referenceOffsets;
  35811. }
  35812. var rect = getClientRect(element);
  35813. return rect[measurement] / 100 * value;
  35814. } else if (unit === 'vh' || unit === 'vw') {
  35815. // if is a vh or vw, we calculate the size based on the viewport
  35816. var size = void 0;
  35817. if (unit === 'vh') {
  35818. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35819. } else {
  35820. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35821. }
  35822. return size / 100 * value;
  35823. } else {
  35824. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35825. // if is an implicit unit, it's px, and we return just the value
  35826. return value;
  35827. }
  35828. }
  35829. /**
  35830. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35831. * @function
  35832. * @memberof {modifiers~offset}
  35833. * @private
  35834. * @argument {String} offset
  35835. * @argument {Object} popperOffsets
  35836. * @argument {Object} referenceOffsets
  35837. * @argument {String} basePlacement
  35838. * @returns {Array} a two cells array with x and y offsets in numbers
  35839. */
  35840. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35841. var offsets = [0, 0];
  35842. // Use height if placement is left or right and index is 0 otherwise use width
  35843. // in this way the first offset will use an axis and the second one
  35844. // will use the other one
  35845. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35846. // Split the offset string to obtain a list of values and operands
  35847. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35848. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35849. return frag.trim();
  35850. });
  35851. // Detect if the offset string contains a pair of values or a single one
  35852. // they could be separated by comma or space
  35853. var divider = fragments.indexOf(find(fragments, function (frag) {
  35854. return frag.search(/,|\s/) !== -1;
  35855. }));
  35856. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35857. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35858. }
  35859. // If divider is found, we divide the list of values and operands to divide
  35860. // them by ofset X and Y.
  35861. var splitRegex = /\s*,\s*|\s+/;
  35862. 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];
  35863. // Convert the values with units to absolute pixels to allow our computations
  35864. ops = ops.map(function (op, index) {
  35865. // Most of the units rely on the orientation of the popper
  35866. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35867. var mergeWithPrevious = false;
  35868. return op
  35869. // This aggregates any `+` or `-` sign that aren't considered operators
  35870. // e.g.: 10 + +5 => [10, +, +5]
  35871. .reduce(function (a, b) {
  35872. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35873. a[a.length - 1] = b;
  35874. mergeWithPrevious = true;
  35875. return a;
  35876. } else if (mergeWithPrevious) {
  35877. a[a.length - 1] += b;
  35878. mergeWithPrevious = false;
  35879. return a;
  35880. } else {
  35881. return a.concat(b);
  35882. }
  35883. }, [])
  35884. // Here we convert the string values into number values (in px)
  35885. .map(function (str) {
  35886. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35887. });
  35888. });
  35889. // Loop trough the offsets arrays and execute the operations
  35890. ops.forEach(function (op, index) {
  35891. op.forEach(function (frag, index2) {
  35892. if (isNumeric(frag)) {
  35893. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35894. }
  35895. });
  35896. });
  35897. return offsets;
  35898. }
  35899. /**
  35900. * @function
  35901. * @memberof Modifiers
  35902. * @argument {Object} data - The data object generated by update method
  35903. * @argument {Object} options - Modifiers configuration and options
  35904. * @argument {Number|String} options.offset=0
  35905. * The offset value as described in the modifier description
  35906. * @returns {Object} The data object, properly modified
  35907. */
  35908. function offset(data, _ref) {
  35909. var offset = _ref.offset;
  35910. var placement = data.placement,
  35911. _data$offsets = data.offsets,
  35912. popper = _data$offsets.popper,
  35913. reference = _data$offsets.reference;
  35914. var basePlacement = placement.split('-')[0];
  35915. var offsets = void 0;
  35916. if (isNumeric(+offset)) {
  35917. offsets = [+offset, 0];
  35918. } else {
  35919. offsets = parseOffset(offset, popper, reference, basePlacement);
  35920. }
  35921. if (basePlacement === 'left') {
  35922. popper.top += offsets[0];
  35923. popper.left -= offsets[1];
  35924. } else if (basePlacement === 'right') {
  35925. popper.top += offsets[0];
  35926. popper.left += offsets[1];
  35927. } else if (basePlacement === 'top') {
  35928. popper.left += offsets[0];
  35929. popper.top -= offsets[1];
  35930. } else if (basePlacement === 'bottom') {
  35931. popper.left += offsets[0];
  35932. popper.top += offsets[1];
  35933. }
  35934. data.popper = popper;
  35935. return data;
  35936. }
  35937. /**
  35938. * @function
  35939. * @memberof Modifiers
  35940. * @argument {Object} data - The data object generated by `update` method
  35941. * @argument {Object} options - Modifiers configuration and options
  35942. * @returns {Object} The data object, properly modified
  35943. */
  35944. function preventOverflow(data, options) {
  35945. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35946. // If offsetParent is the reference element, we really want to
  35947. // go one step up and use the next offsetParent as reference to
  35948. // avoid to make this modifier completely useless and look like broken
  35949. if (data.instance.reference === boundariesElement) {
  35950. boundariesElement = getOffsetParent(boundariesElement);
  35951. }
  35952. // NOTE: DOM access here
  35953. // resets the popper's position so that the document size can be calculated excluding
  35954. // the size of the popper element itself
  35955. var transformProp = getSupportedPropertyName('transform');
  35956. var popperStyles = data.instance.popper.style; // assignment to help minification
  35957. var top = popperStyles.top,
  35958. left = popperStyles.left,
  35959. transform = popperStyles[transformProp];
  35960. popperStyles.top = '';
  35961. popperStyles.left = '';
  35962. popperStyles[transformProp] = '';
  35963. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35964. // NOTE: DOM access here
  35965. // restores the original style properties after the offsets have been computed
  35966. popperStyles.top = top;
  35967. popperStyles.left = left;
  35968. popperStyles[transformProp] = transform;
  35969. options.boundaries = boundaries;
  35970. var order = options.priority;
  35971. var popper = data.offsets.popper;
  35972. var check = {
  35973. primary: function primary(placement) {
  35974. var value = popper[placement];
  35975. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35976. value = Math.max(popper[placement], boundaries[placement]);
  35977. }
  35978. return defineProperty({}, placement, value);
  35979. },
  35980. secondary: function secondary(placement) {
  35981. var mainSide = placement === 'right' ? 'left' : 'top';
  35982. var value = popper[mainSide];
  35983. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35984. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35985. }
  35986. return defineProperty({}, mainSide, value);
  35987. }
  35988. };
  35989. order.forEach(function (placement) {
  35990. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35991. popper = _extends({}, popper, check[side](placement));
  35992. });
  35993. data.offsets.popper = popper;
  35994. return data;
  35995. }
  35996. /**
  35997. * @function
  35998. * @memberof Modifiers
  35999. * @argument {Object} data - The data object generated by `update` method
  36000. * @argument {Object} options - Modifiers configuration and options
  36001. * @returns {Object} The data object, properly modified
  36002. */
  36003. function shift(data) {
  36004. var placement = data.placement;
  36005. var basePlacement = placement.split('-')[0];
  36006. var shiftvariation = placement.split('-')[1];
  36007. // if shift shiftvariation is specified, run the modifier
  36008. if (shiftvariation) {
  36009. var _data$offsets = data.offsets,
  36010. reference = _data$offsets.reference,
  36011. popper = _data$offsets.popper;
  36012. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36013. var side = isVertical ? 'left' : 'top';
  36014. var measurement = isVertical ? 'width' : 'height';
  36015. var shiftOffsets = {
  36016. start: defineProperty({}, side, reference[side]),
  36017. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36018. };
  36019. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36020. }
  36021. return data;
  36022. }
  36023. /**
  36024. * @function
  36025. * @memberof Modifiers
  36026. * @argument {Object} data - The data object generated by update method
  36027. * @argument {Object} options - Modifiers configuration and options
  36028. * @returns {Object} The data object, properly modified
  36029. */
  36030. function hide(data) {
  36031. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36032. return data;
  36033. }
  36034. var refRect = data.offsets.reference;
  36035. var bound = find(data.instance.modifiers, function (modifier) {
  36036. return modifier.name === 'preventOverflow';
  36037. }).boundaries;
  36038. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36039. // Avoid unnecessary DOM access if visibility hasn't changed
  36040. if (data.hide === true) {
  36041. return data;
  36042. }
  36043. data.hide = true;
  36044. data.attributes['x-out-of-boundaries'] = '';
  36045. } else {
  36046. // Avoid unnecessary DOM access if visibility hasn't changed
  36047. if (data.hide === false) {
  36048. return data;
  36049. }
  36050. data.hide = false;
  36051. data.attributes['x-out-of-boundaries'] = false;
  36052. }
  36053. return data;
  36054. }
  36055. /**
  36056. * @function
  36057. * @memberof Modifiers
  36058. * @argument {Object} data - The data object generated by `update` method
  36059. * @argument {Object} options - Modifiers configuration and options
  36060. * @returns {Object} The data object, properly modified
  36061. */
  36062. function inner(data) {
  36063. var placement = data.placement;
  36064. var basePlacement = placement.split('-')[0];
  36065. var _data$offsets = data.offsets,
  36066. popper = _data$offsets.popper,
  36067. reference = _data$offsets.reference;
  36068. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36069. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36070. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36071. data.placement = getOppositePlacement(placement);
  36072. data.offsets.popper = getClientRect(popper);
  36073. return data;
  36074. }
  36075. /**
  36076. * Modifier function, each modifier can have a function of this type assigned
  36077. * to its `fn` property.<br />
  36078. * These functions will be called on each update, this means that you must
  36079. * make sure they are performant enough to avoid performance bottlenecks.
  36080. *
  36081. * @function ModifierFn
  36082. * @argument {dataObject} data - The data object generated by `update` method
  36083. * @argument {Object} options - Modifiers configuration and options
  36084. * @returns {dataObject} The data object, properly modified
  36085. */
  36086. /**
  36087. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36088. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36089. * needed by the library.
  36090. *
  36091. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36092. * All the other properties are configurations that could be tweaked.
  36093. * @namespace modifiers
  36094. */
  36095. var modifiers = {
  36096. /**
  36097. * Modifier used to shift the popper on the start or end of its reference
  36098. * element.<br />
  36099. * It will read the variation of the `placement` property.<br />
  36100. * It can be one either `-end` or `-start`.
  36101. * @memberof modifiers
  36102. * @inner
  36103. */
  36104. shift: {
  36105. /** @prop {number} order=100 - Index used to define the order of execution */
  36106. order: 100,
  36107. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36108. enabled: true,
  36109. /** @prop {ModifierFn} */
  36110. fn: shift
  36111. },
  36112. /**
  36113. * The `offset` modifier can shift your popper on both its axis.
  36114. *
  36115. * It accepts the following units:
  36116. * - `px` or unit-less, interpreted as pixels
  36117. * - `%` or `%r`, percentage relative to the length of the reference element
  36118. * - `%p`, percentage relative to the length of the popper element
  36119. * - `vw`, CSS viewport width unit
  36120. * - `vh`, CSS viewport height unit
  36121. *
  36122. * For length is intended the main axis relative to the placement of the popper.<br />
  36123. * This means that if the placement is `top` or `bottom`, the length will be the
  36124. * `width`. In case of `left` or `right`, it will be the `height`.
  36125. *
  36126. * You can provide a single value (as `Number` or `String`), or a pair of values
  36127. * as `String` divided by a comma or one (or more) white spaces.<br />
  36128. * The latter is a deprecated method because it leads to confusion and will be
  36129. * removed in v2.<br />
  36130. * Additionally, it accepts additions and subtractions between different units.
  36131. * Note that multiplications and divisions aren't supported.
  36132. *
  36133. * Valid examples are:
  36134. * ```
  36135. * 10
  36136. * '10%'
  36137. * '10, 10'
  36138. * '10%, 10'
  36139. * '10 + 10%'
  36140. * '10 - 5vh + 3%'
  36141. * '-10px + 5vh, 5px - 6%'
  36142. * ```
  36143. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36144. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36145. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36146. *
  36147. * @memberof modifiers
  36148. * @inner
  36149. */
  36150. offset: {
  36151. /** @prop {number} order=200 - Index used to define the order of execution */
  36152. order: 200,
  36153. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36154. enabled: true,
  36155. /** @prop {ModifierFn} */
  36156. fn: offset,
  36157. /** @prop {Number|String} offset=0
  36158. * The offset value as described in the modifier description
  36159. */
  36160. offset: 0
  36161. },
  36162. /**
  36163. * Modifier used to prevent the popper from being positioned outside the boundary.
  36164. *
  36165. * A scenario exists where the reference itself is not within the boundaries.<br />
  36166. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36167. * In this case we need to decide whether the popper should either:
  36168. *
  36169. * - detach from the reference and remain "trapped" in the boundaries, or
  36170. * - if it should ignore the boundary and "escape with its reference"
  36171. *
  36172. * When `escapeWithReference` is set to`true` and reference is completely
  36173. * outside its boundaries, the popper will overflow (or completely leave)
  36174. * the boundaries in order to remain attached to the edge of the reference.
  36175. *
  36176. * @memberof modifiers
  36177. * @inner
  36178. */
  36179. preventOverflow: {
  36180. /** @prop {number} order=300 - Index used to define the order of execution */
  36181. order: 300,
  36182. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36183. enabled: true,
  36184. /** @prop {ModifierFn} */
  36185. fn: preventOverflow,
  36186. /**
  36187. * @prop {Array} [priority=['left','right','top','bottom']]
  36188. * Popper will try to prevent overflow following these priorities by default,
  36189. * then, it could overflow on the left and on top of the `boundariesElement`
  36190. */
  36191. priority: ['left', 'right', 'top', 'bottom'],
  36192. /**
  36193. * @prop {number} padding=5
  36194. * Amount of pixel used to define a minimum distance between the boundaries
  36195. * and the popper. This makes sure the popper always has a little padding
  36196. * between the edges of its container
  36197. */
  36198. padding: 5,
  36199. /**
  36200. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36201. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36202. * `viewport` or any DOM element.
  36203. */
  36204. boundariesElement: 'scrollParent'
  36205. },
  36206. /**
  36207. * Modifier used to make sure the reference and its popper stay near each other
  36208. * without leaving any gap between the two. Especially useful when the arrow is
  36209. * enabled and you want to ensure that it points to its reference element.
  36210. * It cares only about the first axis. You can still have poppers with margin
  36211. * between the popper and its reference element.
  36212. * @memberof modifiers
  36213. * @inner
  36214. */
  36215. keepTogether: {
  36216. /** @prop {number} order=400 - Index used to define the order of execution */
  36217. order: 400,
  36218. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36219. enabled: true,
  36220. /** @prop {ModifierFn} */
  36221. fn: keepTogether
  36222. },
  36223. /**
  36224. * This modifier is used to move the `arrowElement` of the popper to make
  36225. * sure it is positioned between the reference element and its popper element.
  36226. * It will read the outer size of the `arrowElement` node to detect how many
  36227. * pixels of conjunction are needed.
  36228. *
  36229. * It has no effect if no `arrowElement` is provided.
  36230. * @memberof modifiers
  36231. * @inner
  36232. */
  36233. arrow: {
  36234. /** @prop {number} order=500 - Index used to define the order of execution */
  36235. order: 500,
  36236. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36237. enabled: true,
  36238. /** @prop {ModifierFn} */
  36239. fn: arrow,
  36240. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36241. element: '[x-arrow]'
  36242. },
  36243. /**
  36244. * Modifier used to flip the popper's placement when it starts to overlap its
  36245. * reference element.
  36246. *
  36247. * Requires the `preventOverflow` modifier before it in order to work.
  36248. *
  36249. * **NOTE:** this modifier will interrupt the current update cycle and will
  36250. * restart it if it detects the need to flip the placement.
  36251. * @memberof modifiers
  36252. * @inner
  36253. */
  36254. flip: {
  36255. /** @prop {number} order=600 - Index used to define the order of execution */
  36256. order: 600,
  36257. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36258. enabled: true,
  36259. /** @prop {ModifierFn} */
  36260. fn: flip,
  36261. /**
  36262. * @prop {String|Array} behavior='flip'
  36263. * The behavior used to change the popper's placement. It can be one of
  36264. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36265. * placements (with optional variations)
  36266. */
  36267. behavior: 'flip',
  36268. /**
  36269. * @prop {number} padding=5
  36270. * The popper will flip if it hits the edges of the `boundariesElement`
  36271. */
  36272. padding: 5,
  36273. /**
  36274. * @prop {String|HTMLElement} boundariesElement='viewport'
  36275. * The element which will define the boundaries of the popper position.
  36276. * The popper will never be placed outside of the defined boundaries
  36277. * (except if `keepTogether` is enabled)
  36278. */
  36279. boundariesElement: 'viewport',
  36280. /**
  36281. * @prop {Boolean} flipVariations=false
  36282. * The popper will switch placement variation between `-start` and `-end` when
  36283. * the reference element overlaps its boundaries.
  36284. *
  36285. * The original placement should have a set variation.
  36286. */
  36287. flipVariations: false,
  36288. /**
  36289. * @prop {Boolean} flipVariationsByContent=false
  36290. * The popper will switch placement variation between `-start` and `-end` when
  36291. * the popper element overlaps its reference boundaries.
  36292. *
  36293. * The original placement should have a set variation.
  36294. */
  36295. flipVariationsByContent: false
  36296. },
  36297. /**
  36298. * Modifier used to make the popper flow toward the inner of the reference element.
  36299. * By default, when this modifier is disabled, the popper will be placed outside
  36300. * the reference element.
  36301. * @memberof modifiers
  36302. * @inner
  36303. */
  36304. inner: {
  36305. /** @prop {number} order=700 - Index used to define the order of execution */
  36306. order: 700,
  36307. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36308. enabled: false,
  36309. /** @prop {ModifierFn} */
  36310. fn: inner
  36311. },
  36312. /**
  36313. * Modifier used to hide the popper when its reference element is outside of the
  36314. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36315. * be used to hide with a CSS selector the popper when its reference is
  36316. * out of boundaries.
  36317. *
  36318. * Requires the `preventOverflow` modifier before it in order to work.
  36319. * @memberof modifiers
  36320. * @inner
  36321. */
  36322. hide: {
  36323. /** @prop {number} order=800 - Index used to define the order of execution */
  36324. order: 800,
  36325. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36326. enabled: true,
  36327. /** @prop {ModifierFn} */
  36328. fn: hide
  36329. },
  36330. /**
  36331. * Computes the style that will be applied to the popper element to gets
  36332. * properly positioned.
  36333. *
  36334. * Note that this modifier will not touch the DOM, it just prepares the styles
  36335. * so that `applyStyle` modifier can apply it. This separation is useful
  36336. * in case you need to replace `applyStyle` with a custom implementation.
  36337. *
  36338. * This modifier has `850` as `order` value to maintain backward compatibility
  36339. * with previous versions of Popper.js. Expect the modifiers ordering method
  36340. * to change in future major versions of the library.
  36341. *
  36342. * @memberof modifiers
  36343. * @inner
  36344. */
  36345. computeStyle: {
  36346. /** @prop {number} order=850 - Index used to define the order of execution */
  36347. order: 850,
  36348. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36349. enabled: true,
  36350. /** @prop {ModifierFn} */
  36351. fn: computeStyle,
  36352. /**
  36353. * @prop {Boolean} gpuAcceleration=true
  36354. * If true, it uses the CSS 3D transformation to position the popper.
  36355. * Otherwise, it will use the `top` and `left` properties
  36356. */
  36357. gpuAcceleration: true,
  36358. /**
  36359. * @prop {string} [x='bottom']
  36360. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36361. * Change this if your popper should grow in a direction different from `bottom`
  36362. */
  36363. x: 'bottom',
  36364. /**
  36365. * @prop {string} [x='left']
  36366. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36367. * Change this if your popper should grow in a direction different from `right`
  36368. */
  36369. y: 'right'
  36370. },
  36371. /**
  36372. * Applies the computed styles to the popper element.
  36373. *
  36374. * All the DOM manipulations are limited to this modifier. This is useful in case
  36375. * you want to integrate Popper.js inside a framework or view library and you
  36376. * want to delegate all the DOM manipulations to it.
  36377. *
  36378. * Note that if you disable this modifier, you must make sure the popper element
  36379. * has its position set to `absolute` before Popper.js can do its work!
  36380. *
  36381. * Just disable this modifier and define your own to achieve the desired effect.
  36382. *
  36383. * @memberof modifiers
  36384. * @inner
  36385. */
  36386. applyStyle: {
  36387. /** @prop {number} order=900 - Index used to define the order of execution */
  36388. order: 900,
  36389. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36390. enabled: true,
  36391. /** @prop {ModifierFn} */
  36392. fn: applyStyle,
  36393. /** @prop {Function} */
  36394. onLoad: applyStyleOnLoad,
  36395. /**
  36396. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36397. * @prop {Boolean} gpuAcceleration=true
  36398. * If true, it uses the CSS 3D transformation to position the popper.
  36399. * Otherwise, it will use the `top` and `left` properties
  36400. */
  36401. gpuAcceleration: undefined
  36402. }
  36403. };
  36404. /**
  36405. * The `dataObject` is an object containing all the information used by Popper.js.
  36406. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36407. * @name dataObject
  36408. * @property {Object} data.instance The Popper.js instance
  36409. * @property {String} data.placement Placement applied to popper
  36410. * @property {String} data.originalPlacement Placement originally defined on init
  36411. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36412. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36413. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36414. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36415. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36416. * @property {Object} data.boundaries Offsets of the popper boundaries
  36417. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36418. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36419. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36420. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36421. */
  36422. /**
  36423. * Default options provided to Popper.js constructor.<br />
  36424. * These can be overridden using the `options` argument of Popper.js.<br />
  36425. * To override an option, simply pass an object with the same
  36426. * structure of the `options` object, as the 3rd argument. For example:
  36427. * ```
  36428. * new Popper(ref, pop, {
  36429. * modifiers: {
  36430. * preventOverflow: { enabled: false }
  36431. * }
  36432. * })
  36433. * ```
  36434. * @type {Object}
  36435. * @static
  36436. * @memberof Popper
  36437. */
  36438. var Defaults = {
  36439. /**
  36440. * Popper's placement.
  36441. * @prop {Popper.placements} placement='bottom'
  36442. */
  36443. placement: 'bottom',
  36444. /**
  36445. * Set this to true if you want popper to position it self in 'fixed' mode
  36446. * @prop {Boolean} positionFixed=false
  36447. */
  36448. positionFixed: false,
  36449. /**
  36450. * Whether events (resize, scroll) are initially enabled.
  36451. * @prop {Boolean} eventsEnabled=true
  36452. */
  36453. eventsEnabled: true,
  36454. /**
  36455. * Set to true if you want to automatically remove the popper when
  36456. * you call the `destroy` method.
  36457. * @prop {Boolean} removeOnDestroy=false
  36458. */
  36459. removeOnDestroy: false,
  36460. /**
  36461. * Callback called when the popper is created.<br />
  36462. * By default, it is set to no-op.<br />
  36463. * Access Popper.js instance with `data.instance`.
  36464. * @prop {onCreate}
  36465. */
  36466. onCreate: function onCreate() {},
  36467. /**
  36468. * Callback called when the popper is updated. This callback is not called
  36469. * on the initialization/creation of the popper, but only on subsequent
  36470. * updates.<br />
  36471. * By default, it is set to no-op.<br />
  36472. * Access Popper.js instance with `data.instance`.
  36473. * @prop {onUpdate}
  36474. */
  36475. onUpdate: function onUpdate() {},
  36476. /**
  36477. * List of modifiers used to modify the offsets before they are applied to the popper.
  36478. * They provide most of the functionalities of Popper.js.
  36479. * @prop {modifiers}
  36480. */
  36481. modifiers: modifiers
  36482. };
  36483. /**
  36484. * @callback onCreate
  36485. * @param {dataObject} data
  36486. */
  36487. /**
  36488. * @callback onUpdate
  36489. * @param {dataObject} data
  36490. */
  36491. // Utils
  36492. // Methods
  36493. var Popper = function () {
  36494. /**
  36495. * Creates a new Popper.js instance.
  36496. * @class Popper
  36497. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36498. * @param {Element} popper - The HTML / XML element used as the popper
  36499. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36500. * @return {Object} instance - The generated Popper.js instance
  36501. */
  36502. function Popper(reference, popper) {
  36503. var _this = this;
  36504. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36505. classCallCheck(this, Popper);
  36506. this.scheduleUpdate = function () {
  36507. return requestAnimationFrame(_this.update);
  36508. };
  36509. // make update() debounced, so that it only runs at most once-per-tick
  36510. this.update = debounce(this.update.bind(this));
  36511. // with {} we create a new object with the options inside it
  36512. this.options = _extends({}, Popper.Defaults, options);
  36513. // init state
  36514. this.state = {
  36515. isDestroyed: false,
  36516. isCreated: false,
  36517. scrollParents: []
  36518. };
  36519. // get reference and popper elements (allow jQuery wrappers)
  36520. this.reference = reference && reference.jquery ? reference[0] : reference;
  36521. this.popper = popper && popper.jquery ? popper[0] : popper;
  36522. // Deep merge modifiers options
  36523. this.options.modifiers = {};
  36524. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36525. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36526. });
  36527. // Refactoring modifiers' list (Object => Array)
  36528. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36529. return _extends({
  36530. name: name
  36531. }, _this.options.modifiers[name]);
  36532. })
  36533. // sort the modifiers by order
  36534. .sort(function (a, b) {
  36535. return a.order - b.order;
  36536. });
  36537. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36538. // such code is executed in the same order of its modifier
  36539. // they could add new properties to their options configuration
  36540. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36541. this.modifiers.forEach(function (modifierOptions) {
  36542. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36543. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36544. }
  36545. });
  36546. // fire the first update to position the popper in the right place
  36547. this.update();
  36548. var eventsEnabled = this.options.eventsEnabled;
  36549. if (eventsEnabled) {
  36550. // setup event listeners, they will take care of update the position in specific situations
  36551. this.enableEventListeners();
  36552. }
  36553. this.state.eventsEnabled = eventsEnabled;
  36554. }
  36555. // We can't use class properties because they don't get listed in the
  36556. // class prototype and break stuff like Sinon stubs
  36557. createClass(Popper, [{
  36558. key: 'update',
  36559. value: function update$$1() {
  36560. return update.call(this);
  36561. }
  36562. }, {
  36563. key: 'destroy',
  36564. value: function destroy$$1() {
  36565. return destroy.call(this);
  36566. }
  36567. }, {
  36568. key: 'enableEventListeners',
  36569. value: function enableEventListeners$$1() {
  36570. return enableEventListeners.call(this);
  36571. }
  36572. }, {
  36573. key: 'disableEventListeners',
  36574. value: function disableEventListeners$$1() {
  36575. return disableEventListeners.call(this);
  36576. }
  36577. /**
  36578. * Schedules an update. It will run on the next UI update available.
  36579. * @method scheduleUpdate
  36580. * @memberof Popper
  36581. */
  36582. /**
  36583. * Collection of utilities useful when writing custom modifiers.
  36584. * Starting from version 1.7, this method is available only if you
  36585. * include `popper-utils.js` before `popper.js`.
  36586. *
  36587. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36588. * and will be removed in v2! Use the PopperUtils module directly instead.
  36589. * Due to the high instability of the methods contained in Utils, we can't
  36590. * guarantee them to follow semver. Use them at your own risk!
  36591. * @static
  36592. * @private
  36593. * @type {Object}
  36594. * @deprecated since version 1.8
  36595. * @member Utils
  36596. * @memberof Popper
  36597. */
  36598. }]);
  36599. return Popper;
  36600. }();
  36601. /**
  36602. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36603. * and lets you use it as replacement of a real DOM node.<br />
  36604. * You can use this method to position a popper relatively to a set of coordinates
  36605. * in case you don't have a DOM node to use as reference.
  36606. *
  36607. * ```
  36608. * new Popper(referenceObject, popperNode);
  36609. * ```
  36610. *
  36611. * NB: This feature isn't supported in Internet Explorer 10.
  36612. * @name referenceObject
  36613. * @property {Function} data.getBoundingClientRect
  36614. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36615. * @property {number} data.clientWidth
  36616. * An ES6 getter that will return the width of the virtual reference element.
  36617. * @property {number} data.clientHeight
  36618. * An ES6 getter that will return the height of the virtual reference element.
  36619. */
  36620. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36621. Popper.placements = placements;
  36622. Popper.Defaults = Defaults;
  36623. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36624. //# sourceMappingURL=popper.js.map
  36625. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36626. /***/ }),
  36627. /***/ "./node_modules/process/browser.js":
  36628. /*!*****************************************!*\
  36629. !*** ./node_modules/process/browser.js ***!
  36630. \*****************************************/
  36631. /*! no static exports found */
  36632. /***/ (function(module, exports) {
  36633. // shim for using process in browser
  36634. var process = module.exports = {};
  36635. // cached from whatever global is present so that test runners that stub it
  36636. // don't break things. But we need to wrap it in a try catch in case it is
  36637. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36638. // function because try/catches deoptimize in certain engines.
  36639. var cachedSetTimeout;
  36640. var cachedClearTimeout;
  36641. function defaultSetTimout() {
  36642. throw new Error('setTimeout has not been defined');
  36643. }
  36644. function defaultClearTimeout () {
  36645. throw new Error('clearTimeout has not been defined');
  36646. }
  36647. (function () {
  36648. try {
  36649. if (typeof setTimeout === 'function') {
  36650. cachedSetTimeout = setTimeout;
  36651. } else {
  36652. cachedSetTimeout = defaultSetTimout;
  36653. }
  36654. } catch (e) {
  36655. cachedSetTimeout = defaultSetTimout;
  36656. }
  36657. try {
  36658. if (typeof clearTimeout === 'function') {
  36659. cachedClearTimeout = clearTimeout;
  36660. } else {
  36661. cachedClearTimeout = defaultClearTimeout;
  36662. }
  36663. } catch (e) {
  36664. cachedClearTimeout = defaultClearTimeout;
  36665. }
  36666. } ())
  36667. function runTimeout(fun) {
  36668. if (cachedSetTimeout === setTimeout) {
  36669. //normal enviroments in sane situations
  36670. return setTimeout(fun, 0);
  36671. }
  36672. // if setTimeout wasn't available but was latter defined
  36673. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36674. cachedSetTimeout = setTimeout;
  36675. return setTimeout(fun, 0);
  36676. }
  36677. try {
  36678. // when when somebody has screwed with setTimeout but no I.E. maddness
  36679. return cachedSetTimeout(fun, 0);
  36680. } catch(e){
  36681. try {
  36682. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36683. return cachedSetTimeout.call(null, fun, 0);
  36684. } catch(e){
  36685. // 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
  36686. return cachedSetTimeout.call(this, fun, 0);
  36687. }
  36688. }
  36689. }
  36690. function runClearTimeout(marker) {
  36691. if (cachedClearTimeout === clearTimeout) {
  36692. //normal enviroments in sane situations
  36693. return clearTimeout(marker);
  36694. }
  36695. // if clearTimeout wasn't available but was latter defined
  36696. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36697. cachedClearTimeout = clearTimeout;
  36698. return clearTimeout(marker);
  36699. }
  36700. try {
  36701. // when when somebody has screwed with setTimeout but no I.E. maddness
  36702. return cachedClearTimeout(marker);
  36703. } catch (e){
  36704. try {
  36705. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36706. return cachedClearTimeout.call(null, marker);
  36707. } catch (e){
  36708. // 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.
  36709. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36710. return cachedClearTimeout.call(this, marker);
  36711. }
  36712. }
  36713. }
  36714. var queue = [];
  36715. var draining = false;
  36716. var currentQueue;
  36717. var queueIndex = -1;
  36718. function cleanUpNextTick() {
  36719. if (!draining || !currentQueue) {
  36720. return;
  36721. }
  36722. draining = false;
  36723. if (currentQueue.length) {
  36724. queue = currentQueue.concat(queue);
  36725. } else {
  36726. queueIndex = -1;
  36727. }
  36728. if (queue.length) {
  36729. drainQueue();
  36730. }
  36731. }
  36732. function drainQueue() {
  36733. if (draining) {
  36734. return;
  36735. }
  36736. var timeout = runTimeout(cleanUpNextTick);
  36737. draining = true;
  36738. var len = queue.length;
  36739. while(len) {
  36740. currentQueue = queue;
  36741. queue = [];
  36742. while (++queueIndex < len) {
  36743. if (currentQueue) {
  36744. currentQueue[queueIndex].run();
  36745. }
  36746. }
  36747. queueIndex = -1;
  36748. len = queue.length;
  36749. }
  36750. currentQueue = null;
  36751. draining = false;
  36752. runClearTimeout(timeout);
  36753. }
  36754. process.nextTick = function (fun) {
  36755. var args = new Array(arguments.length - 1);
  36756. if (arguments.length > 1) {
  36757. for (var i = 1; i < arguments.length; i++) {
  36758. args[i - 1] = arguments[i];
  36759. }
  36760. }
  36761. queue.push(new Item(fun, args));
  36762. if (queue.length === 1 && !draining) {
  36763. runTimeout(drainQueue);
  36764. }
  36765. };
  36766. // v8 likes predictible objects
  36767. function Item(fun, array) {
  36768. this.fun = fun;
  36769. this.array = array;
  36770. }
  36771. Item.prototype.run = function () {
  36772. this.fun.apply(null, this.array);
  36773. };
  36774. process.title = 'browser';
  36775. process.browser = true;
  36776. process.env = {};
  36777. process.argv = [];
  36778. process.version = ''; // empty string to avoid regexp issues
  36779. process.versions = {};
  36780. function noop() {}
  36781. process.on = noop;
  36782. process.addListener = noop;
  36783. process.once = noop;
  36784. process.off = noop;
  36785. process.removeListener = noop;
  36786. process.removeAllListeners = noop;
  36787. process.emit = noop;
  36788. process.prependListener = noop;
  36789. process.prependOnceListener = noop;
  36790. process.listeners = function (name) { return [] }
  36791. process.binding = function (name) {
  36792. throw new Error('process.binding is not supported');
  36793. };
  36794. process.cwd = function () { return '/' };
  36795. process.chdir = function (dir) {
  36796. throw new Error('process.chdir is not supported');
  36797. };
  36798. process.umask = function() { return 0; };
  36799. /***/ }),
  36800. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36801. /*!***************************************************!*\
  36802. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36803. \***************************************************/
  36804. /*! no static exports found */
  36805. /***/ (function(module, exports, __webpack_require__) {
  36806. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36807. * Pusher JavaScript Library v5.0.3
  36808. * https://pusher.com/
  36809. *
  36810. * Copyright 2017, Pusher
  36811. * Released under the MIT licence.
  36812. */
  36813. (function webpackUniversalModuleDefinition(root, factory) {
  36814. if(true)
  36815. module.exports = factory();
  36816. else {}
  36817. })(window, function() {
  36818. return /******/ (function(modules) { // webpackBootstrap
  36819. /******/ // The module cache
  36820. /******/ var installedModules = {};
  36821. /******/
  36822. /******/ // The require function
  36823. /******/ function __webpack_require__(moduleId) {
  36824. /******/
  36825. /******/ // Check if module is in cache
  36826. /******/ if(installedModules[moduleId]) {
  36827. /******/ return installedModules[moduleId].exports;
  36828. /******/ }
  36829. /******/ // Create a new module (and put it into the cache)
  36830. /******/ var module = installedModules[moduleId] = {
  36831. /******/ i: moduleId,
  36832. /******/ l: false,
  36833. /******/ exports: {}
  36834. /******/ };
  36835. /******/
  36836. /******/ // Execute the module function
  36837. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36838. /******/
  36839. /******/ // Flag the module as loaded
  36840. /******/ module.l = true;
  36841. /******/
  36842. /******/ // Return the exports of the module
  36843. /******/ return module.exports;
  36844. /******/ }
  36845. /******/
  36846. /******/
  36847. /******/ // expose the modules object (__webpack_modules__)
  36848. /******/ __webpack_require__.m = modules;
  36849. /******/
  36850. /******/ // expose the module cache
  36851. /******/ __webpack_require__.c = installedModules;
  36852. /******/
  36853. /******/ // define getter function for harmony exports
  36854. /******/ __webpack_require__.d = function(exports, name, getter) {
  36855. /******/ if(!__webpack_require__.o(exports, name)) {
  36856. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36857. /******/ }
  36858. /******/ };
  36859. /******/
  36860. /******/ // define __esModule on exports
  36861. /******/ __webpack_require__.r = function(exports) {
  36862. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36863. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36864. /******/ }
  36865. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36866. /******/ };
  36867. /******/
  36868. /******/ // create a fake namespace object
  36869. /******/ // mode & 1: value is a module id, require it
  36870. /******/ // mode & 2: merge all properties of value into the ns
  36871. /******/ // mode & 4: return value when already ns object
  36872. /******/ // mode & 8|1: behave like require
  36873. /******/ __webpack_require__.t = function(value, mode) {
  36874. /******/ if(mode & 1) value = __webpack_require__(value);
  36875. /******/ if(mode & 8) return value;
  36876. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36877. /******/ var ns = Object.create(null);
  36878. /******/ __webpack_require__.r(ns);
  36879. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36880. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36881. /******/ return ns;
  36882. /******/ };
  36883. /******/
  36884. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36885. /******/ __webpack_require__.n = function(module) {
  36886. /******/ var getter = module && module.__esModule ?
  36887. /******/ function getDefault() { return module['default']; } :
  36888. /******/ function getModuleExports() { return module; };
  36889. /******/ __webpack_require__.d(getter, 'a', getter);
  36890. /******/ return getter;
  36891. /******/ };
  36892. /******/
  36893. /******/ // Object.prototype.hasOwnProperty.call
  36894. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36895. /******/
  36896. /******/ // __webpack_public_path__
  36897. /******/ __webpack_require__.p = "";
  36898. /******/
  36899. /******/
  36900. /******/ // Load entry module and return exports
  36901. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36902. /******/ })
  36903. /************************************************************************/
  36904. /******/ ([
  36905. /* 0 */
  36906. /***/ (function(module, exports, __webpack_require__) {
  36907. (function(nacl) {
  36908. 'use strict';
  36909. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36910. // Public domain.
  36911. //
  36912. // Implementation derived from TweetNaCl version 20140427.
  36913. // See for details: http://tweetnacl.cr.yp.to/
  36914. var gf = function(init) {
  36915. var i, r = new Float64Array(16);
  36916. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36917. return r;
  36918. };
  36919. // Pluggable, initialized in high-level API below.
  36920. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36921. var _0 = new Uint8Array(16);
  36922. var _9 = new Uint8Array(32); _9[0] = 9;
  36923. var gf0 = gf(),
  36924. gf1 = gf([1]),
  36925. _121665 = gf([0xdb41, 1]),
  36926. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36927. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36928. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36929. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36930. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36931. function ts64(x, i, h, l) {
  36932. x[i] = (h >> 24) & 0xff;
  36933. x[i+1] = (h >> 16) & 0xff;
  36934. x[i+2] = (h >> 8) & 0xff;
  36935. x[i+3] = h & 0xff;
  36936. x[i+4] = (l >> 24) & 0xff;
  36937. x[i+5] = (l >> 16) & 0xff;
  36938. x[i+6] = (l >> 8) & 0xff;
  36939. x[i+7] = l & 0xff;
  36940. }
  36941. function vn(x, xi, y, yi, n) {
  36942. var i,d = 0;
  36943. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36944. return (1 & ((d - 1) >>> 8)) - 1;
  36945. }
  36946. function crypto_verify_16(x, xi, y, yi) {
  36947. return vn(x,xi,y,yi,16);
  36948. }
  36949. function crypto_verify_32(x, xi, y, yi) {
  36950. return vn(x,xi,y,yi,32);
  36951. }
  36952. function core_salsa20(o, p, k, c) {
  36953. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36954. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36955. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36956. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36957. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36958. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36959. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36960. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36961. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36962. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36963. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36964. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36965. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36966. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36967. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36968. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36969. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36970. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36971. x15 = j15, u;
  36972. for (var i = 0; i < 20; i += 2) {
  36973. u = x0 + x12 | 0;
  36974. x4 ^= u<<7 | u>>>(32-7);
  36975. u = x4 + x0 | 0;
  36976. x8 ^= u<<9 | u>>>(32-9);
  36977. u = x8 + x4 | 0;
  36978. x12 ^= u<<13 | u>>>(32-13);
  36979. u = x12 + x8 | 0;
  36980. x0 ^= u<<18 | u>>>(32-18);
  36981. u = x5 + x1 | 0;
  36982. x9 ^= u<<7 | u>>>(32-7);
  36983. u = x9 + x5 | 0;
  36984. x13 ^= u<<9 | u>>>(32-9);
  36985. u = x13 + x9 | 0;
  36986. x1 ^= u<<13 | u>>>(32-13);
  36987. u = x1 + x13 | 0;
  36988. x5 ^= u<<18 | u>>>(32-18);
  36989. u = x10 + x6 | 0;
  36990. x14 ^= u<<7 | u>>>(32-7);
  36991. u = x14 + x10 | 0;
  36992. x2 ^= u<<9 | u>>>(32-9);
  36993. u = x2 + x14 | 0;
  36994. x6 ^= u<<13 | u>>>(32-13);
  36995. u = x6 + x2 | 0;
  36996. x10 ^= u<<18 | u>>>(32-18);
  36997. u = x15 + x11 | 0;
  36998. x3 ^= u<<7 | u>>>(32-7);
  36999. u = x3 + x15 | 0;
  37000. x7 ^= u<<9 | u>>>(32-9);
  37001. u = x7 + x3 | 0;
  37002. x11 ^= u<<13 | u>>>(32-13);
  37003. u = x11 + x7 | 0;
  37004. x15 ^= u<<18 | u>>>(32-18);
  37005. u = x0 + x3 | 0;
  37006. x1 ^= u<<7 | u>>>(32-7);
  37007. u = x1 + x0 | 0;
  37008. x2 ^= u<<9 | u>>>(32-9);
  37009. u = x2 + x1 | 0;
  37010. x3 ^= u<<13 | u>>>(32-13);
  37011. u = x3 + x2 | 0;
  37012. x0 ^= u<<18 | u>>>(32-18);
  37013. u = x5 + x4 | 0;
  37014. x6 ^= u<<7 | u>>>(32-7);
  37015. u = x6 + x5 | 0;
  37016. x7 ^= u<<9 | u>>>(32-9);
  37017. u = x7 + x6 | 0;
  37018. x4 ^= u<<13 | u>>>(32-13);
  37019. u = x4 + x7 | 0;
  37020. x5 ^= u<<18 | u>>>(32-18);
  37021. u = x10 + x9 | 0;
  37022. x11 ^= u<<7 | u>>>(32-7);
  37023. u = x11 + x10 | 0;
  37024. x8 ^= u<<9 | u>>>(32-9);
  37025. u = x8 + x11 | 0;
  37026. x9 ^= u<<13 | u>>>(32-13);
  37027. u = x9 + x8 | 0;
  37028. x10 ^= u<<18 | u>>>(32-18);
  37029. u = x15 + x14 | 0;
  37030. x12 ^= u<<7 | u>>>(32-7);
  37031. u = x12 + x15 | 0;
  37032. x13 ^= u<<9 | u>>>(32-9);
  37033. u = x13 + x12 | 0;
  37034. x14 ^= u<<13 | u>>>(32-13);
  37035. u = x14 + x13 | 0;
  37036. x15 ^= u<<18 | u>>>(32-18);
  37037. }
  37038. x0 = x0 + j0 | 0;
  37039. x1 = x1 + j1 | 0;
  37040. x2 = x2 + j2 | 0;
  37041. x3 = x3 + j3 | 0;
  37042. x4 = x4 + j4 | 0;
  37043. x5 = x5 + j5 | 0;
  37044. x6 = x6 + j6 | 0;
  37045. x7 = x7 + j7 | 0;
  37046. x8 = x8 + j8 | 0;
  37047. x9 = x9 + j9 | 0;
  37048. x10 = x10 + j10 | 0;
  37049. x11 = x11 + j11 | 0;
  37050. x12 = x12 + j12 | 0;
  37051. x13 = x13 + j13 | 0;
  37052. x14 = x14 + j14 | 0;
  37053. x15 = x15 + j15 | 0;
  37054. o[ 0] = x0 >>> 0 & 0xff;
  37055. o[ 1] = x0 >>> 8 & 0xff;
  37056. o[ 2] = x0 >>> 16 & 0xff;
  37057. o[ 3] = x0 >>> 24 & 0xff;
  37058. o[ 4] = x1 >>> 0 & 0xff;
  37059. o[ 5] = x1 >>> 8 & 0xff;
  37060. o[ 6] = x1 >>> 16 & 0xff;
  37061. o[ 7] = x1 >>> 24 & 0xff;
  37062. o[ 8] = x2 >>> 0 & 0xff;
  37063. o[ 9] = x2 >>> 8 & 0xff;
  37064. o[10] = x2 >>> 16 & 0xff;
  37065. o[11] = x2 >>> 24 & 0xff;
  37066. o[12] = x3 >>> 0 & 0xff;
  37067. o[13] = x3 >>> 8 & 0xff;
  37068. o[14] = x3 >>> 16 & 0xff;
  37069. o[15] = x3 >>> 24 & 0xff;
  37070. o[16] = x4 >>> 0 & 0xff;
  37071. o[17] = x4 >>> 8 & 0xff;
  37072. o[18] = x4 >>> 16 & 0xff;
  37073. o[19] = x4 >>> 24 & 0xff;
  37074. o[20] = x5 >>> 0 & 0xff;
  37075. o[21] = x5 >>> 8 & 0xff;
  37076. o[22] = x5 >>> 16 & 0xff;
  37077. o[23] = x5 >>> 24 & 0xff;
  37078. o[24] = x6 >>> 0 & 0xff;
  37079. o[25] = x6 >>> 8 & 0xff;
  37080. o[26] = x6 >>> 16 & 0xff;
  37081. o[27] = x6 >>> 24 & 0xff;
  37082. o[28] = x7 >>> 0 & 0xff;
  37083. o[29] = x7 >>> 8 & 0xff;
  37084. o[30] = x7 >>> 16 & 0xff;
  37085. o[31] = x7 >>> 24 & 0xff;
  37086. o[32] = x8 >>> 0 & 0xff;
  37087. o[33] = x8 >>> 8 & 0xff;
  37088. o[34] = x8 >>> 16 & 0xff;
  37089. o[35] = x8 >>> 24 & 0xff;
  37090. o[36] = x9 >>> 0 & 0xff;
  37091. o[37] = x9 >>> 8 & 0xff;
  37092. o[38] = x9 >>> 16 & 0xff;
  37093. o[39] = x9 >>> 24 & 0xff;
  37094. o[40] = x10 >>> 0 & 0xff;
  37095. o[41] = x10 >>> 8 & 0xff;
  37096. o[42] = x10 >>> 16 & 0xff;
  37097. o[43] = x10 >>> 24 & 0xff;
  37098. o[44] = x11 >>> 0 & 0xff;
  37099. o[45] = x11 >>> 8 & 0xff;
  37100. o[46] = x11 >>> 16 & 0xff;
  37101. o[47] = x11 >>> 24 & 0xff;
  37102. o[48] = x12 >>> 0 & 0xff;
  37103. o[49] = x12 >>> 8 & 0xff;
  37104. o[50] = x12 >>> 16 & 0xff;
  37105. o[51] = x12 >>> 24 & 0xff;
  37106. o[52] = x13 >>> 0 & 0xff;
  37107. o[53] = x13 >>> 8 & 0xff;
  37108. o[54] = x13 >>> 16 & 0xff;
  37109. o[55] = x13 >>> 24 & 0xff;
  37110. o[56] = x14 >>> 0 & 0xff;
  37111. o[57] = x14 >>> 8 & 0xff;
  37112. o[58] = x14 >>> 16 & 0xff;
  37113. o[59] = x14 >>> 24 & 0xff;
  37114. o[60] = x15 >>> 0 & 0xff;
  37115. o[61] = x15 >>> 8 & 0xff;
  37116. o[62] = x15 >>> 16 & 0xff;
  37117. o[63] = x15 >>> 24 & 0xff;
  37118. }
  37119. function core_hsalsa20(o,p,k,c) {
  37120. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37121. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37122. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37123. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37124. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37125. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37126. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37127. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37128. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37129. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37130. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37131. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37132. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37133. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37134. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37135. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37136. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37137. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37138. x15 = j15, u;
  37139. for (var i = 0; i < 20; i += 2) {
  37140. u = x0 + x12 | 0;
  37141. x4 ^= u<<7 | u>>>(32-7);
  37142. u = x4 + x0 | 0;
  37143. x8 ^= u<<9 | u>>>(32-9);
  37144. u = x8 + x4 | 0;
  37145. x12 ^= u<<13 | u>>>(32-13);
  37146. u = x12 + x8 | 0;
  37147. x0 ^= u<<18 | u>>>(32-18);
  37148. u = x5 + x1 | 0;
  37149. x9 ^= u<<7 | u>>>(32-7);
  37150. u = x9 + x5 | 0;
  37151. x13 ^= u<<9 | u>>>(32-9);
  37152. u = x13 + x9 | 0;
  37153. x1 ^= u<<13 | u>>>(32-13);
  37154. u = x1 + x13 | 0;
  37155. x5 ^= u<<18 | u>>>(32-18);
  37156. u = x10 + x6 | 0;
  37157. x14 ^= u<<7 | u>>>(32-7);
  37158. u = x14 + x10 | 0;
  37159. x2 ^= u<<9 | u>>>(32-9);
  37160. u = x2 + x14 | 0;
  37161. x6 ^= u<<13 | u>>>(32-13);
  37162. u = x6 + x2 | 0;
  37163. x10 ^= u<<18 | u>>>(32-18);
  37164. u = x15 + x11 | 0;
  37165. x3 ^= u<<7 | u>>>(32-7);
  37166. u = x3 + x15 | 0;
  37167. x7 ^= u<<9 | u>>>(32-9);
  37168. u = x7 + x3 | 0;
  37169. x11 ^= u<<13 | u>>>(32-13);
  37170. u = x11 + x7 | 0;
  37171. x15 ^= u<<18 | u>>>(32-18);
  37172. u = x0 + x3 | 0;
  37173. x1 ^= u<<7 | u>>>(32-7);
  37174. u = x1 + x0 | 0;
  37175. x2 ^= u<<9 | u>>>(32-9);
  37176. u = x2 + x1 | 0;
  37177. x3 ^= u<<13 | u>>>(32-13);
  37178. u = x3 + x2 | 0;
  37179. x0 ^= u<<18 | u>>>(32-18);
  37180. u = x5 + x4 | 0;
  37181. x6 ^= u<<7 | u>>>(32-7);
  37182. u = x6 + x5 | 0;
  37183. x7 ^= u<<9 | u>>>(32-9);
  37184. u = x7 + x6 | 0;
  37185. x4 ^= u<<13 | u>>>(32-13);
  37186. u = x4 + x7 | 0;
  37187. x5 ^= u<<18 | u>>>(32-18);
  37188. u = x10 + x9 | 0;
  37189. x11 ^= u<<7 | u>>>(32-7);
  37190. u = x11 + x10 | 0;
  37191. x8 ^= u<<9 | u>>>(32-9);
  37192. u = x8 + x11 | 0;
  37193. x9 ^= u<<13 | u>>>(32-13);
  37194. u = x9 + x8 | 0;
  37195. x10 ^= u<<18 | u>>>(32-18);
  37196. u = x15 + x14 | 0;
  37197. x12 ^= u<<7 | u>>>(32-7);
  37198. u = x12 + x15 | 0;
  37199. x13 ^= u<<9 | u>>>(32-9);
  37200. u = x13 + x12 | 0;
  37201. x14 ^= u<<13 | u>>>(32-13);
  37202. u = x14 + x13 | 0;
  37203. x15 ^= u<<18 | u>>>(32-18);
  37204. }
  37205. o[ 0] = x0 >>> 0 & 0xff;
  37206. o[ 1] = x0 >>> 8 & 0xff;
  37207. o[ 2] = x0 >>> 16 & 0xff;
  37208. o[ 3] = x0 >>> 24 & 0xff;
  37209. o[ 4] = x5 >>> 0 & 0xff;
  37210. o[ 5] = x5 >>> 8 & 0xff;
  37211. o[ 6] = x5 >>> 16 & 0xff;
  37212. o[ 7] = x5 >>> 24 & 0xff;
  37213. o[ 8] = x10 >>> 0 & 0xff;
  37214. o[ 9] = x10 >>> 8 & 0xff;
  37215. o[10] = x10 >>> 16 & 0xff;
  37216. o[11] = x10 >>> 24 & 0xff;
  37217. o[12] = x15 >>> 0 & 0xff;
  37218. o[13] = x15 >>> 8 & 0xff;
  37219. o[14] = x15 >>> 16 & 0xff;
  37220. o[15] = x15 >>> 24 & 0xff;
  37221. o[16] = x6 >>> 0 & 0xff;
  37222. o[17] = x6 >>> 8 & 0xff;
  37223. o[18] = x6 >>> 16 & 0xff;
  37224. o[19] = x6 >>> 24 & 0xff;
  37225. o[20] = x7 >>> 0 & 0xff;
  37226. o[21] = x7 >>> 8 & 0xff;
  37227. o[22] = x7 >>> 16 & 0xff;
  37228. o[23] = x7 >>> 24 & 0xff;
  37229. o[24] = x8 >>> 0 & 0xff;
  37230. o[25] = x8 >>> 8 & 0xff;
  37231. o[26] = x8 >>> 16 & 0xff;
  37232. o[27] = x8 >>> 24 & 0xff;
  37233. o[28] = x9 >>> 0 & 0xff;
  37234. o[29] = x9 >>> 8 & 0xff;
  37235. o[30] = x9 >>> 16 & 0xff;
  37236. o[31] = x9 >>> 24 & 0xff;
  37237. }
  37238. function crypto_core_salsa20(out,inp,k,c) {
  37239. core_salsa20(out,inp,k,c);
  37240. }
  37241. function crypto_core_hsalsa20(out,inp,k,c) {
  37242. core_hsalsa20(out,inp,k,c);
  37243. }
  37244. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37245. // "expand 32-byte k"
  37246. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37247. var z = new Uint8Array(16), x = new Uint8Array(64);
  37248. var u, i;
  37249. for (i = 0; i < 16; i++) z[i] = 0;
  37250. for (i = 0; i < 8; i++) z[i] = n[i];
  37251. while (b >= 64) {
  37252. crypto_core_salsa20(x,z,k,sigma);
  37253. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37254. u = 1;
  37255. for (i = 8; i < 16; i++) {
  37256. u = u + (z[i] & 0xff) | 0;
  37257. z[i] = u & 0xff;
  37258. u >>>= 8;
  37259. }
  37260. b -= 64;
  37261. cpos += 64;
  37262. mpos += 64;
  37263. }
  37264. if (b > 0) {
  37265. crypto_core_salsa20(x,z,k,sigma);
  37266. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37267. }
  37268. return 0;
  37269. }
  37270. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37271. var z = new Uint8Array(16), x = new Uint8Array(64);
  37272. var u, i;
  37273. for (i = 0; i < 16; i++) z[i] = 0;
  37274. for (i = 0; i < 8; i++) z[i] = n[i];
  37275. while (b >= 64) {
  37276. crypto_core_salsa20(x,z,k,sigma);
  37277. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37278. u = 1;
  37279. for (i = 8; i < 16; i++) {
  37280. u = u + (z[i] & 0xff) | 0;
  37281. z[i] = u & 0xff;
  37282. u >>>= 8;
  37283. }
  37284. b -= 64;
  37285. cpos += 64;
  37286. }
  37287. if (b > 0) {
  37288. crypto_core_salsa20(x,z,k,sigma);
  37289. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37290. }
  37291. return 0;
  37292. }
  37293. function crypto_stream(c,cpos,d,n,k) {
  37294. var s = new Uint8Array(32);
  37295. crypto_core_hsalsa20(s,n,k,sigma);
  37296. var sn = new Uint8Array(8);
  37297. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37298. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37299. }
  37300. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37301. var s = new Uint8Array(32);
  37302. crypto_core_hsalsa20(s,n,k,sigma);
  37303. var sn = new Uint8Array(8);
  37304. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37305. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37306. }
  37307. /*
  37308. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37309. * https://github.com/floodyberry/poly1305-donna
  37310. */
  37311. var poly1305 = function(key) {
  37312. this.buffer = new Uint8Array(16);
  37313. this.r = new Uint16Array(10);
  37314. this.h = new Uint16Array(10);
  37315. this.pad = new Uint16Array(8);
  37316. this.leftover = 0;
  37317. this.fin = 0;
  37318. var t0, t1, t2, t3, t4, t5, t6, t7;
  37319. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37320. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37321. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37322. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37323. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37324. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37325. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37326. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37327. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37328. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37329. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37330. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37331. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37332. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37333. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37334. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37335. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37336. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37337. };
  37338. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37339. var hibit = this.fin ? 0 : (1 << 11);
  37340. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37341. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37342. var h0 = this.h[0],
  37343. h1 = this.h[1],
  37344. h2 = this.h[2],
  37345. h3 = this.h[3],
  37346. h4 = this.h[4],
  37347. h5 = this.h[5],
  37348. h6 = this.h[6],
  37349. h7 = this.h[7],
  37350. h8 = this.h[8],
  37351. h9 = this.h[9];
  37352. var r0 = this.r[0],
  37353. r1 = this.r[1],
  37354. r2 = this.r[2],
  37355. r3 = this.r[3],
  37356. r4 = this.r[4],
  37357. r5 = this.r[5],
  37358. r6 = this.r[6],
  37359. r7 = this.r[7],
  37360. r8 = this.r[8],
  37361. r9 = this.r[9];
  37362. while (bytes >= 16) {
  37363. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37364. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37365. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37366. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37367. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37368. h5 += ((t4 >>> 1)) & 0x1fff;
  37369. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37370. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37371. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37372. h9 += ((t7 >>> 5)) | hibit;
  37373. c = 0;
  37374. d0 = c;
  37375. d0 += h0 * r0;
  37376. d0 += h1 * (5 * r9);
  37377. d0 += h2 * (5 * r8);
  37378. d0 += h3 * (5 * r7);
  37379. d0 += h4 * (5 * r6);
  37380. c = (d0 >>> 13); d0 &= 0x1fff;
  37381. d0 += h5 * (5 * r5);
  37382. d0 += h6 * (5 * r4);
  37383. d0 += h7 * (5 * r3);
  37384. d0 += h8 * (5 * r2);
  37385. d0 += h9 * (5 * r1);
  37386. c += (d0 >>> 13); d0 &= 0x1fff;
  37387. d1 = c;
  37388. d1 += h0 * r1;
  37389. d1 += h1 * r0;
  37390. d1 += h2 * (5 * r9);
  37391. d1 += h3 * (5 * r8);
  37392. d1 += h4 * (5 * r7);
  37393. c = (d1 >>> 13); d1 &= 0x1fff;
  37394. d1 += h5 * (5 * r6);
  37395. d1 += h6 * (5 * r5);
  37396. d1 += h7 * (5 * r4);
  37397. d1 += h8 * (5 * r3);
  37398. d1 += h9 * (5 * r2);
  37399. c += (d1 >>> 13); d1 &= 0x1fff;
  37400. d2 = c;
  37401. d2 += h0 * r2;
  37402. d2 += h1 * r1;
  37403. d2 += h2 * r0;
  37404. d2 += h3 * (5 * r9);
  37405. d2 += h4 * (5 * r8);
  37406. c = (d2 >>> 13); d2 &= 0x1fff;
  37407. d2 += h5 * (5 * r7);
  37408. d2 += h6 * (5 * r6);
  37409. d2 += h7 * (5 * r5);
  37410. d2 += h8 * (5 * r4);
  37411. d2 += h9 * (5 * r3);
  37412. c += (d2 >>> 13); d2 &= 0x1fff;
  37413. d3 = c;
  37414. d3 += h0 * r3;
  37415. d3 += h1 * r2;
  37416. d3 += h2 * r1;
  37417. d3 += h3 * r0;
  37418. d3 += h4 * (5 * r9);
  37419. c = (d3 >>> 13); d3 &= 0x1fff;
  37420. d3 += h5 * (5 * r8);
  37421. d3 += h6 * (5 * r7);
  37422. d3 += h7 * (5 * r6);
  37423. d3 += h8 * (5 * r5);
  37424. d3 += h9 * (5 * r4);
  37425. c += (d3 >>> 13); d3 &= 0x1fff;
  37426. d4 = c;
  37427. d4 += h0 * r4;
  37428. d4 += h1 * r3;
  37429. d4 += h2 * r2;
  37430. d4 += h3 * r1;
  37431. d4 += h4 * r0;
  37432. c = (d4 >>> 13); d4 &= 0x1fff;
  37433. d4 += h5 * (5 * r9);
  37434. d4 += h6 * (5 * r8);
  37435. d4 += h7 * (5 * r7);
  37436. d4 += h8 * (5 * r6);
  37437. d4 += h9 * (5 * r5);
  37438. c += (d4 >>> 13); d4 &= 0x1fff;
  37439. d5 = c;
  37440. d5 += h0 * r5;
  37441. d5 += h1 * r4;
  37442. d5 += h2 * r3;
  37443. d5 += h3 * r2;
  37444. d5 += h4 * r1;
  37445. c = (d5 >>> 13); d5 &= 0x1fff;
  37446. d5 += h5 * r0;
  37447. d5 += h6 * (5 * r9);
  37448. d5 += h7 * (5 * r8);
  37449. d5 += h8 * (5 * r7);
  37450. d5 += h9 * (5 * r6);
  37451. c += (d5 >>> 13); d5 &= 0x1fff;
  37452. d6 = c;
  37453. d6 += h0 * r6;
  37454. d6 += h1 * r5;
  37455. d6 += h2 * r4;
  37456. d6 += h3 * r3;
  37457. d6 += h4 * r2;
  37458. c = (d6 >>> 13); d6 &= 0x1fff;
  37459. d6 += h5 * r1;
  37460. d6 += h6 * r0;
  37461. d6 += h7 * (5 * r9);
  37462. d6 += h8 * (5 * r8);
  37463. d6 += h9 * (5 * r7);
  37464. c += (d6 >>> 13); d6 &= 0x1fff;
  37465. d7 = c;
  37466. d7 += h0 * r7;
  37467. d7 += h1 * r6;
  37468. d7 += h2 * r5;
  37469. d7 += h3 * r4;
  37470. d7 += h4 * r3;
  37471. c = (d7 >>> 13); d7 &= 0x1fff;
  37472. d7 += h5 * r2;
  37473. d7 += h6 * r1;
  37474. d7 += h7 * r0;
  37475. d7 += h8 * (5 * r9);
  37476. d7 += h9 * (5 * r8);
  37477. c += (d7 >>> 13); d7 &= 0x1fff;
  37478. d8 = c;
  37479. d8 += h0 * r8;
  37480. d8 += h1 * r7;
  37481. d8 += h2 * r6;
  37482. d8 += h3 * r5;
  37483. d8 += h4 * r4;
  37484. c = (d8 >>> 13); d8 &= 0x1fff;
  37485. d8 += h5 * r3;
  37486. d8 += h6 * r2;
  37487. d8 += h7 * r1;
  37488. d8 += h8 * r0;
  37489. d8 += h9 * (5 * r9);
  37490. c += (d8 >>> 13); d8 &= 0x1fff;
  37491. d9 = c;
  37492. d9 += h0 * r9;
  37493. d9 += h1 * r8;
  37494. d9 += h2 * r7;
  37495. d9 += h3 * r6;
  37496. d9 += h4 * r5;
  37497. c = (d9 >>> 13); d9 &= 0x1fff;
  37498. d9 += h5 * r4;
  37499. d9 += h6 * r3;
  37500. d9 += h7 * r2;
  37501. d9 += h8 * r1;
  37502. d9 += h9 * r0;
  37503. c += (d9 >>> 13); d9 &= 0x1fff;
  37504. c = (((c << 2) + c)) | 0;
  37505. c = (c + d0) | 0;
  37506. d0 = c & 0x1fff;
  37507. c = (c >>> 13);
  37508. d1 += c;
  37509. h0 = d0;
  37510. h1 = d1;
  37511. h2 = d2;
  37512. h3 = d3;
  37513. h4 = d4;
  37514. h5 = d5;
  37515. h6 = d6;
  37516. h7 = d7;
  37517. h8 = d8;
  37518. h9 = d9;
  37519. mpos += 16;
  37520. bytes -= 16;
  37521. }
  37522. this.h[0] = h0;
  37523. this.h[1] = h1;
  37524. this.h[2] = h2;
  37525. this.h[3] = h3;
  37526. this.h[4] = h4;
  37527. this.h[5] = h5;
  37528. this.h[6] = h6;
  37529. this.h[7] = h7;
  37530. this.h[8] = h8;
  37531. this.h[9] = h9;
  37532. };
  37533. poly1305.prototype.finish = function(mac, macpos) {
  37534. var g = new Uint16Array(10);
  37535. var c, mask, f, i;
  37536. if (this.leftover) {
  37537. i = this.leftover;
  37538. this.buffer[i++] = 1;
  37539. for (; i < 16; i++) this.buffer[i] = 0;
  37540. this.fin = 1;
  37541. this.blocks(this.buffer, 0, 16);
  37542. }
  37543. c = this.h[1] >>> 13;
  37544. this.h[1] &= 0x1fff;
  37545. for (i = 2; i < 10; i++) {
  37546. this.h[i] += c;
  37547. c = this.h[i] >>> 13;
  37548. this.h[i] &= 0x1fff;
  37549. }
  37550. this.h[0] += (c * 5);
  37551. c = this.h[0] >>> 13;
  37552. this.h[0] &= 0x1fff;
  37553. this.h[1] += c;
  37554. c = this.h[1] >>> 13;
  37555. this.h[1] &= 0x1fff;
  37556. this.h[2] += c;
  37557. g[0] = this.h[0] + 5;
  37558. c = g[0] >>> 13;
  37559. g[0] &= 0x1fff;
  37560. for (i = 1; i < 10; i++) {
  37561. g[i] = this.h[i] + c;
  37562. c = g[i] >>> 13;
  37563. g[i] &= 0x1fff;
  37564. }
  37565. g[9] -= (1 << 13);
  37566. mask = (c ^ 1) - 1;
  37567. for (i = 0; i < 10; i++) g[i] &= mask;
  37568. mask = ~mask;
  37569. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37570. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37571. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37572. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37573. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37574. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37575. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37576. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37577. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37578. f = this.h[0] + this.pad[0];
  37579. this.h[0] = f & 0xffff;
  37580. for (i = 1; i < 8; i++) {
  37581. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37582. this.h[i] = f & 0xffff;
  37583. }
  37584. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37585. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37586. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37587. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37588. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37589. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37590. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37591. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37592. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37593. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37594. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37595. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37596. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37597. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37598. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37599. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37600. };
  37601. poly1305.prototype.update = function(m, mpos, bytes) {
  37602. var i, want;
  37603. if (this.leftover) {
  37604. want = (16 - this.leftover);
  37605. if (want > bytes)
  37606. want = bytes;
  37607. for (i = 0; i < want; i++)
  37608. this.buffer[this.leftover + i] = m[mpos+i];
  37609. bytes -= want;
  37610. mpos += want;
  37611. this.leftover += want;
  37612. if (this.leftover < 16)
  37613. return;
  37614. this.blocks(this.buffer, 0, 16);
  37615. this.leftover = 0;
  37616. }
  37617. if (bytes >= 16) {
  37618. want = bytes - (bytes % 16);
  37619. this.blocks(m, mpos, want);
  37620. mpos += want;
  37621. bytes -= want;
  37622. }
  37623. if (bytes) {
  37624. for (i = 0; i < bytes; i++)
  37625. this.buffer[this.leftover + i] = m[mpos+i];
  37626. this.leftover += bytes;
  37627. }
  37628. };
  37629. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37630. var s = new poly1305(k);
  37631. s.update(m, mpos, n);
  37632. s.finish(out, outpos);
  37633. return 0;
  37634. }
  37635. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37636. var x = new Uint8Array(16);
  37637. crypto_onetimeauth(x,0,m,mpos,n,k);
  37638. return crypto_verify_16(h,hpos,x,0);
  37639. }
  37640. function crypto_secretbox(c,m,d,n,k) {
  37641. var i;
  37642. if (d < 32) return -1;
  37643. crypto_stream_xor(c,0,m,0,d,n,k);
  37644. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37645. for (i = 0; i < 16; i++) c[i] = 0;
  37646. return 0;
  37647. }
  37648. function crypto_secretbox_open(m,c,d,n,k) {
  37649. var i;
  37650. var x = new Uint8Array(32);
  37651. if (d < 32) return -1;
  37652. crypto_stream(x,0,32,n,k);
  37653. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37654. crypto_stream_xor(m,0,c,0,d,n,k);
  37655. for (i = 0; i < 32; i++) m[i] = 0;
  37656. return 0;
  37657. }
  37658. function set25519(r, a) {
  37659. var i;
  37660. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37661. }
  37662. function car25519(o) {
  37663. var i, v, c = 1;
  37664. for (i = 0; i < 16; i++) {
  37665. v = o[i] + c + 65535;
  37666. c = Math.floor(v / 65536);
  37667. o[i] = v - c * 65536;
  37668. }
  37669. o[0] += c-1 + 37 * (c-1);
  37670. }
  37671. function sel25519(p, q, b) {
  37672. var t, c = ~(b-1);
  37673. for (var i = 0; i < 16; i++) {
  37674. t = c & (p[i] ^ q[i]);
  37675. p[i] ^= t;
  37676. q[i] ^= t;
  37677. }
  37678. }
  37679. function pack25519(o, n) {
  37680. var i, j, b;
  37681. var m = gf(), t = gf();
  37682. for (i = 0; i < 16; i++) t[i] = n[i];
  37683. car25519(t);
  37684. car25519(t);
  37685. car25519(t);
  37686. for (j = 0; j < 2; j++) {
  37687. m[0] = t[0] - 0xffed;
  37688. for (i = 1; i < 15; i++) {
  37689. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37690. m[i-1] &= 0xffff;
  37691. }
  37692. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37693. b = (m[15]>>16) & 1;
  37694. m[14] &= 0xffff;
  37695. sel25519(t, m, 1-b);
  37696. }
  37697. for (i = 0; i < 16; i++) {
  37698. o[2*i] = t[i] & 0xff;
  37699. o[2*i+1] = t[i]>>8;
  37700. }
  37701. }
  37702. function neq25519(a, b) {
  37703. var c = new Uint8Array(32), d = new Uint8Array(32);
  37704. pack25519(c, a);
  37705. pack25519(d, b);
  37706. return crypto_verify_32(c, 0, d, 0);
  37707. }
  37708. function par25519(a) {
  37709. var d = new Uint8Array(32);
  37710. pack25519(d, a);
  37711. return d[0] & 1;
  37712. }
  37713. function unpack25519(o, n) {
  37714. var i;
  37715. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37716. o[15] &= 0x7fff;
  37717. }
  37718. function A(o, a, b) {
  37719. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37720. }
  37721. function Z(o, a, b) {
  37722. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37723. }
  37724. function M(o, a, b) {
  37725. var v, c,
  37726. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37727. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37728. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37729. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37730. b0 = b[0],
  37731. b1 = b[1],
  37732. b2 = b[2],
  37733. b3 = b[3],
  37734. b4 = b[4],
  37735. b5 = b[5],
  37736. b6 = b[6],
  37737. b7 = b[7],
  37738. b8 = b[8],
  37739. b9 = b[9],
  37740. b10 = b[10],
  37741. b11 = b[11],
  37742. b12 = b[12],
  37743. b13 = b[13],
  37744. b14 = b[14],
  37745. b15 = b[15];
  37746. v = a[0];
  37747. t0 += v * b0;
  37748. t1 += v * b1;
  37749. t2 += v * b2;
  37750. t3 += v * b3;
  37751. t4 += v * b4;
  37752. t5 += v * b5;
  37753. t6 += v * b6;
  37754. t7 += v * b7;
  37755. t8 += v * b8;
  37756. t9 += v * b9;
  37757. t10 += v * b10;
  37758. t11 += v * b11;
  37759. t12 += v * b12;
  37760. t13 += v * b13;
  37761. t14 += v * b14;
  37762. t15 += v * b15;
  37763. v = a[1];
  37764. t1 += v * b0;
  37765. t2 += v * b1;
  37766. t3 += v * b2;
  37767. t4 += v * b3;
  37768. t5 += v * b4;
  37769. t6 += v * b5;
  37770. t7 += v * b6;
  37771. t8 += v * b7;
  37772. t9 += v * b8;
  37773. t10 += v * b9;
  37774. t11 += v * b10;
  37775. t12 += v * b11;
  37776. t13 += v * b12;
  37777. t14 += v * b13;
  37778. t15 += v * b14;
  37779. t16 += v * b15;
  37780. v = a[2];
  37781. t2 += v * b0;
  37782. t3 += v * b1;
  37783. t4 += v * b2;
  37784. t5 += v * b3;
  37785. t6 += v * b4;
  37786. t7 += v * b5;
  37787. t8 += v * b6;
  37788. t9 += v * b7;
  37789. t10 += v * b8;
  37790. t11 += v * b9;
  37791. t12 += v * b10;
  37792. t13 += v * b11;
  37793. t14 += v * b12;
  37794. t15 += v * b13;
  37795. t16 += v * b14;
  37796. t17 += v * b15;
  37797. v = a[3];
  37798. t3 += v * b0;
  37799. t4 += v * b1;
  37800. t5 += v * b2;
  37801. t6 += v * b3;
  37802. t7 += v * b4;
  37803. t8 += v * b5;
  37804. t9 += v * b6;
  37805. t10 += v * b7;
  37806. t11 += v * b8;
  37807. t12 += v * b9;
  37808. t13 += v * b10;
  37809. t14 += v * b11;
  37810. t15 += v * b12;
  37811. t16 += v * b13;
  37812. t17 += v * b14;
  37813. t18 += v * b15;
  37814. v = a[4];
  37815. t4 += v * b0;
  37816. t5 += v * b1;
  37817. t6 += v * b2;
  37818. t7 += v * b3;
  37819. t8 += v * b4;
  37820. t9 += v * b5;
  37821. t10 += v * b6;
  37822. t11 += v * b7;
  37823. t12 += v * b8;
  37824. t13 += v * b9;
  37825. t14 += v * b10;
  37826. t15 += v * b11;
  37827. t16 += v * b12;
  37828. t17 += v * b13;
  37829. t18 += v * b14;
  37830. t19 += v * b15;
  37831. v = a[5];
  37832. t5 += v * b0;
  37833. t6 += v * b1;
  37834. t7 += v * b2;
  37835. t8 += v * b3;
  37836. t9 += v * b4;
  37837. t10 += v * b5;
  37838. t11 += v * b6;
  37839. t12 += v * b7;
  37840. t13 += v * b8;
  37841. t14 += v * b9;
  37842. t15 += v * b10;
  37843. t16 += v * b11;
  37844. t17 += v * b12;
  37845. t18 += v * b13;
  37846. t19 += v * b14;
  37847. t20 += v * b15;
  37848. v = a[6];
  37849. t6 += v * b0;
  37850. t7 += v * b1;
  37851. t8 += v * b2;
  37852. t9 += v * b3;
  37853. t10 += v * b4;
  37854. t11 += v * b5;
  37855. t12 += v * b6;
  37856. t13 += v * b7;
  37857. t14 += v * b8;
  37858. t15 += v * b9;
  37859. t16 += v * b10;
  37860. t17 += v * b11;
  37861. t18 += v * b12;
  37862. t19 += v * b13;
  37863. t20 += v * b14;
  37864. t21 += v * b15;
  37865. v = a[7];
  37866. t7 += v * b0;
  37867. t8 += v * b1;
  37868. t9 += v * b2;
  37869. t10 += v * b3;
  37870. t11 += v * b4;
  37871. t12 += v * b5;
  37872. t13 += v * b6;
  37873. t14 += v * b7;
  37874. t15 += v * b8;
  37875. t16 += v * b9;
  37876. t17 += v * b10;
  37877. t18 += v * b11;
  37878. t19 += v * b12;
  37879. t20 += v * b13;
  37880. t21 += v * b14;
  37881. t22 += v * b15;
  37882. v = a[8];
  37883. t8 += v * b0;
  37884. t9 += v * b1;
  37885. t10 += v * b2;
  37886. t11 += v * b3;
  37887. t12 += v * b4;
  37888. t13 += v * b5;
  37889. t14 += v * b6;
  37890. t15 += v * b7;
  37891. t16 += v * b8;
  37892. t17 += v * b9;
  37893. t18 += v * b10;
  37894. t19 += v * b11;
  37895. t20 += v * b12;
  37896. t21 += v * b13;
  37897. t22 += v * b14;
  37898. t23 += v * b15;
  37899. v = a[9];
  37900. t9 += v * b0;
  37901. t10 += v * b1;
  37902. t11 += v * b2;
  37903. t12 += v * b3;
  37904. t13 += v * b4;
  37905. t14 += v * b5;
  37906. t15 += v * b6;
  37907. t16 += v * b7;
  37908. t17 += v * b8;
  37909. t18 += v * b9;
  37910. t19 += v * b10;
  37911. t20 += v * b11;
  37912. t21 += v * b12;
  37913. t22 += v * b13;
  37914. t23 += v * b14;
  37915. t24 += v * b15;
  37916. v = a[10];
  37917. t10 += v * b0;
  37918. t11 += v * b1;
  37919. t12 += v * b2;
  37920. t13 += v * b3;
  37921. t14 += v * b4;
  37922. t15 += v * b5;
  37923. t16 += v * b6;
  37924. t17 += v * b7;
  37925. t18 += v * b8;
  37926. t19 += v * b9;
  37927. t20 += v * b10;
  37928. t21 += v * b11;
  37929. t22 += v * b12;
  37930. t23 += v * b13;
  37931. t24 += v * b14;
  37932. t25 += v * b15;
  37933. v = a[11];
  37934. t11 += v * b0;
  37935. t12 += v * b1;
  37936. t13 += v * b2;
  37937. t14 += v * b3;
  37938. t15 += v * b4;
  37939. t16 += v * b5;
  37940. t17 += v * b6;
  37941. t18 += v * b7;
  37942. t19 += v * b8;
  37943. t20 += v * b9;
  37944. t21 += v * b10;
  37945. t22 += v * b11;
  37946. t23 += v * b12;
  37947. t24 += v * b13;
  37948. t25 += v * b14;
  37949. t26 += v * b15;
  37950. v = a[12];
  37951. t12 += v * b0;
  37952. t13 += v * b1;
  37953. t14 += v * b2;
  37954. t15 += v * b3;
  37955. t16 += v * b4;
  37956. t17 += v * b5;
  37957. t18 += v * b6;
  37958. t19 += v * b7;
  37959. t20 += v * b8;
  37960. t21 += v * b9;
  37961. t22 += v * b10;
  37962. t23 += v * b11;
  37963. t24 += v * b12;
  37964. t25 += v * b13;
  37965. t26 += v * b14;
  37966. t27 += v * b15;
  37967. v = a[13];
  37968. t13 += v * b0;
  37969. t14 += v * b1;
  37970. t15 += v * b2;
  37971. t16 += v * b3;
  37972. t17 += v * b4;
  37973. t18 += v * b5;
  37974. t19 += v * b6;
  37975. t20 += v * b7;
  37976. t21 += v * b8;
  37977. t22 += v * b9;
  37978. t23 += v * b10;
  37979. t24 += v * b11;
  37980. t25 += v * b12;
  37981. t26 += v * b13;
  37982. t27 += v * b14;
  37983. t28 += v * b15;
  37984. v = a[14];
  37985. t14 += v * b0;
  37986. t15 += v * b1;
  37987. t16 += v * b2;
  37988. t17 += v * b3;
  37989. t18 += v * b4;
  37990. t19 += v * b5;
  37991. t20 += v * b6;
  37992. t21 += v * b7;
  37993. t22 += v * b8;
  37994. t23 += v * b9;
  37995. t24 += v * b10;
  37996. t25 += v * b11;
  37997. t26 += v * b12;
  37998. t27 += v * b13;
  37999. t28 += v * b14;
  38000. t29 += v * b15;
  38001. v = a[15];
  38002. t15 += v * b0;
  38003. t16 += v * b1;
  38004. t17 += v * b2;
  38005. t18 += v * b3;
  38006. t19 += v * b4;
  38007. t20 += v * b5;
  38008. t21 += v * b6;
  38009. t22 += v * b7;
  38010. t23 += v * b8;
  38011. t24 += v * b9;
  38012. t25 += v * b10;
  38013. t26 += v * b11;
  38014. t27 += v * b12;
  38015. t28 += v * b13;
  38016. t29 += v * b14;
  38017. t30 += v * b15;
  38018. t0 += 38 * t16;
  38019. t1 += 38 * t17;
  38020. t2 += 38 * t18;
  38021. t3 += 38 * t19;
  38022. t4 += 38 * t20;
  38023. t5 += 38 * t21;
  38024. t6 += 38 * t22;
  38025. t7 += 38 * t23;
  38026. t8 += 38 * t24;
  38027. t9 += 38 * t25;
  38028. t10 += 38 * t26;
  38029. t11 += 38 * t27;
  38030. t12 += 38 * t28;
  38031. t13 += 38 * t29;
  38032. t14 += 38 * t30;
  38033. // t15 left as is
  38034. // first car
  38035. c = 1;
  38036. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38037. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38038. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38039. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38040. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38041. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38042. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38043. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38044. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38045. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38046. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38047. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38048. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38049. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38050. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38051. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38052. t0 += c-1 + 37 * (c-1);
  38053. // second car
  38054. c = 1;
  38055. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38056. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38057. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38058. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38059. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38060. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38061. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38062. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38063. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38064. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38065. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38066. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38067. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38068. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38069. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38070. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38071. t0 += c-1 + 37 * (c-1);
  38072. o[ 0] = t0;
  38073. o[ 1] = t1;
  38074. o[ 2] = t2;
  38075. o[ 3] = t3;
  38076. o[ 4] = t4;
  38077. o[ 5] = t5;
  38078. o[ 6] = t6;
  38079. o[ 7] = t7;
  38080. o[ 8] = t8;
  38081. o[ 9] = t9;
  38082. o[10] = t10;
  38083. o[11] = t11;
  38084. o[12] = t12;
  38085. o[13] = t13;
  38086. o[14] = t14;
  38087. o[15] = t15;
  38088. }
  38089. function S(o, a) {
  38090. M(o, a, a);
  38091. }
  38092. function inv25519(o, i) {
  38093. var c = gf();
  38094. var a;
  38095. for (a = 0; a < 16; a++) c[a] = i[a];
  38096. for (a = 253; a >= 0; a--) {
  38097. S(c, c);
  38098. if(a !== 2 && a !== 4) M(c, c, i);
  38099. }
  38100. for (a = 0; a < 16; a++) o[a] = c[a];
  38101. }
  38102. function pow2523(o, i) {
  38103. var c = gf();
  38104. var a;
  38105. for (a = 0; a < 16; a++) c[a] = i[a];
  38106. for (a = 250; a >= 0; a--) {
  38107. S(c, c);
  38108. if(a !== 1) M(c, c, i);
  38109. }
  38110. for (a = 0; a < 16; a++) o[a] = c[a];
  38111. }
  38112. function crypto_scalarmult(q, n, p) {
  38113. var z = new Uint8Array(32);
  38114. var x = new Float64Array(80), r, i;
  38115. var a = gf(), b = gf(), c = gf(),
  38116. d = gf(), e = gf(), f = gf();
  38117. for (i = 0; i < 31; i++) z[i] = n[i];
  38118. z[31]=(n[31]&127)|64;
  38119. z[0]&=248;
  38120. unpack25519(x,p);
  38121. for (i = 0; i < 16; i++) {
  38122. b[i]=x[i];
  38123. d[i]=a[i]=c[i]=0;
  38124. }
  38125. a[0]=d[0]=1;
  38126. for (i=254; i>=0; --i) {
  38127. r=(z[i>>>3]>>>(i&7))&1;
  38128. sel25519(a,b,r);
  38129. sel25519(c,d,r);
  38130. A(e,a,c);
  38131. Z(a,a,c);
  38132. A(c,b,d);
  38133. Z(b,b,d);
  38134. S(d,e);
  38135. S(f,a);
  38136. M(a,c,a);
  38137. M(c,b,e);
  38138. A(e,a,c);
  38139. Z(a,a,c);
  38140. S(b,a);
  38141. Z(c,d,f);
  38142. M(a,c,_121665);
  38143. A(a,a,d);
  38144. M(c,c,a);
  38145. M(a,d,f);
  38146. M(d,b,x);
  38147. S(b,e);
  38148. sel25519(a,b,r);
  38149. sel25519(c,d,r);
  38150. }
  38151. for (i = 0; i < 16; i++) {
  38152. x[i+16]=a[i];
  38153. x[i+32]=c[i];
  38154. x[i+48]=b[i];
  38155. x[i+64]=d[i];
  38156. }
  38157. var x32 = x.subarray(32);
  38158. var x16 = x.subarray(16);
  38159. inv25519(x32,x32);
  38160. M(x16,x16,x32);
  38161. pack25519(q,x16);
  38162. return 0;
  38163. }
  38164. function crypto_scalarmult_base(q, n) {
  38165. return crypto_scalarmult(q, n, _9);
  38166. }
  38167. function crypto_box_keypair(y, x) {
  38168. randombytes(x, 32);
  38169. return crypto_scalarmult_base(y, x);
  38170. }
  38171. function crypto_box_beforenm(k, y, x) {
  38172. var s = new Uint8Array(32);
  38173. crypto_scalarmult(s, x, y);
  38174. return crypto_core_hsalsa20(k, _0, s, sigma);
  38175. }
  38176. var crypto_box_afternm = crypto_secretbox;
  38177. var crypto_box_open_afternm = crypto_secretbox_open;
  38178. function crypto_box(c, m, d, n, y, x) {
  38179. var k = new Uint8Array(32);
  38180. crypto_box_beforenm(k, y, x);
  38181. return crypto_box_afternm(c, m, d, n, k);
  38182. }
  38183. function crypto_box_open(m, c, d, n, y, x) {
  38184. var k = new Uint8Array(32);
  38185. crypto_box_beforenm(k, y, x);
  38186. return crypto_box_open_afternm(m, c, d, n, k);
  38187. }
  38188. var K = [
  38189. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38190. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38191. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38192. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38193. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38194. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38195. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38196. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38197. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38198. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38199. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38200. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38201. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38202. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38203. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38204. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38205. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38206. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38207. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38208. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38209. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38210. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38211. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38212. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38213. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38214. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38215. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38216. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38217. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38218. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38219. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38220. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38221. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38222. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38223. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38224. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38225. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38226. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38227. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38228. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38229. ];
  38230. function crypto_hashblocks_hl(hh, hl, m, n) {
  38231. var wh = new Int32Array(16), wl = new Int32Array(16),
  38232. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38233. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38234. th, tl, i, j, h, l, a, b, c, d;
  38235. var ah0 = hh[0],
  38236. ah1 = hh[1],
  38237. ah2 = hh[2],
  38238. ah3 = hh[3],
  38239. ah4 = hh[4],
  38240. ah5 = hh[5],
  38241. ah6 = hh[6],
  38242. ah7 = hh[7],
  38243. al0 = hl[0],
  38244. al1 = hl[1],
  38245. al2 = hl[2],
  38246. al3 = hl[3],
  38247. al4 = hl[4],
  38248. al5 = hl[5],
  38249. al6 = hl[6],
  38250. al7 = hl[7];
  38251. var pos = 0;
  38252. while (n >= 128) {
  38253. for (i = 0; i < 16; i++) {
  38254. j = 8 * i + pos;
  38255. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38256. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38257. }
  38258. for (i = 0; i < 80; i++) {
  38259. bh0 = ah0;
  38260. bh1 = ah1;
  38261. bh2 = ah2;
  38262. bh3 = ah3;
  38263. bh4 = ah4;
  38264. bh5 = ah5;
  38265. bh6 = ah6;
  38266. bh7 = ah7;
  38267. bl0 = al0;
  38268. bl1 = al1;
  38269. bl2 = al2;
  38270. bl3 = al3;
  38271. bl4 = al4;
  38272. bl5 = al5;
  38273. bl6 = al6;
  38274. bl7 = al7;
  38275. // add
  38276. h = ah7;
  38277. l = al7;
  38278. a = l & 0xffff; b = l >>> 16;
  38279. c = h & 0xffff; d = h >>> 16;
  38280. // Sigma1
  38281. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38282. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38283. a += l & 0xffff; b += l >>> 16;
  38284. c += h & 0xffff; d += h >>> 16;
  38285. // Ch
  38286. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38287. l = (al4 & al5) ^ (~al4 & al6);
  38288. a += l & 0xffff; b += l >>> 16;
  38289. c += h & 0xffff; d += h >>> 16;
  38290. // K
  38291. h = K[i*2];
  38292. l = K[i*2+1];
  38293. a += l & 0xffff; b += l >>> 16;
  38294. c += h & 0xffff; d += h >>> 16;
  38295. // w
  38296. h = wh[i%16];
  38297. l = wl[i%16];
  38298. a += l & 0xffff; b += l >>> 16;
  38299. c += h & 0xffff; d += h >>> 16;
  38300. b += a >>> 16;
  38301. c += b >>> 16;
  38302. d += c >>> 16;
  38303. th = c & 0xffff | d << 16;
  38304. tl = a & 0xffff | b << 16;
  38305. // add
  38306. h = th;
  38307. l = tl;
  38308. a = l & 0xffff; b = l >>> 16;
  38309. c = h & 0xffff; d = h >>> 16;
  38310. // Sigma0
  38311. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38312. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38313. a += l & 0xffff; b += l >>> 16;
  38314. c += h & 0xffff; d += h >>> 16;
  38315. // Maj
  38316. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38317. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38318. a += l & 0xffff; b += l >>> 16;
  38319. c += h & 0xffff; d += h >>> 16;
  38320. b += a >>> 16;
  38321. c += b >>> 16;
  38322. d += c >>> 16;
  38323. bh7 = (c & 0xffff) | (d << 16);
  38324. bl7 = (a & 0xffff) | (b << 16);
  38325. // add
  38326. h = bh3;
  38327. l = bl3;
  38328. a = l & 0xffff; b = l >>> 16;
  38329. c = h & 0xffff; d = h >>> 16;
  38330. h = th;
  38331. l = tl;
  38332. a += l & 0xffff; b += l >>> 16;
  38333. c += h & 0xffff; d += h >>> 16;
  38334. b += a >>> 16;
  38335. c += b >>> 16;
  38336. d += c >>> 16;
  38337. bh3 = (c & 0xffff) | (d << 16);
  38338. bl3 = (a & 0xffff) | (b << 16);
  38339. ah1 = bh0;
  38340. ah2 = bh1;
  38341. ah3 = bh2;
  38342. ah4 = bh3;
  38343. ah5 = bh4;
  38344. ah6 = bh5;
  38345. ah7 = bh6;
  38346. ah0 = bh7;
  38347. al1 = bl0;
  38348. al2 = bl1;
  38349. al3 = bl2;
  38350. al4 = bl3;
  38351. al5 = bl4;
  38352. al6 = bl5;
  38353. al7 = bl6;
  38354. al0 = bl7;
  38355. if (i%16 === 15) {
  38356. for (j = 0; j < 16; j++) {
  38357. // add
  38358. h = wh[j];
  38359. l = wl[j];
  38360. a = l & 0xffff; b = l >>> 16;
  38361. c = h & 0xffff; d = h >>> 16;
  38362. h = wh[(j+9)%16];
  38363. l = wl[(j+9)%16];
  38364. a += l & 0xffff; b += l >>> 16;
  38365. c += h & 0xffff; d += h >>> 16;
  38366. // sigma0
  38367. th = wh[(j+1)%16];
  38368. tl = wl[(j+1)%16];
  38369. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38370. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38371. a += l & 0xffff; b += l >>> 16;
  38372. c += h & 0xffff; d += h >>> 16;
  38373. // sigma1
  38374. th = wh[(j+14)%16];
  38375. tl = wl[(j+14)%16];
  38376. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38377. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38378. a += l & 0xffff; b += l >>> 16;
  38379. c += h & 0xffff; d += h >>> 16;
  38380. b += a >>> 16;
  38381. c += b >>> 16;
  38382. d += c >>> 16;
  38383. wh[j] = (c & 0xffff) | (d << 16);
  38384. wl[j] = (a & 0xffff) | (b << 16);
  38385. }
  38386. }
  38387. }
  38388. // add
  38389. h = ah0;
  38390. l = al0;
  38391. a = l & 0xffff; b = l >>> 16;
  38392. c = h & 0xffff; d = h >>> 16;
  38393. h = hh[0];
  38394. l = hl[0];
  38395. a += l & 0xffff; b += l >>> 16;
  38396. c += h & 0xffff; d += h >>> 16;
  38397. b += a >>> 16;
  38398. c += b >>> 16;
  38399. d += c >>> 16;
  38400. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38401. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38402. h = ah1;
  38403. l = al1;
  38404. a = l & 0xffff; b = l >>> 16;
  38405. c = h & 0xffff; d = h >>> 16;
  38406. h = hh[1];
  38407. l = hl[1];
  38408. a += l & 0xffff; b += l >>> 16;
  38409. c += h & 0xffff; d += h >>> 16;
  38410. b += a >>> 16;
  38411. c += b >>> 16;
  38412. d += c >>> 16;
  38413. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38414. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38415. h = ah2;
  38416. l = al2;
  38417. a = l & 0xffff; b = l >>> 16;
  38418. c = h & 0xffff; d = h >>> 16;
  38419. h = hh[2];
  38420. l = hl[2];
  38421. a += l & 0xffff; b += l >>> 16;
  38422. c += h & 0xffff; d += h >>> 16;
  38423. b += a >>> 16;
  38424. c += b >>> 16;
  38425. d += c >>> 16;
  38426. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38427. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38428. h = ah3;
  38429. l = al3;
  38430. a = l & 0xffff; b = l >>> 16;
  38431. c = h & 0xffff; d = h >>> 16;
  38432. h = hh[3];
  38433. l = hl[3];
  38434. a += l & 0xffff; b += l >>> 16;
  38435. c += h & 0xffff; d += h >>> 16;
  38436. b += a >>> 16;
  38437. c += b >>> 16;
  38438. d += c >>> 16;
  38439. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38440. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38441. h = ah4;
  38442. l = al4;
  38443. a = l & 0xffff; b = l >>> 16;
  38444. c = h & 0xffff; d = h >>> 16;
  38445. h = hh[4];
  38446. l = hl[4];
  38447. a += l & 0xffff; b += l >>> 16;
  38448. c += h & 0xffff; d += h >>> 16;
  38449. b += a >>> 16;
  38450. c += b >>> 16;
  38451. d += c >>> 16;
  38452. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38453. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38454. h = ah5;
  38455. l = al5;
  38456. a = l & 0xffff; b = l >>> 16;
  38457. c = h & 0xffff; d = h >>> 16;
  38458. h = hh[5];
  38459. l = hl[5];
  38460. a += l & 0xffff; b += l >>> 16;
  38461. c += h & 0xffff; d += h >>> 16;
  38462. b += a >>> 16;
  38463. c += b >>> 16;
  38464. d += c >>> 16;
  38465. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38466. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38467. h = ah6;
  38468. l = al6;
  38469. a = l & 0xffff; b = l >>> 16;
  38470. c = h & 0xffff; d = h >>> 16;
  38471. h = hh[6];
  38472. l = hl[6];
  38473. a += l & 0xffff; b += l >>> 16;
  38474. c += h & 0xffff; d += h >>> 16;
  38475. b += a >>> 16;
  38476. c += b >>> 16;
  38477. d += c >>> 16;
  38478. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38479. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38480. h = ah7;
  38481. l = al7;
  38482. a = l & 0xffff; b = l >>> 16;
  38483. c = h & 0xffff; d = h >>> 16;
  38484. h = hh[7];
  38485. l = hl[7];
  38486. a += l & 0xffff; b += l >>> 16;
  38487. c += h & 0xffff; d += h >>> 16;
  38488. b += a >>> 16;
  38489. c += b >>> 16;
  38490. d += c >>> 16;
  38491. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38492. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38493. pos += 128;
  38494. n -= 128;
  38495. }
  38496. return n;
  38497. }
  38498. function crypto_hash(out, m, n) {
  38499. var hh = new Int32Array(8),
  38500. hl = new Int32Array(8),
  38501. x = new Uint8Array(256),
  38502. i, b = n;
  38503. hh[0] = 0x6a09e667;
  38504. hh[1] = 0xbb67ae85;
  38505. hh[2] = 0x3c6ef372;
  38506. hh[3] = 0xa54ff53a;
  38507. hh[4] = 0x510e527f;
  38508. hh[5] = 0x9b05688c;
  38509. hh[6] = 0x1f83d9ab;
  38510. hh[7] = 0x5be0cd19;
  38511. hl[0] = 0xf3bcc908;
  38512. hl[1] = 0x84caa73b;
  38513. hl[2] = 0xfe94f82b;
  38514. hl[3] = 0x5f1d36f1;
  38515. hl[4] = 0xade682d1;
  38516. hl[5] = 0x2b3e6c1f;
  38517. hl[6] = 0xfb41bd6b;
  38518. hl[7] = 0x137e2179;
  38519. crypto_hashblocks_hl(hh, hl, m, n);
  38520. n %= 128;
  38521. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38522. x[n] = 128;
  38523. n = 256-128*(n<112?1:0);
  38524. x[n-9] = 0;
  38525. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38526. crypto_hashblocks_hl(hh, hl, x, n);
  38527. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38528. return 0;
  38529. }
  38530. function add(p, q) {
  38531. var a = gf(), b = gf(), c = gf(),
  38532. d = gf(), e = gf(), f = gf(),
  38533. g = gf(), h = gf(), t = gf();
  38534. Z(a, p[1], p[0]);
  38535. Z(t, q[1], q[0]);
  38536. M(a, a, t);
  38537. A(b, p[0], p[1]);
  38538. A(t, q[0], q[1]);
  38539. M(b, b, t);
  38540. M(c, p[3], q[3]);
  38541. M(c, c, D2);
  38542. M(d, p[2], q[2]);
  38543. A(d, d, d);
  38544. Z(e, b, a);
  38545. Z(f, d, c);
  38546. A(g, d, c);
  38547. A(h, b, a);
  38548. M(p[0], e, f);
  38549. M(p[1], h, g);
  38550. M(p[2], g, f);
  38551. M(p[3], e, h);
  38552. }
  38553. function cswap(p, q, b) {
  38554. var i;
  38555. for (i = 0; i < 4; i++) {
  38556. sel25519(p[i], q[i], b);
  38557. }
  38558. }
  38559. function pack(r, p) {
  38560. var tx = gf(), ty = gf(), zi = gf();
  38561. inv25519(zi, p[2]);
  38562. M(tx, p[0], zi);
  38563. M(ty, p[1], zi);
  38564. pack25519(r, ty);
  38565. r[31] ^= par25519(tx) << 7;
  38566. }
  38567. function scalarmult(p, q, s) {
  38568. var b, i;
  38569. set25519(p[0], gf0);
  38570. set25519(p[1], gf1);
  38571. set25519(p[2], gf1);
  38572. set25519(p[3], gf0);
  38573. for (i = 255; i >= 0; --i) {
  38574. b = (s[(i/8)|0] >> (i&7)) & 1;
  38575. cswap(p, q, b);
  38576. add(q, p);
  38577. add(p, p);
  38578. cswap(p, q, b);
  38579. }
  38580. }
  38581. function scalarbase(p, s) {
  38582. var q = [gf(), gf(), gf(), gf()];
  38583. set25519(q[0], X);
  38584. set25519(q[1], Y);
  38585. set25519(q[2], gf1);
  38586. M(q[3], X, Y);
  38587. scalarmult(p, q, s);
  38588. }
  38589. function crypto_sign_keypair(pk, sk, seeded) {
  38590. var d = new Uint8Array(64);
  38591. var p = [gf(), gf(), gf(), gf()];
  38592. var i;
  38593. if (!seeded) randombytes(sk, 32);
  38594. crypto_hash(d, sk, 32);
  38595. d[0] &= 248;
  38596. d[31] &= 127;
  38597. d[31] |= 64;
  38598. scalarbase(p, d);
  38599. pack(pk, p);
  38600. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38601. return 0;
  38602. }
  38603. 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]);
  38604. function modL(r, x) {
  38605. var carry, i, j, k;
  38606. for (i = 63; i >= 32; --i) {
  38607. carry = 0;
  38608. for (j = i - 32, k = i - 12; j < k; ++j) {
  38609. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38610. carry = (x[j] + 128) >> 8;
  38611. x[j] -= carry * 256;
  38612. }
  38613. x[j] += carry;
  38614. x[i] = 0;
  38615. }
  38616. carry = 0;
  38617. for (j = 0; j < 32; j++) {
  38618. x[j] += carry - (x[31] >> 4) * L[j];
  38619. carry = x[j] >> 8;
  38620. x[j] &= 255;
  38621. }
  38622. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38623. for (i = 0; i < 32; i++) {
  38624. x[i+1] += x[i] >> 8;
  38625. r[i] = x[i] & 255;
  38626. }
  38627. }
  38628. function reduce(r) {
  38629. var x = new Float64Array(64), i;
  38630. for (i = 0; i < 64; i++) x[i] = r[i];
  38631. for (i = 0; i < 64; i++) r[i] = 0;
  38632. modL(r, x);
  38633. }
  38634. // Note: difference from C - smlen returned, not passed as argument.
  38635. function crypto_sign(sm, m, n, sk) {
  38636. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38637. var i, j, x = new Float64Array(64);
  38638. var p = [gf(), gf(), gf(), gf()];
  38639. crypto_hash(d, sk, 32);
  38640. d[0] &= 248;
  38641. d[31] &= 127;
  38642. d[31] |= 64;
  38643. var smlen = n + 64;
  38644. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38645. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38646. crypto_hash(r, sm.subarray(32), n+32);
  38647. reduce(r);
  38648. scalarbase(p, r);
  38649. pack(sm, p);
  38650. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38651. crypto_hash(h, sm, n + 64);
  38652. reduce(h);
  38653. for (i = 0; i < 64; i++) x[i] = 0;
  38654. for (i = 0; i < 32; i++) x[i] = r[i];
  38655. for (i = 0; i < 32; i++) {
  38656. for (j = 0; j < 32; j++) {
  38657. x[i+j] += h[i] * d[j];
  38658. }
  38659. }
  38660. modL(sm.subarray(32), x);
  38661. return smlen;
  38662. }
  38663. function unpackneg(r, p) {
  38664. var t = gf(), chk = gf(), num = gf(),
  38665. den = gf(), den2 = gf(), den4 = gf(),
  38666. den6 = gf();
  38667. set25519(r[2], gf1);
  38668. unpack25519(r[1], p);
  38669. S(num, r[1]);
  38670. M(den, num, D);
  38671. Z(num, num, r[2]);
  38672. A(den, r[2], den);
  38673. S(den2, den);
  38674. S(den4, den2);
  38675. M(den6, den4, den2);
  38676. M(t, den6, num);
  38677. M(t, t, den);
  38678. pow2523(t, t);
  38679. M(t, t, num);
  38680. M(t, t, den);
  38681. M(t, t, den);
  38682. M(r[0], t, den);
  38683. S(chk, r[0]);
  38684. M(chk, chk, den);
  38685. if (neq25519(chk, num)) M(r[0], r[0], I);
  38686. S(chk, r[0]);
  38687. M(chk, chk, den);
  38688. if (neq25519(chk, num)) return -1;
  38689. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38690. M(r[3], r[0], r[1]);
  38691. return 0;
  38692. }
  38693. function crypto_sign_open(m, sm, n, pk) {
  38694. var i, mlen;
  38695. var t = new Uint8Array(32), h = new Uint8Array(64);
  38696. var p = [gf(), gf(), gf(), gf()],
  38697. q = [gf(), gf(), gf(), gf()];
  38698. mlen = -1;
  38699. if (n < 64) return -1;
  38700. if (unpackneg(q, pk)) return -1;
  38701. for (i = 0; i < n; i++) m[i] = sm[i];
  38702. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38703. crypto_hash(h, m, n);
  38704. reduce(h);
  38705. scalarmult(p, q, h);
  38706. scalarbase(q, sm.subarray(32));
  38707. add(p, q);
  38708. pack(t, p);
  38709. n -= 64;
  38710. if (crypto_verify_32(sm, 0, t, 0)) {
  38711. for (i = 0; i < n; i++) m[i] = 0;
  38712. return -1;
  38713. }
  38714. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38715. mlen = n;
  38716. return mlen;
  38717. }
  38718. var crypto_secretbox_KEYBYTES = 32,
  38719. crypto_secretbox_NONCEBYTES = 24,
  38720. crypto_secretbox_ZEROBYTES = 32,
  38721. crypto_secretbox_BOXZEROBYTES = 16,
  38722. crypto_scalarmult_BYTES = 32,
  38723. crypto_scalarmult_SCALARBYTES = 32,
  38724. crypto_box_PUBLICKEYBYTES = 32,
  38725. crypto_box_SECRETKEYBYTES = 32,
  38726. crypto_box_BEFORENMBYTES = 32,
  38727. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38728. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38729. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38730. crypto_sign_BYTES = 64,
  38731. crypto_sign_PUBLICKEYBYTES = 32,
  38732. crypto_sign_SECRETKEYBYTES = 64,
  38733. crypto_sign_SEEDBYTES = 32,
  38734. crypto_hash_BYTES = 64;
  38735. nacl.lowlevel = {
  38736. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38737. crypto_stream_xor: crypto_stream_xor,
  38738. crypto_stream: crypto_stream,
  38739. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38740. crypto_stream_salsa20: crypto_stream_salsa20,
  38741. crypto_onetimeauth: crypto_onetimeauth,
  38742. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38743. crypto_verify_16: crypto_verify_16,
  38744. crypto_verify_32: crypto_verify_32,
  38745. crypto_secretbox: crypto_secretbox,
  38746. crypto_secretbox_open: crypto_secretbox_open,
  38747. crypto_scalarmult: crypto_scalarmult,
  38748. crypto_scalarmult_base: crypto_scalarmult_base,
  38749. crypto_box_beforenm: crypto_box_beforenm,
  38750. crypto_box_afternm: crypto_box_afternm,
  38751. crypto_box: crypto_box,
  38752. crypto_box_open: crypto_box_open,
  38753. crypto_box_keypair: crypto_box_keypair,
  38754. crypto_hash: crypto_hash,
  38755. crypto_sign: crypto_sign,
  38756. crypto_sign_keypair: crypto_sign_keypair,
  38757. crypto_sign_open: crypto_sign_open,
  38758. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38759. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38760. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38761. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38762. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38763. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38764. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38765. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38766. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38767. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38768. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38769. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38770. crypto_sign_BYTES: crypto_sign_BYTES,
  38771. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38772. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38773. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38774. crypto_hash_BYTES: crypto_hash_BYTES
  38775. };
  38776. /* High-level API */
  38777. function checkLengths(k, n) {
  38778. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38779. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38780. }
  38781. function checkBoxLengths(pk, sk) {
  38782. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38783. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38784. }
  38785. function checkArrayTypes() {
  38786. for (var i = 0; i < arguments.length; i++) {
  38787. if (!(arguments[i] instanceof Uint8Array))
  38788. throw new TypeError('unexpected type, use Uint8Array');
  38789. }
  38790. }
  38791. function cleanup(arr) {
  38792. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38793. }
  38794. nacl.randomBytes = function(n) {
  38795. var b = new Uint8Array(n);
  38796. randombytes(b, n);
  38797. return b;
  38798. };
  38799. nacl.secretbox = function(msg, nonce, key) {
  38800. checkArrayTypes(msg, nonce, key);
  38801. checkLengths(key, nonce);
  38802. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38803. var c = new Uint8Array(m.length);
  38804. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38805. crypto_secretbox(c, m, m.length, nonce, key);
  38806. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38807. };
  38808. nacl.secretbox.open = function(box, nonce, key) {
  38809. checkArrayTypes(box, nonce, key);
  38810. checkLengths(key, nonce);
  38811. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38812. var m = new Uint8Array(c.length);
  38813. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38814. if (c.length < 32) return null;
  38815. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38816. return m.subarray(crypto_secretbox_ZEROBYTES);
  38817. };
  38818. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38819. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38820. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38821. nacl.scalarMult = function(n, p) {
  38822. checkArrayTypes(n, p);
  38823. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38824. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38825. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38826. crypto_scalarmult(q, n, p);
  38827. return q;
  38828. };
  38829. nacl.scalarMult.base = function(n) {
  38830. checkArrayTypes(n);
  38831. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38832. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38833. crypto_scalarmult_base(q, n);
  38834. return q;
  38835. };
  38836. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38837. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38838. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38839. var k = nacl.box.before(publicKey, secretKey);
  38840. return nacl.secretbox(msg, nonce, k);
  38841. };
  38842. nacl.box.before = function(publicKey, secretKey) {
  38843. checkArrayTypes(publicKey, secretKey);
  38844. checkBoxLengths(publicKey, secretKey);
  38845. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38846. crypto_box_beforenm(k, publicKey, secretKey);
  38847. return k;
  38848. };
  38849. nacl.box.after = nacl.secretbox;
  38850. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38851. var k = nacl.box.before(publicKey, secretKey);
  38852. return nacl.secretbox.open(msg, nonce, k);
  38853. };
  38854. nacl.box.open.after = nacl.secretbox.open;
  38855. nacl.box.keyPair = function() {
  38856. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38857. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38858. crypto_box_keypair(pk, sk);
  38859. return {publicKey: pk, secretKey: sk};
  38860. };
  38861. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38862. checkArrayTypes(secretKey);
  38863. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38864. throw new Error('bad secret key size');
  38865. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38866. crypto_scalarmult_base(pk, secretKey);
  38867. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38868. };
  38869. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38870. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38871. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38872. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38873. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38874. nacl.sign = function(msg, secretKey) {
  38875. checkArrayTypes(msg, secretKey);
  38876. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38877. throw new Error('bad secret key size');
  38878. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38879. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38880. return signedMsg;
  38881. };
  38882. nacl.sign.open = function(signedMsg, publicKey) {
  38883. checkArrayTypes(signedMsg, publicKey);
  38884. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38885. throw new Error('bad public key size');
  38886. var tmp = new Uint8Array(signedMsg.length);
  38887. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38888. if (mlen < 0) return null;
  38889. var m = new Uint8Array(mlen);
  38890. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38891. return m;
  38892. };
  38893. nacl.sign.detached = function(msg, secretKey) {
  38894. var signedMsg = nacl.sign(msg, secretKey);
  38895. var sig = new Uint8Array(crypto_sign_BYTES);
  38896. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38897. return sig;
  38898. };
  38899. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38900. checkArrayTypes(msg, sig, publicKey);
  38901. if (sig.length !== crypto_sign_BYTES)
  38902. throw new Error('bad signature size');
  38903. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38904. throw new Error('bad public key size');
  38905. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38906. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38907. var i;
  38908. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38909. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38910. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38911. };
  38912. nacl.sign.keyPair = function() {
  38913. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38914. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38915. crypto_sign_keypair(pk, sk);
  38916. return {publicKey: pk, secretKey: sk};
  38917. };
  38918. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38919. checkArrayTypes(secretKey);
  38920. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38921. throw new Error('bad secret key size');
  38922. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38923. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38924. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38925. };
  38926. nacl.sign.keyPair.fromSeed = function(seed) {
  38927. checkArrayTypes(seed);
  38928. if (seed.length !== crypto_sign_SEEDBYTES)
  38929. throw new Error('bad seed size');
  38930. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38931. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38932. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38933. crypto_sign_keypair(pk, sk, true);
  38934. return {publicKey: pk, secretKey: sk};
  38935. };
  38936. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38937. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38938. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38939. nacl.sign.signatureLength = crypto_sign_BYTES;
  38940. nacl.hash = function(msg) {
  38941. checkArrayTypes(msg);
  38942. var h = new Uint8Array(crypto_hash_BYTES);
  38943. crypto_hash(h, msg, msg.length);
  38944. return h;
  38945. };
  38946. nacl.hash.hashLength = crypto_hash_BYTES;
  38947. nacl.verify = function(x, y) {
  38948. checkArrayTypes(x, y);
  38949. // Zero length arguments are considered not equal.
  38950. if (x.length === 0 || y.length === 0) return false;
  38951. if (x.length !== y.length) return false;
  38952. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38953. };
  38954. nacl.setPRNG = function(fn) {
  38955. randombytes = fn;
  38956. };
  38957. (function() {
  38958. // Initialize PRNG if environment provides CSPRNG.
  38959. // If not, methods calling randombytes will throw.
  38960. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38961. if (crypto && crypto.getRandomValues) {
  38962. // Browsers.
  38963. var QUOTA = 65536;
  38964. nacl.setPRNG(function(x, n) {
  38965. var i, v = new Uint8Array(n);
  38966. for (i = 0; i < n; i += QUOTA) {
  38967. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38968. }
  38969. for (i = 0; i < n; i++) x[i] = v[i];
  38970. cleanup(v);
  38971. });
  38972. } else if (true) {
  38973. // Node.js.
  38974. crypto = __webpack_require__(3);
  38975. if (crypto && crypto.randomBytes) {
  38976. nacl.setPRNG(function(x, n) {
  38977. var i, v = crypto.randomBytes(n);
  38978. for (i = 0; i < n; i++) x[i] = v[i];
  38979. cleanup(v);
  38980. });
  38981. }
  38982. }
  38983. })();
  38984. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38985. /***/ }),
  38986. /* 1 */
  38987. /***/ (function(module, exports, __webpack_require__) {
  38988. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38989. // Public domain.
  38990. (function(root, f) {
  38991. 'use strict';
  38992. if ( true && module.exports) module.exports = f();
  38993. else if (root.nacl) root.nacl.util = f();
  38994. else {
  38995. root.nacl = {};
  38996. root.nacl.util = f();
  38997. }
  38998. }(this, function() {
  38999. 'use strict';
  39000. var util = {};
  39001. function validateBase64(s) {
  39002. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39003. throw new TypeError('invalid encoding');
  39004. }
  39005. }
  39006. util.decodeUTF8 = function(s) {
  39007. if (typeof s !== 'string') throw new TypeError('expected string');
  39008. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39009. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39010. return b;
  39011. };
  39012. util.encodeUTF8 = function(arr) {
  39013. var i, s = [];
  39014. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39015. return decodeURIComponent(escape(s.join('')));
  39016. };
  39017. if (typeof atob === 'undefined') {
  39018. // Node.js
  39019. if (typeof Buffer.from !== 'undefined') {
  39020. // Node v6 and later
  39021. util.encodeBase64 = function (arr) { // v6 and later
  39022. return Buffer.from(arr).toString('base64');
  39023. };
  39024. util.decodeBase64 = function (s) {
  39025. validateBase64(s);
  39026. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39027. };
  39028. } else {
  39029. // Node earlier than v6
  39030. util.encodeBase64 = function (arr) { // v6 and later
  39031. return (new Buffer(arr)).toString('base64');
  39032. };
  39033. util.decodeBase64 = function(s) {
  39034. validateBase64(s);
  39035. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39036. };
  39037. }
  39038. } else {
  39039. // Browsers
  39040. util.encodeBase64 = function(arr) {
  39041. var i, s = [], len = arr.length;
  39042. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39043. return btoa(s.join(''));
  39044. };
  39045. util.decodeBase64 = function(s) {
  39046. validateBase64(s);
  39047. var i, d = atob(s), b = new Uint8Array(d.length);
  39048. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39049. return b;
  39050. };
  39051. }
  39052. return util;
  39053. }));
  39054. /***/ }),
  39055. /* 2 */
  39056. /***/ (function(module, exports, __webpack_require__) {
  39057. // required so we don't have to do require('pusher').default etc.
  39058. module.exports = __webpack_require__(4).default;
  39059. /***/ }),
  39060. /* 3 */
  39061. /***/ (function(module, exports) {
  39062. /* (ignored) */
  39063. /***/ }),
  39064. /* 4 */
  39065. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39066. "use strict";
  39067. __webpack_require__.r(__webpack_exports__);
  39068. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39069. var ScriptReceiverFactory = (function () {
  39070. function ScriptReceiverFactory(prefix, name) {
  39071. this.lastId = 0;
  39072. this.prefix = prefix;
  39073. this.name = name;
  39074. }
  39075. ScriptReceiverFactory.prototype.create = function (callback) {
  39076. this.lastId++;
  39077. var number = this.lastId;
  39078. var id = this.prefix + number;
  39079. var name = this.name + "[" + number + "]";
  39080. var called = false;
  39081. var callbackWrapper = function () {
  39082. if (!called) {
  39083. callback.apply(null, arguments);
  39084. called = true;
  39085. }
  39086. };
  39087. this[number] = callbackWrapper;
  39088. return { number: number, id: id, name: name, callback: callbackWrapper };
  39089. };
  39090. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39091. delete this[receiver.number];
  39092. };
  39093. return ScriptReceiverFactory;
  39094. }());
  39095. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39096. // CONCATENATED MODULE: ./src/core/defaults.ts
  39097. var Defaults = {
  39098. VERSION: "5.0.3",
  39099. PROTOCOL: 7,
  39100. host: 'ws.pusherapp.com',
  39101. ws_port: 80,
  39102. wss_port: 443,
  39103. ws_path: '',
  39104. sockjs_host: 'sockjs.pusher.com',
  39105. sockjs_http_port: 80,
  39106. sockjs_https_port: 443,
  39107. sockjs_path: '/pusher',
  39108. stats_host: 'stats.pusher.com',
  39109. channel_auth_endpoint: '/pusher/auth',
  39110. channel_auth_transport: 'ajax',
  39111. activity_timeout: 120000,
  39112. pong_timeout: 30000,
  39113. unavailable_timeout: 10000,
  39114. cdn_http: "http://js.pusher.com",
  39115. cdn_https: "https://js.pusher.com",
  39116. dependency_suffix: ""
  39117. };
  39118. /* harmony default export */ var defaults = (Defaults);
  39119. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39120. var dependency_loader_DependencyLoader = (function () {
  39121. function DependencyLoader(options) {
  39122. this.options = options;
  39123. this.receivers = options.receivers || ScriptReceivers;
  39124. this.loading = {};
  39125. }
  39126. DependencyLoader.prototype.load = function (name, options, callback) {
  39127. var self = this;
  39128. if (self.loading[name] && self.loading[name].length > 0) {
  39129. self.loading[name].push(callback);
  39130. }
  39131. else {
  39132. self.loading[name] = [callback];
  39133. var request = runtime.createScriptRequest(self.getPath(name, options));
  39134. var receiver = self.receivers.create(function (error) {
  39135. self.receivers.remove(receiver);
  39136. if (self.loading[name]) {
  39137. var callbacks = self.loading[name];
  39138. delete self.loading[name];
  39139. var successCallback = function (wasSuccessful) {
  39140. if (!wasSuccessful) {
  39141. request.cleanup();
  39142. }
  39143. };
  39144. for (var i = 0; i < callbacks.length; i++) {
  39145. callbacks[i](error, successCallback);
  39146. }
  39147. }
  39148. });
  39149. request.send(receiver);
  39150. }
  39151. };
  39152. DependencyLoader.prototype.getRoot = function (options) {
  39153. var cdn;
  39154. var protocol = runtime.getDocument().location.protocol;
  39155. if ((options && options.useTLS) || protocol === "https:") {
  39156. cdn = this.options.cdn_https;
  39157. }
  39158. else {
  39159. cdn = this.options.cdn_http;
  39160. }
  39161. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39162. };
  39163. DependencyLoader.prototype.getPath = function (name, options) {
  39164. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39165. };
  39166. ;
  39167. return DependencyLoader;
  39168. }());
  39169. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39170. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39171. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39172. var Dependencies = new dependency_loader({
  39173. cdn_http: defaults.cdn_http,
  39174. cdn_https: defaults.cdn_https,
  39175. version: defaults.VERSION,
  39176. suffix: defaults.dependency_suffix,
  39177. receivers: DependenciesReceivers
  39178. });
  39179. // CONCATENATED MODULE: ./src/core/base64.ts
  39180. function encode(s) {
  39181. return btoa(utob(s));
  39182. }
  39183. var fromCharCode = String.fromCharCode;
  39184. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39185. var b64tab = {};
  39186. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39187. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39188. }
  39189. var cb_utob = function (c) {
  39190. var cc = c.charCodeAt(0);
  39191. return cc < 0x80
  39192. ? c
  39193. : cc < 0x800
  39194. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39195. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39196. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39197. fromCharCode(0x80 | (cc & 0x3f));
  39198. };
  39199. var utob = function (u) {
  39200. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39201. };
  39202. var cb_encode = function (ccc) {
  39203. var padlen = [0, 2, 1][ccc.length % 3];
  39204. var ord = (ccc.charCodeAt(0) << 16) |
  39205. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39206. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39207. var chars = [
  39208. b64chars.charAt(ord >>> 18),
  39209. b64chars.charAt((ord >>> 12) & 63),
  39210. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39211. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39212. ];
  39213. return chars.join('');
  39214. };
  39215. var btoa = window.btoa ||
  39216. function (b) {
  39217. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39218. };
  39219. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39220. var Timer = (function () {
  39221. function Timer(set, clear, delay, callback) {
  39222. var _this = this;
  39223. this.clear = clear;
  39224. this.timer = set(function () {
  39225. if (_this.timer) {
  39226. _this.timer = callback(_this.timer);
  39227. }
  39228. }, delay);
  39229. }
  39230. Timer.prototype.isRunning = function () {
  39231. return this.timer !== null;
  39232. };
  39233. Timer.prototype.ensureAborted = function () {
  39234. if (this.timer) {
  39235. this.clear(this.timer);
  39236. this.timer = null;
  39237. }
  39238. };
  39239. return Timer;
  39240. }());
  39241. /* harmony default export */ var abstract_timer = (Timer);
  39242. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39243. var __extends = (undefined && undefined.__extends) || (function () {
  39244. var extendStatics = function (d, b) {
  39245. extendStatics = Object.setPrototypeOf ||
  39246. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39247. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39248. return extendStatics(d, b);
  39249. };
  39250. return function (d, b) {
  39251. extendStatics(d, b);
  39252. function __() { this.constructor = d; }
  39253. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39254. };
  39255. })();
  39256. function timers_clearTimeout(timer) {
  39257. window.clearTimeout(timer);
  39258. }
  39259. function timers_clearInterval(timer) {
  39260. window.clearInterval(timer);
  39261. }
  39262. var OneOffTimer = (function (_super) {
  39263. __extends(OneOffTimer, _super);
  39264. function OneOffTimer(delay, callback) {
  39265. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39266. callback();
  39267. return null;
  39268. }) || this;
  39269. }
  39270. return OneOffTimer;
  39271. }(abstract_timer));
  39272. var PeriodicTimer = (function (_super) {
  39273. __extends(PeriodicTimer, _super);
  39274. function PeriodicTimer(delay, callback) {
  39275. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39276. callback();
  39277. return timer;
  39278. }) || this;
  39279. }
  39280. return PeriodicTimer;
  39281. }(abstract_timer));
  39282. // CONCATENATED MODULE: ./src/core/util.ts
  39283. var Util = {
  39284. now: function () {
  39285. if (Date.now) {
  39286. return Date.now();
  39287. }
  39288. else {
  39289. return new Date().valueOf();
  39290. }
  39291. },
  39292. defer: function (callback) {
  39293. return new OneOffTimer(0, callback);
  39294. },
  39295. method: function (name) {
  39296. var args = [];
  39297. for (var _i = 1; _i < arguments.length; _i++) {
  39298. args[_i - 1] = arguments[_i];
  39299. }
  39300. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39301. return function (object) {
  39302. return object[name].apply(object, boundArguments.concat(arguments));
  39303. };
  39304. }
  39305. };
  39306. /* harmony default export */ var util = (Util);
  39307. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39308. function extend(target) {
  39309. var sources = [];
  39310. for (var _i = 1; _i < arguments.length; _i++) {
  39311. sources[_i - 1] = arguments[_i];
  39312. }
  39313. for (var i = 0; i < sources.length; i++) {
  39314. var extensions = sources[i];
  39315. for (var property in extensions) {
  39316. if (extensions[property] && extensions[property].constructor &&
  39317. extensions[property].constructor === Object) {
  39318. target[property] = extend(target[property] || {}, extensions[property]);
  39319. }
  39320. else {
  39321. target[property] = extensions[property];
  39322. }
  39323. }
  39324. }
  39325. return target;
  39326. }
  39327. function stringify() {
  39328. var m = ["Pusher"];
  39329. for (var i = 0; i < arguments.length; i++) {
  39330. if (typeof arguments[i] === "string") {
  39331. m.push(arguments[i]);
  39332. }
  39333. else {
  39334. m.push(safeJSONStringify(arguments[i]));
  39335. }
  39336. }
  39337. return m.join(" : ");
  39338. }
  39339. function arrayIndexOf(array, item) {
  39340. var nativeIndexOf = Array.prototype.indexOf;
  39341. if (array === null) {
  39342. return -1;
  39343. }
  39344. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39345. return array.indexOf(item);
  39346. }
  39347. for (var i = 0, l = array.length; i < l; i++) {
  39348. if (array[i] === item) {
  39349. return i;
  39350. }
  39351. }
  39352. return -1;
  39353. }
  39354. function objectApply(object, f) {
  39355. for (var key in object) {
  39356. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39357. f(object[key], key, object);
  39358. }
  39359. }
  39360. }
  39361. function keys(object) {
  39362. var keys = [];
  39363. objectApply(object, function (_, key) {
  39364. keys.push(key);
  39365. });
  39366. return keys;
  39367. }
  39368. function values(object) {
  39369. var values = [];
  39370. objectApply(object, function (value) {
  39371. values.push(value);
  39372. });
  39373. return values;
  39374. }
  39375. function apply(array, f, context) {
  39376. for (var i = 0; i < array.length; i++) {
  39377. f.call(context || window, array[i], i, array);
  39378. }
  39379. }
  39380. function map(array, f) {
  39381. var result = [];
  39382. for (var i = 0; i < array.length; i++) {
  39383. result.push(f(array[i], i, array, result));
  39384. }
  39385. return result;
  39386. }
  39387. function mapObject(object, f) {
  39388. var result = {};
  39389. objectApply(object, function (value, key) {
  39390. result[key] = f(value);
  39391. });
  39392. return result;
  39393. }
  39394. function filter(array, test) {
  39395. test = test || function (value) { return !!value; };
  39396. var result = [];
  39397. for (var i = 0; i < array.length; i++) {
  39398. if (test(array[i], i, array, result)) {
  39399. result.push(array[i]);
  39400. }
  39401. }
  39402. return result;
  39403. }
  39404. function filterObject(object, test) {
  39405. var result = {};
  39406. objectApply(object, function (value, key) {
  39407. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39408. result[key] = value;
  39409. }
  39410. });
  39411. return result;
  39412. }
  39413. function flatten(object) {
  39414. var result = [];
  39415. objectApply(object, function (value, key) {
  39416. result.push([key, value]);
  39417. });
  39418. return result;
  39419. }
  39420. function any(array, test) {
  39421. for (var i = 0; i < array.length; i++) {
  39422. if (test(array[i], i, array)) {
  39423. return true;
  39424. }
  39425. }
  39426. return false;
  39427. }
  39428. function collections_all(array, test) {
  39429. for (var i = 0; i < array.length; i++) {
  39430. if (!test(array[i], i, array)) {
  39431. return false;
  39432. }
  39433. }
  39434. return true;
  39435. }
  39436. function encodeParamsObject(data) {
  39437. return mapObject(data, function (value) {
  39438. if (typeof value === "object") {
  39439. value = safeJSONStringify(value);
  39440. }
  39441. return encodeURIComponent(encode(value.toString()));
  39442. });
  39443. }
  39444. function buildQueryString(data) {
  39445. var params = filterObject(data, function (value) {
  39446. return value !== undefined;
  39447. });
  39448. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39449. return query;
  39450. }
  39451. function decycleObject(object) {
  39452. var objects = [], paths = [];
  39453. return (function derez(value, path) {
  39454. var i, name, nu;
  39455. switch (typeof value) {
  39456. case 'object':
  39457. if (!value) {
  39458. return null;
  39459. }
  39460. for (i = 0; i < objects.length; i += 1) {
  39461. if (objects[i] === value) {
  39462. return { $ref: paths[i] };
  39463. }
  39464. }
  39465. objects.push(value);
  39466. paths.push(path);
  39467. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39468. nu = [];
  39469. for (i = 0; i < value.length; i += 1) {
  39470. nu[i] = derez(value[i], path + '[' + i + ']');
  39471. }
  39472. }
  39473. else {
  39474. nu = {};
  39475. for (name in value) {
  39476. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39477. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39478. }
  39479. }
  39480. }
  39481. return nu;
  39482. case 'number':
  39483. case 'string':
  39484. case 'boolean':
  39485. return value;
  39486. }
  39487. }(object, '$'));
  39488. }
  39489. function safeJSONStringify(source) {
  39490. try {
  39491. return JSON.stringify(source);
  39492. }
  39493. catch (e) {
  39494. return JSON.stringify(decycleObject(source));
  39495. }
  39496. }
  39497. // CONCATENATED MODULE: ./src/core/logger.ts
  39498. var logger_Logger = (function () {
  39499. function Logger() {
  39500. this.globalLog = function (message) {
  39501. if (window.console && window.console.log) {
  39502. window.console.log(message);
  39503. }
  39504. };
  39505. }
  39506. Logger.prototype.debug = function () {
  39507. var args = [];
  39508. for (var _i = 0; _i < arguments.length; _i++) {
  39509. args[_i] = arguments[_i];
  39510. }
  39511. this.log(this.globalLog, args);
  39512. };
  39513. Logger.prototype.warn = function () {
  39514. var args = [];
  39515. for (var _i = 0; _i < arguments.length; _i++) {
  39516. args[_i] = arguments[_i];
  39517. }
  39518. this.log(this.globalLogWarn, args);
  39519. };
  39520. Logger.prototype.error = function () {
  39521. var args = [];
  39522. for (var _i = 0; _i < arguments.length; _i++) {
  39523. args[_i] = arguments[_i];
  39524. }
  39525. this.log(this.globalLogError, args);
  39526. };
  39527. Logger.prototype.globalLogWarn = function (message) {
  39528. if (window.console && window.console.warn) {
  39529. window.console.warn(message);
  39530. }
  39531. else {
  39532. this.globalLog(message);
  39533. }
  39534. };
  39535. Logger.prototype.globalLogError = function (message) {
  39536. if (window.console && window.console.error) {
  39537. window.console.error(message);
  39538. }
  39539. else {
  39540. this.globalLogWarn(message);
  39541. }
  39542. };
  39543. Logger.prototype.log = function (defaultLoggingFunction) {
  39544. var args = [];
  39545. for (var _i = 1; _i < arguments.length; _i++) {
  39546. args[_i - 1] = arguments[_i];
  39547. }
  39548. var message = stringify.apply(this, arguments);
  39549. if (core_pusher.log) {
  39550. core_pusher.log(message);
  39551. }
  39552. else if (core_pusher.logToConsole) {
  39553. var log = defaultLoggingFunction.bind(this);
  39554. log(message);
  39555. }
  39556. };
  39557. return Logger;
  39558. }());
  39559. /* harmony default export */ var logger = (new logger_Logger());
  39560. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39561. var urlStore = {
  39562. baseUrl: "https://pusher.com",
  39563. urls: {
  39564. authenticationEndpoint: {
  39565. path: "/docs/authenticating_users",
  39566. },
  39567. javascriptQuickStart: {
  39568. path: "/docs/javascript_quick_start"
  39569. },
  39570. triggeringClientEvents: {
  39571. path: "/docs/client_api_guide/client_events#trigger-events"
  39572. }
  39573. }
  39574. };
  39575. var buildLogSuffix = function (key) {
  39576. var urlPrefix = "See:";
  39577. var urlObj = urlStore.urls[key];
  39578. if (!urlObj)
  39579. return "";
  39580. var url;
  39581. if (urlObj.fullUrl) {
  39582. url = urlObj.fullUrl;
  39583. }
  39584. else if (urlObj.path) {
  39585. url = urlStore.baseUrl + urlObj.path;
  39586. }
  39587. if (!url)
  39588. return "";
  39589. return urlPrefix + " " + url;
  39590. };
  39591. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39592. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39593. var ajax = function (context, socketId, callback) {
  39594. var self = this, xhr;
  39595. xhr = runtime.createXHR();
  39596. xhr.open("POST", self.options.authEndpoint, true);
  39597. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39598. for (var headerName in this.authOptions.headers) {
  39599. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39600. }
  39601. xhr.onreadystatechange = function () {
  39602. if (xhr.readyState === 4) {
  39603. if (xhr.status === 200) {
  39604. var data, parsed = false;
  39605. try {
  39606. data = JSON.parse(xhr.responseText);
  39607. parsed = true;
  39608. }
  39609. catch (e) {
  39610. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39611. }
  39612. if (parsed) {
  39613. callback(false, data);
  39614. }
  39615. }
  39616. else {
  39617. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39618. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39619. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39620. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39621. callback(true, xhr.status);
  39622. }
  39623. }
  39624. };
  39625. xhr.send(this.composeQuery(socketId));
  39626. return xhr;
  39627. };
  39628. /* harmony default export */ var xhr_auth = (ajax);
  39629. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39630. var jsonp = function (context, socketId, callback) {
  39631. if (this.authOptions.headers !== undefined) {
  39632. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39633. }
  39634. var callbackName = context.nextAuthCallbackID.toString();
  39635. context.nextAuthCallbackID++;
  39636. var document = context.getDocument();
  39637. var script = document.createElement("script");
  39638. context.auth_callbacks[callbackName] = function (data) {
  39639. callback(false, data);
  39640. };
  39641. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39642. script.src = this.options.authEndpoint +
  39643. '?callback=' +
  39644. encodeURIComponent(callback_name) +
  39645. '&' +
  39646. this.composeQuery(socketId);
  39647. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39648. head.insertBefore(script, head.firstChild);
  39649. };
  39650. /* harmony default export */ var jsonp_auth = (jsonp);
  39651. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39652. var ScriptRequest = (function () {
  39653. function ScriptRequest(src) {
  39654. this.src = src;
  39655. }
  39656. ScriptRequest.prototype.send = function (receiver) {
  39657. var self = this;
  39658. var errorString = "Error loading " + self.src;
  39659. self.script = document.createElement("script");
  39660. self.script.id = receiver.id;
  39661. self.script.src = self.src;
  39662. self.script.type = "text/javascript";
  39663. self.script.charset = "UTF-8";
  39664. if (self.script.addEventListener) {
  39665. self.script.onerror = function () {
  39666. receiver.callback(errorString);
  39667. };
  39668. self.script.onload = function () {
  39669. receiver.callback(null);
  39670. };
  39671. }
  39672. else {
  39673. self.script.onreadystatechange = function () {
  39674. if (self.script.readyState === 'loaded' ||
  39675. self.script.readyState === 'complete') {
  39676. receiver.callback(null);
  39677. }
  39678. };
  39679. }
  39680. if (self.script.async === undefined && document.attachEvent &&
  39681. /opera/i.test(navigator.userAgent)) {
  39682. self.errorScript = document.createElement("script");
  39683. self.errorScript.id = receiver.id + "_error";
  39684. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39685. self.script.async = self.errorScript.async = false;
  39686. }
  39687. else {
  39688. self.script.async = true;
  39689. }
  39690. var head = document.getElementsByTagName('head')[0];
  39691. head.insertBefore(self.script, head.firstChild);
  39692. if (self.errorScript) {
  39693. head.insertBefore(self.errorScript, self.script.nextSibling);
  39694. }
  39695. };
  39696. ScriptRequest.prototype.cleanup = function () {
  39697. if (this.script) {
  39698. this.script.onload = this.script.onerror = null;
  39699. this.script.onreadystatechange = null;
  39700. }
  39701. if (this.script && this.script.parentNode) {
  39702. this.script.parentNode.removeChild(this.script);
  39703. }
  39704. if (this.errorScript && this.errorScript.parentNode) {
  39705. this.errorScript.parentNode.removeChild(this.errorScript);
  39706. }
  39707. this.script = null;
  39708. this.errorScript = null;
  39709. };
  39710. return ScriptRequest;
  39711. }());
  39712. /* harmony default export */ var script_request = (ScriptRequest);
  39713. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39714. var jsonp_request_JSONPRequest = (function () {
  39715. function JSONPRequest(url, data) {
  39716. this.url = url;
  39717. this.data = data;
  39718. }
  39719. JSONPRequest.prototype.send = function (receiver) {
  39720. if (this.request) {
  39721. return;
  39722. }
  39723. var query = buildQueryString(this.data);
  39724. var url = this.url + "/" + receiver.number + "?" + query;
  39725. this.request = runtime.createScriptRequest(url);
  39726. this.request.send(receiver);
  39727. };
  39728. JSONPRequest.prototype.cleanup = function () {
  39729. if (this.request) {
  39730. this.request.cleanup();
  39731. }
  39732. };
  39733. return JSONPRequest;
  39734. }());
  39735. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39736. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39737. var getAgent = function (sender, useTLS) {
  39738. return function (data, callback) {
  39739. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39740. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39741. var request = runtime.createJSONPRequest(url, data);
  39742. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39743. ScriptReceivers.remove(receiver);
  39744. request.cleanup();
  39745. if (result && result.host) {
  39746. sender.host = result.host;
  39747. }
  39748. if (callback) {
  39749. callback(error, result);
  39750. }
  39751. });
  39752. request.send(receiver);
  39753. };
  39754. };
  39755. var jsonp_timeline_jsonp = {
  39756. name: 'jsonp',
  39757. getAgent: getAgent
  39758. };
  39759. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39760. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39761. function getGenericURL(baseScheme, params, path) {
  39762. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39763. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39764. return scheme + "://" + host + path;
  39765. }
  39766. function getGenericPath(key, queryString) {
  39767. var path = "/app/" + key;
  39768. var query = "?protocol=" + defaults.PROTOCOL +
  39769. "&client=js" +
  39770. "&version=" + defaults.VERSION +
  39771. (queryString ? ("&" + queryString) : "");
  39772. return path + query;
  39773. }
  39774. var ws = {
  39775. getInitial: function (key, params) {
  39776. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39777. return getGenericURL("ws", params, path);
  39778. }
  39779. };
  39780. var http = {
  39781. getInitial: function (key, params) {
  39782. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39783. return getGenericURL("http", params, path);
  39784. }
  39785. };
  39786. var sockjs = {
  39787. getInitial: function (key, params) {
  39788. return getGenericURL("http", params, params.httpPath || "/pusher");
  39789. },
  39790. getPath: function (key, params) {
  39791. return getGenericPath(key);
  39792. }
  39793. };
  39794. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39795. var callback_registry_CallbackRegistry = (function () {
  39796. function CallbackRegistry() {
  39797. this._callbacks = {};
  39798. }
  39799. CallbackRegistry.prototype.get = function (name) {
  39800. return this._callbacks[prefix(name)];
  39801. };
  39802. CallbackRegistry.prototype.add = function (name, callback, context) {
  39803. var prefixedEventName = prefix(name);
  39804. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39805. this._callbacks[prefixedEventName].push({
  39806. fn: callback,
  39807. context: context
  39808. });
  39809. };
  39810. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39811. if (!name && !callback && !context) {
  39812. this._callbacks = {};
  39813. return;
  39814. }
  39815. var names = name ? [prefix(name)] : keys(this._callbacks);
  39816. if (callback || context) {
  39817. this.removeCallback(names, callback, context);
  39818. }
  39819. else {
  39820. this.removeAllCallbacks(names);
  39821. }
  39822. };
  39823. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39824. apply(names, function (name) {
  39825. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39826. return (callback && callback !== binding.fn) ||
  39827. (context && context !== binding.context);
  39828. });
  39829. if (this._callbacks[name].length === 0) {
  39830. delete this._callbacks[name];
  39831. }
  39832. }, this);
  39833. };
  39834. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39835. apply(names, function (name) {
  39836. delete this._callbacks[name];
  39837. }, this);
  39838. };
  39839. return CallbackRegistry;
  39840. }());
  39841. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39842. function prefix(name) {
  39843. return "_" + name;
  39844. }
  39845. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39846. var dispatcher_Dispatcher = (function () {
  39847. function Dispatcher(failThrough) {
  39848. this.callbacks = new callback_registry();
  39849. this.global_callbacks = [];
  39850. this.failThrough = failThrough;
  39851. }
  39852. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39853. this.callbacks.add(eventName, callback, context);
  39854. return this;
  39855. };
  39856. Dispatcher.prototype.bind_global = function (callback) {
  39857. this.global_callbacks.push(callback);
  39858. return this;
  39859. };
  39860. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39861. this.callbacks.remove(eventName, callback, context);
  39862. return this;
  39863. };
  39864. Dispatcher.prototype.unbind_global = function (callback) {
  39865. if (!callback) {
  39866. this.global_callbacks = [];
  39867. return this;
  39868. }
  39869. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39870. return this;
  39871. };
  39872. Dispatcher.prototype.unbind_all = function () {
  39873. this.unbind();
  39874. this.unbind_global();
  39875. return this;
  39876. };
  39877. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39878. for (var i = 0; i < this.global_callbacks.length; i++) {
  39879. this.global_callbacks[i](eventName, data);
  39880. }
  39881. var callbacks = this.callbacks.get(eventName);
  39882. var args = [];
  39883. if (metadata) {
  39884. args.push(data, metadata);
  39885. }
  39886. else if (data) {
  39887. args.push(data);
  39888. }
  39889. if (callbacks && callbacks.length > 0) {
  39890. for (var i = 0; i < callbacks.length; i++) {
  39891. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39892. }
  39893. }
  39894. else if (this.failThrough) {
  39895. this.failThrough(eventName, data);
  39896. }
  39897. return this;
  39898. };
  39899. return Dispatcher;
  39900. }());
  39901. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39902. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39903. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39904. var extendStatics = function (d, b) {
  39905. extendStatics = Object.setPrototypeOf ||
  39906. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39907. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39908. return extendStatics(d, b);
  39909. };
  39910. return function (d, b) {
  39911. extendStatics(d, b);
  39912. function __() { this.constructor = d; }
  39913. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39914. };
  39915. })();
  39916. var transport_connection_TransportConnection = (function (_super) {
  39917. transport_connection_extends(TransportConnection, _super);
  39918. function TransportConnection(hooks, name, priority, key, options) {
  39919. var _this = _super.call(this) || this;
  39920. _this.initialize = runtime.transportConnectionInitializer;
  39921. _this.hooks = hooks;
  39922. _this.name = name;
  39923. _this.priority = priority;
  39924. _this.key = key;
  39925. _this.options = options;
  39926. _this.state = "new";
  39927. _this.timeline = options.timeline;
  39928. _this.activityTimeout = options.activityTimeout;
  39929. _this.id = _this.timeline.generateUniqueID();
  39930. return _this;
  39931. }
  39932. TransportConnection.prototype.handlesActivityChecks = function () {
  39933. return Boolean(this.hooks.handlesActivityChecks);
  39934. };
  39935. TransportConnection.prototype.supportsPing = function () {
  39936. return Boolean(this.hooks.supportsPing);
  39937. };
  39938. TransportConnection.prototype.connect = function () {
  39939. var _this = this;
  39940. if (this.socket || this.state !== "initialized") {
  39941. return false;
  39942. }
  39943. var url = this.hooks.urls.getInitial(this.key, this.options);
  39944. try {
  39945. this.socket = this.hooks.getSocket(url, this.options);
  39946. }
  39947. catch (e) {
  39948. util.defer(function () {
  39949. _this.onError(e);
  39950. _this.changeState("closed");
  39951. });
  39952. return false;
  39953. }
  39954. this.bindListeners();
  39955. logger.debug("Connecting", { transport: this.name, url: url });
  39956. this.changeState("connecting");
  39957. return true;
  39958. };
  39959. TransportConnection.prototype.close = function () {
  39960. if (this.socket) {
  39961. this.socket.close();
  39962. return true;
  39963. }
  39964. else {
  39965. return false;
  39966. }
  39967. };
  39968. TransportConnection.prototype.send = function (data) {
  39969. var _this = this;
  39970. if (this.state === "open") {
  39971. util.defer(function () {
  39972. if (_this.socket) {
  39973. _this.socket.send(data);
  39974. }
  39975. });
  39976. return true;
  39977. }
  39978. else {
  39979. return false;
  39980. }
  39981. };
  39982. TransportConnection.prototype.ping = function () {
  39983. if (this.state === "open" && this.supportsPing()) {
  39984. this.socket.ping();
  39985. }
  39986. };
  39987. TransportConnection.prototype.onOpen = function () {
  39988. if (this.hooks.beforeOpen) {
  39989. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39990. }
  39991. this.changeState("open");
  39992. this.socket.onopen = undefined;
  39993. };
  39994. TransportConnection.prototype.onError = function (error) {
  39995. this.emit("error", { type: 'WebSocketError', error: error });
  39996. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39997. };
  39998. TransportConnection.prototype.onClose = function (closeEvent) {
  39999. if (closeEvent) {
  40000. this.changeState("closed", {
  40001. code: closeEvent.code,
  40002. reason: closeEvent.reason,
  40003. wasClean: closeEvent.wasClean
  40004. });
  40005. }
  40006. else {
  40007. this.changeState("closed");
  40008. }
  40009. this.unbindListeners();
  40010. this.socket = undefined;
  40011. };
  40012. TransportConnection.prototype.onMessage = function (message) {
  40013. this.emit("message", message);
  40014. };
  40015. TransportConnection.prototype.onActivity = function () {
  40016. this.emit("activity");
  40017. };
  40018. TransportConnection.prototype.bindListeners = function () {
  40019. var _this = this;
  40020. this.socket.onopen = function () {
  40021. _this.onOpen();
  40022. };
  40023. this.socket.onerror = function (error) {
  40024. _this.onError(error);
  40025. };
  40026. this.socket.onclose = function (closeEvent) {
  40027. _this.onClose(closeEvent);
  40028. };
  40029. this.socket.onmessage = function (message) {
  40030. _this.onMessage(message);
  40031. };
  40032. if (this.supportsPing()) {
  40033. this.socket.onactivity = function () { _this.onActivity(); };
  40034. }
  40035. };
  40036. TransportConnection.prototype.unbindListeners = function () {
  40037. if (this.socket) {
  40038. this.socket.onopen = undefined;
  40039. this.socket.onerror = undefined;
  40040. this.socket.onclose = undefined;
  40041. this.socket.onmessage = undefined;
  40042. if (this.supportsPing()) {
  40043. this.socket.onactivity = undefined;
  40044. }
  40045. }
  40046. };
  40047. TransportConnection.prototype.changeState = function (state, params) {
  40048. this.state = state;
  40049. this.timeline.info(this.buildTimelineMessage({
  40050. state: state,
  40051. params: params
  40052. }));
  40053. this.emit(state, params);
  40054. };
  40055. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40056. return extend({ cid: this.id }, message);
  40057. };
  40058. return TransportConnection;
  40059. }(dispatcher));
  40060. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40061. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40062. var transport_Transport = (function () {
  40063. function Transport(hooks) {
  40064. this.hooks = hooks;
  40065. }
  40066. Transport.prototype.isSupported = function (environment) {
  40067. return this.hooks.isSupported(environment);
  40068. };
  40069. Transport.prototype.createConnection = function (name, priority, key, options) {
  40070. return new transport_connection(this.hooks, name, priority, key, options);
  40071. };
  40072. return Transport;
  40073. }());
  40074. /* harmony default export */ var transports_transport = (transport_Transport);
  40075. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40076. var WSTransport = new transports_transport({
  40077. urls: ws,
  40078. handlesActivityChecks: false,
  40079. supportsPing: false,
  40080. isInitialized: function () {
  40081. return Boolean(runtime.getWebSocketAPI());
  40082. },
  40083. isSupported: function () {
  40084. return Boolean(runtime.getWebSocketAPI());
  40085. },
  40086. getSocket: function (url) {
  40087. return runtime.createWebSocket(url);
  40088. }
  40089. });
  40090. var httpConfiguration = {
  40091. urls: http,
  40092. handlesActivityChecks: false,
  40093. supportsPing: true,
  40094. isInitialized: function () {
  40095. return true;
  40096. }
  40097. };
  40098. var streamingConfiguration = extend({ getSocket: function (url) {
  40099. return runtime.HTTPFactory.createStreamingSocket(url);
  40100. }
  40101. }, httpConfiguration);
  40102. var pollingConfiguration = extend({ getSocket: function (url) {
  40103. return runtime.HTTPFactory.createPollingSocket(url);
  40104. }
  40105. }, httpConfiguration);
  40106. var xhrConfiguration = {
  40107. isSupported: function () {
  40108. return runtime.isXHRSupported();
  40109. }
  40110. };
  40111. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40112. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40113. var Transports = {
  40114. ws: WSTransport,
  40115. xhr_streaming: XHRStreamingTransport,
  40116. xhr_polling: XHRPollingTransport
  40117. };
  40118. /* harmony default export */ var transports = (Transports);
  40119. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40120. var SockJSTransport = new transports_transport({
  40121. file: "sockjs",
  40122. urls: sockjs,
  40123. handlesActivityChecks: true,
  40124. supportsPing: false,
  40125. isSupported: function () {
  40126. return true;
  40127. },
  40128. isInitialized: function () {
  40129. return window.SockJS !== undefined;
  40130. },
  40131. getSocket: function (url, options) {
  40132. return new window.SockJS(url, null, {
  40133. js_path: Dependencies.getPath("sockjs", {
  40134. useTLS: options.useTLS
  40135. }),
  40136. ignore_null_origin: options.ignoreNullOrigin
  40137. });
  40138. },
  40139. beforeOpen: function (socket, path) {
  40140. socket.send(JSON.stringify({
  40141. path: path
  40142. }));
  40143. }
  40144. });
  40145. var xdrConfiguration = {
  40146. isSupported: function (environment) {
  40147. var yes = runtime.isXDRSupported(environment.useTLS);
  40148. return yes;
  40149. }
  40150. };
  40151. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40152. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40153. transports.xdr_streaming = XDRStreamingTransport;
  40154. transports.xdr_polling = XDRPollingTransport;
  40155. transports.sockjs = SockJSTransport;
  40156. /* harmony default export */ var transports_transports = (transports);
  40157. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40158. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40159. var extendStatics = function (d, b) {
  40160. extendStatics = Object.setPrototypeOf ||
  40161. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40162. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40163. return extendStatics(d, b);
  40164. };
  40165. return function (d, b) {
  40166. extendStatics(d, b);
  40167. function __() { this.constructor = d; }
  40168. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40169. };
  40170. })();
  40171. var NetInfo = (function (_super) {
  40172. net_info_extends(NetInfo, _super);
  40173. function NetInfo() {
  40174. var _this = _super.call(this) || this;
  40175. var self = _this;
  40176. if (window.addEventListener !== undefined) {
  40177. window.addEventListener("online", function () {
  40178. self.emit('online');
  40179. }, false);
  40180. window.addEventListener("offline", function () {
  40181. self.emit('offline');
  40182. }, false);
  40183. }
  40184. return _this;
  40185. }
  40186. NetInfo.prototype.isOnline = function () {
  40187. if (window.navigator.onLine === undefined) {
  40188. return true;
  40189. }
  40190. else {
  40191. return window.navigator.onLine;
  40192. }
  40193. };
  40194. return NetInfo;
  40195. }(dispatcher));
  40196. var net_info_Network = new NetInfo();
  40197. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40198. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40199. function AssistantToTheTransportManager(manager, transport, options) {
  40200. this.manager = manager;
  40201. this.transport = transport;
  40202. this.minPingDelay = options.minPingDelay;
  40203. this.maxPingDelay = options.maxPingDelay;
  40204. this.pingDelay = undefined;
  40205. }
  40206. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40207. var _this = this;
  40208. options = extend({}, options, {
  40209. activityTimeout: this.pingDelay
  40210. });
  40211. var connection = this.transport.createConnection(name, priority, key, options);
  40212. var openTimestamp = null;
  40213. var onOpen = function () {
  40214. connection.unbind("open", onOpen);
  40215. connection.bind("closed", onClosed);
  40216. openTimestamp = util.now();
  40217. };
  40218. var onClosed = function (closeEvent) {
  40219. connection.unbind("closed", onClosed);
  40220. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40221. _this.manager.reportDeath();
  40222. }
  40223. else if (!closeEvent.wasClean && openTimestamp) {
  40224. var lifespan = util.now() - openTimestamp;
  40225. if (lifespan < 2 * _this.maxPingDelay) {
  40226. _this.manager.reportDeath();
  40227. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40228. }
  40229. }
  40230. };
  40231. connection.bind("open", onOpen);
  40232. return connection;
  40233. };
  40234. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40235. return this.manager.isAlive() && this.transport.isSupported(environment);
  40236. };
  40237. return AssistantToTheTransportManager;
  40238. }());
  40239. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40240. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40241. var Protocol = {
  40242. decodeMessage: function (messageEvent) {
  40243. try {
  40244. var messageData = JSON.parse(messageEvent.data);
  40245. var pusherEventData = messageData.data;
  40246. if (typeof pusherEventData === 'string') {
  40247. try {
  40248. pusherEventData = JSON.parse(messageData.data);
  40249. }
  40250. catch (e) { }
  40251. }
  40252. var pusherEvent = {
  40253. event: messageData.event,
  40254. channel: messageData.channel,
  40255. data: pusherEventData,
  40256. };
  40257. if (messageData.user_id) {
  40258. pusherEvent.user_id = messageData.user_id;
  40259. }
  40260. return pusherEvent;
  40261. }
  40262. catch (e) {
  40263. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40264. }
  40265. },
  40266. encodeMessage: function (event) {
  40267. return JSON.stringify(event);
  40268. },
  40269. processHandshake: function (messageEvent) {
  40270. var message = Protocol.decodeMessage(messageEvent);
  40271. if (message.event === "pusher:connection_established") {
  40272. if (!message.data.activity_timeout) {
  40273. throw "No activity timeout specified in handshake";
  40274. }
  40275. return {
  40276. action: "connected",
  40277. id: message.data.socket_id,
  40278. activityTimeout: message.data.activity_timeout * 1000
  40279. };
  40280. }
  40281. else if (message.event === "pusher:error") {
  40282. return {
  40283. action: this.getCloseAction(message.data),
  40284. error: this.getCloseError(message.data)
  40285. };
  40286. }
  40287. else {
  40288. throw "Invalid handshake";
  40289. }
  40290. },
  40291. getCloseAction: function (closeEvent) {
  40292. if (closeEvent.code < 4000) {
  40293. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40294. return "backoff";
  40295. }
  40296. else {
  40297. return null;
  40298. }
  40299. }
  40300. else if (closeEvent.code === 4000) {
  40301. return "tls_only";
  40302. }
  40303. else if (closeEvent.code < 4100) {
  40304. return "refused";
  40305. }
  40306. else if (closeEvent.code < 4200) {
  40307. return "backoff";
  40308. }
  40309. else if (closeEvent.code < 4300) {
  40310. return "retry";
  40311. }
  40312. else {
  40313. return "refused";
  40314. }
  40315. },
  40316. getCloseError: function (closeEvent) {
  40317. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40318. return {
  40319. type: 'PusherError',
  40320. data: {
  40321. code: closeEvent.code,
  40322. message: closeEvent.reason || closeEvent.message
  40323. }
  40324. };
  40325. }
  40326. else {
  40327. return null;
  40328. }
  40329. }
  40330. };
  40331. /* harmony default export */ var protocol_protocol = (Protocol);
  40332. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40333. var connection_extends = (undefined && undefined.__extends) || (function () {
  40334. var extendStatics = function (d, b) {
  40335. extendStatics = Object.setPrototypeOf ||
  40336. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40337. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40338. return extendStatics(d, b);
  40339. };
  40340. return function (d, b) {
  40341. extendStatics(d, b);
  40342. function __() { this.constructor = d; }
  40343. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40344. };
  40345. })();
  40346. var connection_Connection = (function (_super) {
  40347. connection_extends(Connection, _super);
  40348. function Connection(id, transport) {
  40349. var _this = _super.call(this) || this;
  40350. _this.id = id;
  40351. _this.transport = transport;
  40352. _this.activityTimeout = transport.activityTimeout;
  40353. _this.bindListeners();
  40354. return _this;
  40355. }
  40356. Connection.prototype.handlesActivityChecks = function () {
  40357. return this.transport.handlesActivityChecks();
  40358. };
  40359. Connection.prototype.send = function (data) {
  40360. return this.transport.send(data);
  40361. };
  40362. Connection.prototype.send_event = function (name, data, channel) {
  40363. var event = { event: name, data: data };
  40364. if (channel) {
  40365. event.channel = channel;
  40366. }
  40367. logger.debug('Event sent', event);
  40368. return this.send(protocol_protocol.encodeMessage(event));
  40369. };
  40370. Connection.prototype.ping = function () {
  40371. if (this.transport.supportsPing()) {
  40372. this.transport.ping();
  40373. }
  40374. else {
  40375. this.send_event('pusher:ping', {});
  40376. }
  40377. };
  40378. Connection.prototype.close = function () {
  40379. this.transport.close();
  40380. };
  40381. Connection.prototype.bindListeners = function () {
  40382. var _this = this;
  40383. var listeners = {
  40384. message: function (messageEvent) {
  40385. var pusherEvent;
  40386. try {
  40387. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40388. }
  40389. catch (e) {
  40390. _this.emit('error', {
  40391. type: 'MessageParseError',
  40392. error: e,
  40393. data: messageEvent.data
  40394. });
  40395. }
  40396. if (pusherEvent !== undefined) {
  40397. logger.debug('Event recd', pusherEvent);
  40398. switch (pusherEvent.event) {
  40399. case 'pusher:error':
  40400. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40401. break;
  40402. case 'pusher:ping':
  40403. _this.emit("ping");
  40404. break;
  40405. case 'pusher:pong':
  40406. _this.emit("pong");
  40407. break;
  40408. }
  40409. _this.emit('message', pusherEvent);
  40410. }
  40411. },
  40412. activity: function () {
  40413. _this.emit("activity");
  40414. },
  40415. error: function (error) {
  40416. _this.emit("error", { type: "WebSocketError", error: error });
  40417. },
  40418. closed: function (closeEvent) {
  40419. unbindListeners();
  40420. if (closeEvent && closeEvent.code) {
  40421. _this.handleCloseEvent(closeEvent);
  40422. }
  40423. _this.transport = null;
  40424. _this.emit("closed");
  40425. }
  40426. };
  40427. var unbindListeners = function () {
  40428. objectApply(listeners, function (listener, event) {
  40429. _this.transport.unbind(event, listener);
  40430. });
  40431. };
  40432. objectApply(listeners, function (listener, event) {
  40433. _this.transport.bind(event, listener);
  40434. });
  40435. };
  40436. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40437. var action = protocol_protocol.getCloseAction(closeEvent);
  40438. var error = protocol_protocol.getCloseError(closeEvent);
  40439. if (error) {
  40440. this.emit('error', error);
  40441. }
  40442. if (action) {
  40443. this.emit(action, { action: action, error: error });
  40444. }
  40445. };
  40446. return Connection;
  40447. }(dispatcher));
  40448. /* harmony default export */ var connection_connection = (connection_Connection);
  40449. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40450. var handshake_Handshake = (function () {
  40451. function Handshake(transport, callback) {
  40452. this.transport = transport;
  40453. this.callback = callback;
  40454. this.bindListeners();
  40455. }
  40456. Handshake.prototype.close = function () {
  40457. this.unbindListeners();
  40458. this.transport.close();
  40459. };
  40460. Handshake.prototype.bindListeners = function () {
  40461. var _this = this;
  40462. this.onMessage = function (m) {
  40463. _this.unbindListeners();
  40464. var result;
  40465. try {
  40466. result = protocol_protocol.processHandshake(m);
  40467. }
  40468. catch (e) {
  40469. _this.finish("error", { error: e });
  40470. _this.transport.close();
  40471. return;
  40472. }
  40473. if (result.action === "connected") {
  40474. _this.finish("connected", {
  40475. connection: new connection_connection(result.id, _this.transport),
  40476. activityTimeout: result.activityTimeout
  40477. });
  40478. }
  40479. else {
  40480. _this.finish(result.action, { error: result.error });
  40481. _this.transport.close();
  40482. }
  40483. };
  40484. this.onClosed = function (closeEvent) {
  40485. _this.unbindListeners();
  40486. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40487. var error = protocol_protocol.getCloseError(closeEvent);
  40488. _this.finish(action, { error: error });
  40489. };
  40490. this.transport.bind("message", this.onMessage);
  40491. this.transport.bind("closed", this.onClosed);
  40492. };
  40493. Handshake.prototype.unbindListeners = function () {
  40494. this.transport.unbind("message", this.onMessage);
  40495. this.transport.unbind("closed", this.onClosed);
  40496. };
  40497. Handshake.prototype.finish = function (action, params) {
  40498. this.callback(extend({ transport: this.transport, action: action }, params));
  40499. };
  40500. return Handshake;
  40501. }());
  40502. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40503. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40504. var pusher_authorizer_PusherAuthorizer = (function () {
  40505. function PusherAuthorizer(channel, options) {
  40506. this.channel = channel;
  40507. var authTransport = options.authTransport;
  40508. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40509. throw "'" + authTransport + "' is not a recognized auth transport";
  40510. }
  40511. this.type = authTransport;
  40512. this.options = options;
  40513. this.authOptions = (options || {}).auth || {};
  40514. }
  40515. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40516. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40517. '&channel_name=' + encodeURIComponent(this.channel.name);
  40518. for (var i in this.authOptions.params) {
  40519. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40520. }
  40521. return query;
  40522. };
  40523. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40524. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40525. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40526. };
  40527. return PusherAuthorizer;
  40528. }());
  40529. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40530. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40531. var timeline_sender_TimelineSender = (function () {
  40532. function TimelineSender(timeline, options) {
  40533. this.timeline = timeline;
  40534. this.options = options || {};
  40535. }
  40536. TimelineSender.prototype.send = function (useTLS, callback) {
  40537. if (this.timeline.isEmpty()) {
  40538. return;
  40539. }
  40540. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40541. };
  40542. return TimelineSender;
  40543. }());
  40544. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40545. // CONCATENATED MODULE: ./src/core/errors.ts
  40546. var errors_extends = (undefined && undefined.__extends) || (function () {
  40547. var extendStatics = function (d, b) {
  40548. extendStatics = Object.setPrototypeOf ||
  40549. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40550. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40551. return extendStatics(d, b);
  40552. };
  40553. return function (d, b) {
  40554. extendStatics(d, b);
  40555. function __() { this.constructor = d; }
  40556. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40557. };
  40558. })();
  40559. var BadEventName = (function (_super) {
  40560. errors_extends(BadEventName, _super);
  40561. function BadEventName(msg) {
  40562. var _newTarget = this.constructor;
  40563. var _this = _super.call(this, msg) || this;
  40564. Object.setPrototypeOf(_this, _newTarget.prototype);
  40565. return _this;
  40566. }
  40567. return BadEventName;
  40568. }(Error));
  40569. var RequestTimedOut = (function (_super) {
  40570. errors_extends(RequestTimedOut, _super);
  40571. function RequestTimedOut(msg) {
  40572. var _newTarget = this.constructor;
  40573. var _this = _super.call(this, msg) || this;
  40574. Object.setPrototypeOf(_this, _newTarget.prototype);
  40575. return _this;
  40576. }
  40577. return RequestTimedOut;
  40578. }(Error));
  40579. var TransportPriorityTooLow = (function (_super) {
  40580. errors_extends(TransportPriorityTooLow, _super);
  40581. function TransportPriorityTooLow(msg) {
  40582. var _newTarget = this.constructor;
  40583. var _this = _super.call(this, msg) || this;
  40584. Object.setPrototypeOf(_this, _newTarget.prototype);
  40585. return _this;
  40586. }
  40587. return TransportPriorityTooLow;
  40588. }(Error));
  40589. var TransportClosed = (function (_super) {
  40590. errors_extends(TransportClosed, _super);
  40591. function TransportClosed(msg) {
  40592. var _newTarget = this.constructor;
  40593. var _this = _super.call(this, msg) || this;
  40594. Object.setPrototypeOf(_this, _newTarget.prototype);
  40595. return _this;
  40596. }
  40597. return TransportClosed;
  40598. }(Error));
  40599. var UnsupportedFeature = (function (_super) {
  40600. errors_extends(UnsupportedFeature, _super);
  40601. function UnsupportedFeature(msg) {
  40602. var _newTarget = this.constructor;
  40603. var _this = _super.call(this, msg) || this;
  40604. Object.setPrototypeOf(_this, _newTarget.prototype);
  40605. return _this;
  40606. }
  40607. return UnsupportedFeature;
  40608. }(Error));
  40609. var UnsupportedTransport = (function (_super) {
  40610. errors_extends(UnsupportedTransport, _super);
  40611. function UnsupportedTransport(msg) {
  40612. var _newTarget = this.constructor;
  40613. var _this = _super.call(this, msg) || this;
  40614. Object.setPrototypeOf(_this, _newTarget.prototype);
  40615. return _this;
  40616. }
  40617. return UnsupportedTransport;
  40618. }(Error));
  40619. var UnsupportedStrategy = (function (_super) {
  40620. errors_extends(UnsupportedStrategy, _super);
  40621. function UnsupportedStrategy(msg) {
  40622. var _newTarget = this.constructor;
  40623. var _this = _super.call(this, msg) || this;
  40624. Object.setPrototypeOf(_this, _newTarget.prototype);
  40625. return _this;
  40626. }
  40627. return UnsupportedStrategy;
  40628. }(Error));
  40629. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40630. var channel_extends = (undefined && undefined.__extends) || (function () {
  40631. var extendStatics = function (d, b) {
  40632. extendStatics = Object.setPrototypeOf ||
  40633. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40634. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40635. return extendStatics(d, b);
  40636. };
  40637. return function (d, b) {
  40638. extendStatics(d, b);
  40639. function __() { this.constructor = d; }
  40640. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40641. };
  40642. })();
  40643. var channel_Channel = (function (_super) {
  40644. channel_extends(Channel, _super);
  40645. function Channel(name, pusher) {
  40646. var _this = _super.call(this, function (event, data) {
  40647. logger.debug('No callbacks on ' + name + ' for ' + event);
  40648. }) || this;
  40649. _this.name = name;
  40650. _this.pusher = pusher;
  40651. _this.subscribed = false;
  40652. _this.subscriptionPending = false;
  40653. _this.subscriptionCancelled = false;
  40654. return _this;
  40655. }
  40656. Channel.prototype.authorize = function (socketId, callback) {
  40657. return callback(false, {});
  40658. };
  40659. Channel.prototype.trigger = function (event, data) {
  40660. if (event.indexOf("client-") !== 0) {
  40661. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40662. }
  40663. if (!this.subscribed) {
  40664. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40665. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40666. }
  40667. return this.pusher.send_event(event, data, this.name);
  40668. };
  40669. Channel.prototype.disconnect = function () {
  40670. this.subscribed = false;
  40671. this.subscriptionPending = false;
  40672. };
  40673. Channel.prototype.handleEvent = function (event) {
  40674. var eventName = event.event;
  40675. var data = event.data;
  40676. if (eventName === "pusher_internal:subscription_succeeded") {
  40677. this.handleSubscriptionSucceededEvent(event);
  40678. }
  40679. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40680. var metadata = {};
  40681. this.emit(eventName, data, metadata);
  40682. }
  40683. };
  40684. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40685. this.subscriptionPending = false;
  40686. this.subscribed = true;
  40687. if (this.subscriptionCancelled) {
  40688. this.pusher.unsubscribe(this.name);
  40689. }
  40690. else {
  40691. this.emit("pusher:subscription_succeeded", event.data);
  40692. }
  40693. };
  40694. Channel.prototype.subscribe = function () {
  40695. var _this = this;
  40696. if (this.subscribed) {
  40697. return;
  40698. }
  40699. this.subscriptionPending = true;
  40700. this.subscriptionCancelled = false;
  40701. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40702. if (error) {
  40703. logger.error(data);
  40704. _this.emit('pusher:subscription_error', data);
  40705. }
  40706. else {
  40707. _this.pusher.send_event('pusher:subscribe', {
  40708. auth: data.auth,
  40709. channel_data: data.channel_data,
  40710. channel: _this.name
  40711. });
  40712. }
  40713. });
  40714. };
  40715. Channel.prototype.unsubscribe = function () {
  40716. this.subscribed = false;
  40717. this.pusher.send_event('pusher:unsubscribe', {
  40718. channel: this.name
  40719. });
  40720. };
  40721. Channel.prototype.cancelSubscription = function () {
  40722. this.subscriptionCancelled = true;
  40723. };
  40724. Channel.prototype.reinstateSubscription = function () {
  40725. this.subscriptionCancelled = false;
  40726. };
  40727. return Channel;
  40728. }(dispatcher));
  40729. /* harmony default export */ var channels_channel = (channel_Channel);
  40730. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40731. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40732. var extendStatics = function (d, b) {
  40733. extendStatics = Object.setPrototypeOf ||
  40734. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40735. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40736. return extendStatics(d, b);
  40737. };
  40738. return function (d, b) {
  40739. extendStatics(d, b);
  40740. function __() { this.constructor = d; }
  40741. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40742. };
  40743. })();
  40744. var private_channel_PrivateChannel = (function (_super) {
  40745. private_channel_extends(PrivateChannel, _super);
  40746. function PrivateChannel() {
  40747. return _super !== null && _super.apply(this, arguments) || this;
  40748. }
  40749. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40750. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40751. return authorizer.authorize(socketId, callback);
  40752. };
  40753. return PrivateChannel;
  40754. }(channels_channel));
  40755. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40756. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40757. var members_Members = (function () {
  40758. function Members() {
  40759. this.reset();
  40760. }
  40761. Members.prototype.get = function (id) {
  40762. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40763. return {
  40764. id: id,
  40765. info: this.members[id]
  40766. };
  40767. }
  40768. else {
  40769. return null;
  40770. }
  40771. };
  40772. Members.prototype.each = function (callback) {
  40773. var _this = this;
  40774. objectApply(this.members, function (member, id) {
  40775. callback(_this.get(id));
  40776. });
  40777. };
  40778. Members.prototype.setMyID = function (id) {
  40779. this.myID = id;
  40780. };
  40781. Members.prototype.onSubscription = function (subscriptionData) {
  40782. this.members = subscriptionData.presence.hash;
  40783. this.count = subscriptionData.presence.count;
  40784. this.me = this.get(this.myID);
  40785. };
  40786. Members.prototype.addMember = function (memberData) {
  40787. if (this.get(memberData.user_id) === null) {
  40788. this.count++;
  40789. }
  40790. this.members[memberData.user_id] = memberData.user_info;
  40791. return this.get(memberData.user_id);
  40792. };
  40793. Members.prototype.removeMember = function (memberData) {
  40794. var member = this.get(memberData.user_id);
  40795. if (member) {
  40796. delete this.members[memberData.user_id];
  40797. this.count--;
  40798. }
  40799. return member;
  40800. };
  40801. Members.prototype.reset = function () {
  40802. this.members = {};
  40803. this.count = 0;
  40804. this.myID = null;
  40805. this.me = null;
  40806. };
  40807. return Members;
  40808. }());
  40809. /* harmony default export */ var members = (members_Members);
  40810. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40811. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40812. var extendStatics = function (d, b) {
  40813. extendStatics = Object.setPrototypeOf ||
  40814. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40815. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40816. return extendStatics(d, b);
  40817. };
  40818. return function (d, b) {
  40819. extendStatics(d, b);
  40820. function __() { this.constructor = d; }
  40821. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40822. };
  40823. })();
  40824. var presence_channel_PresenceChannel = (function (_super) {
  40825. presence_channel_extends(PresenceChannel, _super);
  40826. function PresenceChannel(name, pusher) {
  40827. var _this = _super.call(this, name, pusher) || this;
  40828. _this.members = new members();
  40829. return _this;
  40830. }
  40831. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40832. var _this = this;
  40833. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40834. if (!error) {
  40835. if (authData.channel_data === undefined) {
  40836. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40837. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40838. ("expected 'channel_data' field. " + suffix));
  40839. callback("Invalid auth response");
  40840. return;
  40841. }
  40842. var channelData = JSON.parse(authData.channel_data);
  40843. _this.members.setMyID(channelData.user_id);
  40844. }
  40845. callback(error, authData);
  40846. });
  40847. };
  40848. PresenceChannel.prototype.handleEvent = function (event) {
  40849. var eventName = event.event;
  40850. if (eventName.indexOf("pusher_internal:") === 0) {
  40851. this.handleInternalEvent(event);
  40852. }
  40853. else {
  40854. var data = event.data;
  40855. var metadata = {};
  40856. if (event.user_id) {
  40857. metadata.user_id = event.user_id;
  40858. }
  40859. this.emit(eventName, data, metadata);
  40860. }
  40861. };
  40862. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40863. var eventName = event.event;
  40864. var data = event.data;
  40865. switch (eventName) {
  40866. case "pusher_internal:subscription_succeeded":
  40867. this.handleSubscriptionSucceededEvent(event);
  40868. break;
  40869. case "pusher_internal:member_added":
  40870. var addedMember = this.members.addMember(data);
  40871. this.emit('pusher:member_added', addedMember);
  40872. break;
  40873. case "pusher_internal:member_removed":
  40874. var removedMember = this.members.removeMember(data);
  40875. if (removedMember) {
  40876. this.emit('pusher:member_removed', removedMember);
  40877. }
  40878. break;
  40879. }
  40880. };
  40881. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40882. this.subscriptionPending = false;
  40883. this.subscribed = true;
  40884. if (this.subscriptionCancelled) {
  40885. this.pusher.unsubscribe(this.name);
  40886. }
  40887. else {
  40888. this.members.onSubscription(event.data);
  40889. this.emit("pusher:subscription_succeeded", this.members);
  40890. }
  40891. };
  40892. PresenceChannel.prototype.disconnect = function () {
  40893. this.members.reset();
  40894. _super.prototype.disconnect.call(this);
  40895. };
  40896. return PresenceChannel;
  40897. }(private_channel));
  40898. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40899. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40900. var nacl_fast = __webpack_require__(0);
  40901. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40902. var nacl_util = __webpack_require__(1);
  40903. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40904. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40905. var extendStatics = function (d, b) {
  40906. extendStatics = Object.setPrototypeOf ||
  40907. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40908. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40909. return extendStatics(d, b);
  40910. };
  40911. return function (d, b) {
  40912. extendStatics(d, b);
  40913. function __() { this.constructor = d; }
  40914. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40915. };
  40916. })();
  40917. var encrypted_channel_EncryptedChannel = (function (_super) {
  40918. encrypted_channel_extends(EncryptedChannel, _super);
  40919. function EncryptedChannel() {
  40920. var _this = _super !== null && _super.apply(this, arguments) || this;
  40921. _this.key = null;
  40922. return _this;
  40923. }
  40924. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40925. var _this = this;
  40926. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40927. if (error) {
  40928. callback(true, authData);
  40929. return;
  40930. }
  40931. var sharedSecret = authData["shared_secret"];
  40932. if (!sharedSecret) {
  40933. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40934. callback(true, errorMsg);
  40935. return;
  40936. }
  40937. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40938. delete authData["shared_secret"];
  40939. callback(false, authData);
  40940. });
  40941. };
  40942. EncryptedChannel.prototype.trigger = function (event, data) {
  40943. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40944. };
  40945. EncryptedChannel.prototype.handleEvent = function (event) {
  40946. var eventName = event.event;
  40947. var data = event.data;
  40948. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40949. _super.prototype.handleEvent.call(this, event);
  40950. return;
  40951. }
  40952. this.handleEncryptedEvent(eventName, data);
  40953. };
  40954. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40955. var _this = this;
  40956. if (!this.key) {
  40957. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40958. return;
  40959. }
  40960. if (!data.ciphertext || !data.nonce) {
  40961. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40962. return;
  40963. }
  40964. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40965. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40966. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40967. return;
  40968. }
  40969. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40970. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40971. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40972. return;
  40973. }
  40974. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40975. if (bytes === null) {
  40976. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40977. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40978. if (error) {
  40979. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40980. return;
  40981. }
  40982. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40983. if (bytes === null) {
  40984. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40985. return;
  40986. }
  40987. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40988. return;
  40989. });
  40990. return;
  40991. }
  40992. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40993. };
  40994. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40995. try {
  40996. this.emit(eventName, JSON.parse(data));
  40997. }
  40998. catch (e) {
  40999. this.emit(eventName, data);
  41000. }
  41001. return this;
  41002. };
  41003. return EncryptedChannel;
  41004. }(private_channel));
  41005. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41006. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41007. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41008. var extendStatics = function (d, b) {
  41009. extendStatics = Object.setPrototypeOf ||
  41010. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41011. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41012. return extendStatics(d, b);
  41013. };
  41014. return function (d, b) {
  41015. extendStatics(d, b);
  41016. function __() { this.constructor = d; }
  41017. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41018. };
  41019. })();
  41020. var connection_manager_ConnectionManager = (function (_super) {
  41021. connection_manager_extends(ConnectionManager, _super);
  41022. function ConnectionManager(key, options) {
  41023. var _this = _super.call(this) || this;
  41024. _this.key = key;
  41025. _this.options = options || {};
  41026. _this.state = "initialized";
  41027. _this.connection = null;
  41028. _this.usingTLS = !!options.useTLS;
  41029. _this.timeline = _this.options.timeline;
  41030. _this.errorCallbacks = _this.buildErrorCallbacks();
  41031. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41032. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41033. var Network = runtime.getNetwork();
  41034. Network.bind("online", function () {
  41035. _this.timeline.info({ netinfo: "online" });
  41036. if (_this.state === "connecting" || _this.state === "unavailable") {
  41037. _this.retryIn(0);
  41038. }
  41039. });
  41040. Network.bind("offline", function () {
  41041. _this.timeline.info({ netinfo: "offline" });
  41042. if (_this.connection) {
  41043. _this.sendActivityCheck();
  41044. }
  41045. });
  41046. _this.updateStrategy();
  41047. return _this;
  41048. }
  41049. ConnectionManager.prototype.connect = function () {
  41050. if (this.connection || this.runner) {
  41051. return;
  41052. }
  41053. if (!this.strategy.isSupported()) {
  41054. this.updateState("failed");
  41055. return;
  41056. }
  41057. this.updateState("connecting");
  41058. this.startConnecting();
  41059. this.setUnavailableTimer();
  41060. };
  41061. ;
  41062. ConnectionManager.prototype.send = function (data) {
  41063. if (this.connection) {
  41064. return this.connection.send(data);
  41065. }
  41066. else {
  41067. return false;
  41068. }
  41069. };
  41070. ;
  41071. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41072. if (this.connection) {
  41073. return this.connection.send_event(name, data, channel);
  41074. }
  41075. else {
  41076. return false;
  41077. }
  41078. };
  41079. ;
  41080. ConnectionManager.prototype.disconnect = function () {
  41081. this.disconnectInternally();
  41082. this.updateState("disconnected");
  41083. };
  41084. ;
  41085. ConnectionManager.prototype.isUsingTLS = function () {
  41086. return this.usingTLS;
  41087. };
  41088. ;
  41089. ConnectionManager.prototype.startConnecting = function () {
  41090. var _this = this;
  41091. var callback = function (error, handshake) {
  41092. if (error) {
  41093. _this.runner = _this.strategy.connect(0, callback);
  41094. }
  41095. else {
  41096. if (handshake.action === "error") {
  41097. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41098. _this.timeline.error({ handshakeError: handshake.error });
  41099. }
  41100. else {
  41101. _this.abortConnecting();
  41102. _this.handshakeCallbacks[handshake.action](handshake);
  41103. }
  41104. }
  41105. };
  41106. this.runner = this.strategy.connect(0, callback);
  41107. };
  41108. ;
  41109. ConnectionManager.prototype.abortConnecting = function () {
  41110. if (this.runner) {
  41111. this.runner.abort();
  41112. this.runner = null;
  41113. }
  41114. };
  41115. ;
  41116. ConnectionManager.prototype.disconnectInternally = function () {
  41117. this.abortConnecting();
  41118. this.clearRetryTimer();
  41119. this.clearUnavailableTimer();
  41120. if (this.connection) {
  41121. var connection = this.abandonConnection();
  41122. connection.close();
  41123. }
  41124. };
  41125. ;
  41126. ConnectionManager.prototype.updateStrategy = function () {
  41127. this.strategy = this.options.getStrategy({
  41128. key: this.key,
  41129. timeline: this.timeline,
  41130. useTLS: this.usingTLS
  41131. });
  41132. };
  41133. ;
  41134. ConnectionManager.prototype.retryIn = function (delay) {
  41135. var _this = this;
  41136. this.timeline.info({ action: "retry", delay: delay });
  41137. if (delay > 0) {
  41138. this.emit("connecting_in", Math.round(delay / 1000));
  41139. }
  41140. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41141. _this.disconnectInternally();
  41142. _this.connect();
  41143. });
  41144. };
  41145. ;
  41146. ConnectionManager.prototype.clearRetryTimer = function () {
  41147. if (this.retryTimer) {
  41148. this.retryTimer.ensureAborted();
  41149. this.retryTimer = null;
  41150. }
  41151. };
  41152. ;
  41153. ConnectionManager.prototype.setUnavailableTimer = function () {
  41154. var _this = this;
  41155. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41156. _this.updateState("unavailable");
  41157. });
  41158. };
  41159. ;
  41160. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41161. if (this.unavailableTimer) {
  41162. this.unavailableTimer.ensureAborted();
  41163. }
  41164. };
  41165. ;
  41166. ConnectionManager.prototype.sendActivityCheck = function () {
  41167. var _this = this;
  41168. this.stopActivityCheck();
  41169. this.connection.ping();
  41170. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41171. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41172. _this.retryIn(0);
  41173. });
  41174. };
  41175. ;
  41176. ConnectionManager.prototype.resetActivityCheck = function () {
  41177. var _this = this;
  41178. this.stopActivityCheck();
  41179. if (this.connection && !this.connection.handlesActivityChecks()) {
  41180. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41181. _this.sendActivityCheck();
  41182. });
  41183. }
  41184. };
  41185. ;
  41186. ConnectionManager.prototype.stopActivityCheck = function () {
  41187. if (this.activityTimer) {
  41188. this.activityTimer.ensureAborted();
  41189. }
  41190. };
  41191. ;
  41192. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41193. var _this = this;
  41194. return extend({}, errorCallbacks, {
  41195. message: function (message) {
  41196. _this.resetActivityCheck();
  41197. _this.emit('message', message);
  41198. },
  41199. ping: function () {
  41200. _this.send_event('pusher:pong', {});
  41201. },
  41202. activity: function () {
  41203. _this.resetActivityCheck();
  41204. },
  41205. error: function (error) {
  41206. _this.emit("error", { type: "WebSocketError", error: error });
  41207. },
  41208. closed: function () {
  41209. _this.abandonConnection();
  41210. if (_this.shouldRetry()) {
  41211. _this.retryIn(1000);
  41212. }
  41213. }
  41214. });
  41215. };
  41216. ;
  41217. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41218. var _this = this;
  41219. return extend({}, errorCallbacks, {
  41220. connected: function (handshake) {
  41221. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41222. _this.clearUnavailableTimer();
  41223. _this.setConnection(handshake.connection);
  41224. _this.socket_id = _this.connection.id;
  41225. _this.updateState("connected", { socket_id: _this.socket_id });
  41226. }
  41227. });
  41228. };
  41229. ;
  41230. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41231. var _this = this;
  41232. var withErrorEmitted = function (callback) {
  41233. return function (result) {
  41234. if (result.error) {
  41235. _this.emit("error", { type: "WebSocketError", error: result.error });
  41236. }
  41237. callback(result);
  41238. };
  41239. };
  41240. return {
  41241. tls_only: withErrorEmitted(function () {
  41242. _this.usingTLS = true;
  41243. _this.updateStrategy();
  41244. _this.retryIn(0);
  41245. }),
  41246. refused: withErrorEmitted(function () {
  41247. _this.disconnect();
  41248. }),
  41249. backoff: withErrorEmitted(function () {
  41250. _this.retryIn(1000);
  41251. }),
  41252. retry: withErrorEmitted(function () {
  41253. _this.retryIn(0);
  41254. })
  41255. };
  41256. };
  41257. ;
  41258. ConnectionManager.prototype.setConnection = function (connection) {
  41259. this.connection = connection;
  41260. for (var event in this.connectionCallbacks) {
  41261. this.connection.bind(event, this.connectionCallbacks[event]);
  41262. }
  41263. this.resetActivityCheck();
  41264. };
  41265. ;
  41266. ConnectionManager.prototype.abandonConnection = function () {
  41267. if (!this.connection) {
  41268. return;
  41269. }
  41270. this.stopActivityCheck();
  41271. for (var event in this.connectionCallbacks) {
  41272. this.connection.unbind(event, this.connectionCallbacks[event]);
  41273. }
  41274. var connection = this.connection;
  41275. this.connection = null;
  41276. return connection;
  41277. };
  41278. ConnectionManager.prototype.updateState = function (newState, data) {
  41279. var previousState = this.state;
  41280. this.state = newState;
  41281. if (previousState !== newState) {
  41282. var newStateDescription = newState;
  41283. if (newStateDescription === "connected") {
  41284. newStateDescription += " with new socket ID " + data.socket_id;
  41285. }
  41286. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41287. this.timeline.info({ state: newState, params: data });
  41288. this.emit('state_change', { previous: previousState, current: newState });
  41289. this.emit(newState, data);
  41290. }
  41291. };
  41292. ConnectionManager.prototype.shouldRetry = function () {
  41293. return this.state === "connecting" || this.state === "connected";
  41294. };
  41295. return ConnectionManager;
  41296. }(dispatcher));
  41297. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41298. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41299. var channels_Channels = (function () {
  41300. function Channels() {
  41301. this.channels = {};
  41302. }
  41303. Channels.prototype.add = function (name, pusher) {
  41304. if (!this.channels[name]) {
  41305. this.channels[name] = createChannel(name, pusher);
  41306. }
  41307. return this.channels[name];
  41308. };
  41309. Channels.prototype.all = function () {
  41310. return values(this.channels);
  41311. };
  41312. Channels.prototype.find = function (name) {
  41313. return this.channels[name];
  41314. };
  41315. Channels.prototype.remove = function (name) {
  41316. var channel = this.channels[name];
  41317. delete this.channels[name];
  41318. return channel;
  41319. };
  41320. Channels.prototype.disconnect = function () {
  41321. objectApply(this.channels, function (channel) {
  41322. channel.disconnect();
  41323. });
  41324. };
  41325. return Channels;
  41326. }());
  41327. /* harmony default export */ var channels = (channels_Channels);
  41328. function createChannel(name, pusher) {
  41329. if (name.indexOf('private-encrypted-') === 0) {
  41330. if (false) { var errorMsg; }
  41331. return factory.createEncryptedChannel(name, pusher);
  41332. }
  41333. else if (name.indexOf('private-') === 0) {
  41334. return factory.createPrivateChannel(name, pusher);
  41335. }
  41336. else if (name.indexOf('presence-') === 0) {
  41337. return factory.createPresenceChannel(name, pusher);
  41338. }
  41339. else {
  41340. return factory.createChannel(name, pusher);
  41341. }
  41342. }
  41343. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41344. var Factory = {
  41345. createChannels: function () {
  41346. return new channels();
  41347. },
  41348. createConnectionManager: function (key, options) {
  41349. return new connection_manager(key, options);
  41350. },
  41351. createChannel: function (name, pusher) {
  41352. return new channels_channel(name, pusher);
  41353. },
  41354. createPrivateChannel: function (name, pusher) {
  41355. return new private_channel(name, pusher);
  41356. },
  41357. createPresenceChannel: function (name, pusher) {
  41358. return new presence_channel(name, pusher);
  41359. },
  41360. createEncryptedChannel: function (name, pusher) {
  41361. return new encrypted_channel(name, pusher);
  41362. },
  41363. createTimelineSender: function (timeline, options) {
  41364. return new timeline_sender(timeline, options);
  41365. },
  41366. createAuthorizer: function (channel, options) {
  41367. if (options.authorizer) {
  41368. return options.authorizer(channel, options);
  41369. }
  41370. return new pusher_authorizer(channel, options);
  41371. },
  41372. createHandshake: function (transport, callback) {
  41373. return new connection_handshake(transport, callback);
  41374. },
  41375. createAssistantToTheTransportManager: function (manager, transport, options) {
  41376. return new assistant_to_the_transport_manager(manager, transport, options);
  41377. }
  41378. };
  41379. /* harmony default export */ var factory = (Factory);
  41380. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41381. var transport_manager_TransportManager = (function () {
  41382. function TransportManager(options) {
  41383. this.options = options || {};
  41384. this.livesLeft = this.options.lives || Infinity;
  41385. }
  41386. TransportManager.prototype.getAssistant = function (transport) {
  41387. return factory.createAssistantToTheTransportManager(this, transport, {
  41388. minPingDelay: this.options.minPingDelay,
  41389. maxPingDelay: this.options.maxPingDelay
  41390. });
  41391. };
  41392. TransportManager.prototype.isAlive = function () {
  41393. return this.livesLeft > 0;
  41394. };
  41395. TransportManager.prototype.reportDeath = function () {
  41396. this.livesLeft -= 1;
  41397. };
  41398. return TransportManager;
  41399. }());
  41400. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41401. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41402. var sequential_strategy_SequentialStrategy = (function () {
  41403. function SequentialStrategy(strategies, options) {
  41404. this.strategies = strategies;
  41405. this.loop = Boolean(options.loop);
  41406. this.failFast = Boolean(options.failFast);
  41407. this.timeout = options.timeout;
  41408. this.timeoutLimit = options.timeoutLimit;
  41409. }
  41410. SequentialStrategy.prototype.isSupported = function () {
  41411. return any(this.strategies, util.method("isSupported"));
  41412. };
  41413. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41414. var _this = this;
  41415. var strategies = this.strategies;
  41416. var current = 0;
  41417. var timeout = this.timeout;
  41418. var runner = null;
  41419. var tryNextStrategy = function (error, handshake) {
  41420. if (handshake) {
  41421. callback(null, handshake);
  41422. }
  41423. else {
  41424. current = current + 1;
  41425. if (_this.loop) {
  41426. current = current % strategies.length;
  41427. }
  41428. if (current < strategies.length) {
  41429. if (timeout) {
  41430. timeout = timeout * 2;
  41431. if (_this.timeoutLimit) {
  41432. timeout = Math.min(timeout, _this.timeoutLimit);
  41433. }
  41434. }
  41435. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41436. }
  41437. else {
  41438. callback(true);
  41439. }
  41440. }
  41441. };
  41442. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41443. return {
  41444. abort: function () {
  41445. runner.abort();
  41446. },
  41447. forceMinPriority: function (p) {
  41448. minPriority = p;
  41449. if (runner) {
  41450. runner.forceMinPriority(p);
  41451. }
  41452. }
  41453. };
  41454. };
  41455. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41456. var timer = null;
  41457. var runner = null;
  41458. if (options.timeout > 0) {
  41459. timer = new OneOffTimer(options.timeout, function () {
  41460. runner.abort();
  41461. callback(true);
  41462. });
  41463. }
  41464. runner = strategy.connect(minPriority, function (error, handshake) {
  41465. if (error && timer && timer.isRunning() && !options.failFast) {
  41466. return;
  41467. }
  41468. if (timer) {
  41469. timer.ensureAborted();
  41470. }
  41471. callback(error, handshake);
  41472. });
  41473. return {
  41474. abort: function () {
  41475. if (timer) {
  41476. timer.ensureAborted();
  41477. }
  41478. runner.abort();
  41479. },
  41480. forceMinPriority: function (p) {
  41481. runner.forceMinPriority(p);
  41482. }
  41483. };
  41484. };
  41485. return SequentialStrategy;
  41486. }());
  41487. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41488. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41489. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41490. function BestConnectedEverStrategy(strategies) {
  41491. this.strategies = strategies;
  41492. }
  41493. BestConnectedEverStrategy.prototype.isSupported = function () {
  41494. return any(this.strategies, util.method("isSupported"));
  41495. };
  41496. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41497. return connect(this.strategies, minPriority, function (i, runners) {
  41498. return function (error, handshake) {
  41499. runners[i].error = error;
  41500. if (error) {
  41501. if (allRunnersFailed(runners)) {
  41502. callback(true);
  41503. }
  41504. return;
  41505. }
  41506. apply(runners, function (runner) {
  41507. runner.forceMinPriority(handshake.transport.priority);
  41508. });
  41509. callback(null, handshake);
  41510. };
  41511. });
  41512. };
  41513. return BestConnectedEverStrategy;
  41514. }());
  41515. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41516. function connect(strategies, minPriority, callbackBuilder) {
  41517. var runners = map(strategies, function (strategy, i, _, rs) {
  41518. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41519. });
  41520. return {
  41521. abort: function () {
  41522. apply(runners, abortRunner);
  41523. },
  41524. forceMinPriority: function (p) {
  41525. apply(runners, function (runner) {
  41526. runner.forceMinPriority(p);
  41527. });
  41528. }
  41529. };
  41530. }
  41531. function allRunnersFailed(runners) {
  41532. return collections_all(runners, function (runner) {
  41533. return Boolean(runner.error);
  41534. });
  41535. }
  41536. function abortRunner(runner) {
  41537. if (!runner.error && !runner.aborted) {
  41538. runner.abort();
  41539. runner.aborted = true;
  41540. }
  41541. }
  41542. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41543. var cached_strategy_CachedStrategy = (function () {
  41544. function CachedStrategy(strategy, transports, options) {
  41545. this.strategy = strategy;
  41546. this.transports = transports;
  41547. this.ttl = options.ttl || 1800 * 1000;
  41548. this.usingTLS = options.useTLS;
  41549. this.timeline = options.timeline;
  41550. }
  41551. CachedStrategy.prototype.isSupported = function () {
  41552. return this.strategy.isSupported();
  41553. };
  41554. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41555. var usingTLS = this.usingTLS;
  41556. var info = fetchTransportCache(usingTLS);
  41557. var strategies = [this.strategy];
  41558. if (info && info.timestamp + this.ttl >= util.now()) {
  41559. var transport = this.transports[info.transport];
  41560. if (transport) {
  41561. this.timeline.info({
  41562. cached: true,
  41563. transport: info.transport,
  41564. latency: info.latency
  41565. });
  41566. strategies.push(new sequential_strategy([transport], {
  41567. timeout: info.latency * 2 + 1000,
  41568. failFast: true
  41569. }));
  41570. }
  41571. }
  41572. var startTimestamp = util.now();
  41573. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41574. if (error) {
  41575. flushTransportCache(usingTLS);
  41576. if (strategies.length > 0) {
  41577. startTimestamp = util.now();
  41578. runner = strategies.pop().connect(minPriority, cb);
  41579. }
  41580. else {
  41581. callback(error);
  41582. }
  41583. }
  41584. else {
  41585. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41586. callback(null, handshake);
  41587. }
  41588. });
  41589. return {
  41590. abort: function () {
  41591. runner.abort();
  41592. },
  41593. forceMinPriority: function (p) {
  41594. minPriority = p;
  41595. if (runner) {
  41596. runner.forceMinPriority(p);
  41597. }
  41598. }
  41599. };
  41600. };
  41601. return CachedStrategy;
  41602. }());
  41603. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41604. function getTransportCacheKey(usingTLS) {
  41605. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41606. }
  41607. function fetchTransportCache(usingTLS) {
  41608. var storage = runtime.getLocalStorage();
  41609. if (storage) {
  41610. try {
  41611. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41612. if (serializedCache) {
  41613. return JSON.parse(serializedCache);
  41614. }
  41615. }
  41616. catch (e) {
  41617. flushTransportCache(usingTLS);
  41618. }
  41619. }
  41620. return null;
  41621. }
  41622. function storeTransportCache(usingTLS, transport, latency) {
  41623. var storage = runtime.getLocalStorage();
  41624. if (storage) {
  41625. try {
  41626. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41627. timestamp: util.now(),
  41628. transport: transport,
  41629. latency: latency
  41630. });
  41631. }
  41632. catch (e) {
  41633. }
  41634. }
  41635. }
  41636. function flushTransportCache(usingTLS) {
  41637. var storage = runtime.getLocalStorage();
  41638. if (storage) {
  41639. try {
  41640. delete storage[getTransportCacheKey(usingTLS)];
  41641. }
  41642. catch (e) {
  41643. }
  41644. }
  41645. }
  41646. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41647. var delayed_strategy_DelayedStrategy = (function () {
  41648. function DelayedStrategy(strategy, _a) {
  41649. var number = _a.delay;
  41650. this.strategy = strategy;
  41651. this.options = { delay: number };
  41652. }
  41653. DelayedStrategy.prototype.isSupported = function () {
  41654. return this.strategy.isSupported();
  41655. };
  41656. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41657. var strategy = this.strategy;
  41658. var runner;
  41659. var timer = new OneOffTimer(this.options.delay, function () {
  41660. runner = strategy.connect(minPriority, callback);
  41661. });
  41662. return {
  41663. abort: function () {
  41664. timer.ensureAborted();
  41665. if (runner) {
  41666. runner.abort();
  41667. }
  41668. },
  41669. forceMinPriority: function (p) {
  41670. minPriority = p;
  41671. if (runner) {
  41672. runner.forceMinPriority(p);
  41673. }
  41674. }
  41675. };
  41676. };
  41677. return DelayedStrategy;
  41678. }());
  41679. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41680. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41681. var IfStrategy = (function () {
  41682. function IfStrategy(test, trueBranch, falseBranch) {
  41683. this.test = test;
  41684. this.trueBranch = trueBranch;
  41685. this.falseBranch = falseBranch;
  41686. }
  41687. IfStrategy.prototype.isSupported = function () {
  41688. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41689. return branch.isSupported();
  41690. };
  41691. IfStrategy.prototype.connect = function (minPriority, callback) {
  41692. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41693. return branch.connect(minPriority, callback);
  41694. };
  41695. return IfStrategy;
  41696. }());
  41697. /* harmony default export */ var if_strategy = (IfStrategy);
  41698. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41699. var FirstConnectedStrategy = (function () {
  41700. function FirstConnectedStrategy(strategy) {
  41701. this.strategy = strategy;
  41702. }
  41703. FirstConnectedStrategy.prototype.isSupported = function () {
  41704. return this.strategy.isSupported();
  41705. };
  41706. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41707. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41708. if (handshake) {
  41709. runner.abort();
  41710. }
  41711. callback(error, handshake);
  41712. });
  41713. return runner;
  41714. };
  41715. return FirstConnectedStrategy;
  41716. }());
  41717. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41718. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41719. function testSupportsStrategy(strategy) {
  41720. return function () {
  41721. return strategy.isSupported();
  41722. };
  41723. }
  41724. var getDefaultStrategy = function (config, defineTransport) {
  41725. var definedTransports = {};
  41726. function defineTransportStrategy(name, type, priority, options, manager) {
  41727. var transport = defineTransport(config, name, type, priority, options, manager);
  41728. definedTransports[name] = transport;
  41729. return transport;
  41730. }
  41731. var ws_options = {
  41732. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41733. hostTLS: config.wsHost + ":" + config.wssPort,
  41734. httpPath: config.wsPath
  41735. };
  41736. var wss_options = extend({}, ws_options, {
  41737. useTLS: true
  41738. });
  41739. var sockjs_options = {
  41740. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41741. hostTLS: config.httpHost + ":" + config.httpsPort,
  41742. httpPath: config.httpPath
  41743. };
  41744. var timeouts = {
  41745. loop: true,
  41746. timeout: 15000,
  41747. timeoutLimit: 60000
  41748. };
  41749. var ws_manager = new transport_manager({
  41750. lives: 2,
  41751. minPingDelay: 10000,
  41752. maxPingDelay: config.activity_timeout
  41753. });
  41754. var streaming_manager = new transport_manager({
  41755. lives: 2,
  41756. minPingDelay: 10000,
  41757. maxPingDelay: config.activity_timeout
  41758. });
  41759. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41760. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41761. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41762. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41763. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41764. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41765. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41766. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41767. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41768. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41769. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41770. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41771. 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);
  41772. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41773. var wsStrategy;
  41774. if (config.useTLS) {
  41775. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41776. }
  41777. else {
  41778. wsStrategy = new best_connected_ever_strategy([
  41779. ws_loop,
  41780. new delayed_strategy(wss_loop, { delay: 2000 }),
  41781. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41782. ]);
  41783. }
  41784. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41785. ttl: 1800000,
  41786. timeline: config.timeline,
  41787. useTLS: config.useTLS
  41788. });
  41789. };
  41790. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41791. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41792. /* harmony default export */ var transport_connection_initializer = (function () {
  41793. var self = this;
  41794. self.timeline.info(self.buildTimelineMessage({
  41795. transport: self.name + (self.options.useTLS ? "s" : "")
  41796. }));
  41797. if (self.hooks.isInitialized()) {
  41798. self.changeState("initialized");
  41799. }
  41800. else if (self.hooks.file) {
  41801. self.changeState("initializing");
  41802. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41803. if (self.hooks.isInitialized()) {
  41804. self.changeState("initialized");
  41805. callback(true);
  41806. }
  41807. else {
  41808. if (error) {
  41809. self.onError(error);
  41810. }
  41811. self.onClose();
  41812. callback(false);
  41813. }
  41814. });
  41815. }
  41816. else {
  41817. self.onClose();
  41818. }
  41819. });
  41820. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41821. var http_xdomain_request_hooks = {
  41822. getRequest: function (socket) {
  41823. var xdr = new window.XDomainRequest();
  41824. xdr.ontimeout = function () {
  41825. socket.emit("error", new RequestTimedOut());
  41826. socket.close();
  41827. };
  41828. xdr.onerror = function (e) {
  41829. socket.emit("error", e);
  41830. socket.close();
  41831. };
  41832. xdr.onprogress = function () {
  41833. if (xdr.responseText && xdr.responseText.length > 0) {
  41834. socket.onChunk(200, xdr.responseText);
  41835. }
  41836. };
  41837. xdr.onload = function () {
  41838. if (xdr.responseText && xdr.responseText.length > 0) {
  41839. socket.onChunk(200, xdr.responseText);
  41840. }
  41841. socket.emit("finished", 200);
  41842. socket.close();
  41843. };
  41844. return xdr;
  41845. },
  41846. abortRequest: function (xdr) {
  41847. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41848. xdr.abort();
  41849. }
  41850. };
  41851. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41852. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41853. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41854. var extendStatics = function (d, b) {
  41855. extendStatics = Object.setPrototypeOf ||
  41856. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41857. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41858. return extendStatics(d, b);
  41859. };
  41860. return function (d, b) {
  41861. extendStatics(d, b);
  41862. function __() { this.constructor = d; }
  41863. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41864. };
  41865. })();
  41866. var MAX_BUFFER_LENGTH = 256 * 1024;
  41867. var http_request_HTTPRequest = (function (_super) {
  41868. http_request_extends(HTTPRequest, _super);
  41869. function HTTPRequest(hooks, method, url) {
  41870. var _this = _super.call(this) || this;
  41871. _this.hooks = hooks;
  41872. _this.method = method;
  41873. _this.url = url;
  41874. return _this;
  41875. }
  41876. HTTPRequest.prototype.start = function (payload) {
  41877. var _this = this;
  41878. this.position = 0;
  41879. this.xhr = this.hooks.getRequest(this);
  41880. this.unloader = function () {
  41881. _this.close();
  41882. };
  41883. runtime.addUnloadListener(this.unloader);
  41884. this.xhr.open(this.method, this.url, true);
  41885. if (this.xhr.setRequestHeader) {
  41886. this.xhr.setRequestHeader("Content-Type", "application/json");
  41887. }
  41888. this.xhr.send(payload);
  41889. };
  41890. HTTPRequest.prototype.close = function () {
  41891. if (this.unloader) {
  41892. runtime.removeUnloadListener(this.unloader);
  41893. this.unloader = null;
  41894. }
  41895. if (this.xhr) {
  41896. this.hooks.abortRequest(this.xhr);
  41897. this.xhr = null;
  41898. }
  41899. };
  41900. HTTPRequest.prototype.onChunk = function (status, data) {
  41901. while (true) {
  41902. var chunk = this.advanceBuffer(data);
  41903. if (chunk) {
  41904. this.emit("chunk", { status: status, data: chunk });
  41905. }
  41906. else {
  41907. break;
  41908. }
  41909. }
  41910. if (this.isBufferTooLong(data)) {
  41911. this.emit("buffer_too_long");
  41912. }
  41913. };
  41914. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41915. var unreadData = buffer.slice(this.position);
  41916. var endOfLinePosition = unreadData.indexOf("\n");
  41917. if (endOfLinePosition !== -1) {
  41918. this.position += endOfLinePosition + 1;
  41919. return unreadData.slice(0, endOfLinePosition);
  41920. }
  41921. else {
  41922. return null;
  41923. }
  41924. };
  41925. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41926. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41927. };
  41928. return HTTPRequest;
  41929. }(dispatcher));
  41930. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41931. // CONCATENATED MODULE: ./src/core/http/state.ts
  41932. var State;
  41933. (function (State) {
  41934. State[State["CONNECTING"] = 0] = "CONNECTING";
  41935. State[State["OPEN"] = 1] = "OPEN";
  41936. State[State["CLOSED"] = 3] = "CLOSED";
  41937. })(State || (State = {}));
  41938. /* harmony default export */ var state = (State);
  41939. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41940. var autoIncrement = 1;
  41941. var http_socket_HTTPSocket = (function () {
  41942. function HTTPSocket(hooks, url) {
  41943. this.hooks = hooks;
  41944. this.session = randomNumber(1000) + "/" + randomString(8);
  41945. this.location = getLocation(url);
  41946. this.readyState = state.CONNECTING;
  41947. this.openStream();
  41948. }
  41949. HTTPSocket.prototype.send = function (payload) {
  41950. return this.sendRaw(JSON.stringify([payload]));
  41951. };
  41952. HTTPSocket.prototype.ping = function () {
  41953. this.hooks.sendHeartbeat(this);
  41954. };
  41955. HTTPSocket.prototype.close = function (code, reason) {
  41956. this.onClose(code, reason, true);
  41957. };
  41958. HTTPSocket.prototype.sendRaw = function (payload) {
  41959. if (this.readyState === state.OPEN) {
  41960. try {
  41961. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41962. return true;
  41963. }
  41964. catch (e) {
  41965. return false;
  41966. }
  41967. }
  41968. else {
  41969. return false;
  41970. }
  41971. };
  41972. HTTPSocket.prototype.reconnect = function () {
  41973. this.closeStream();
  41974. this.openStream();
  41975. };
  41976. ;
  41977. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41978. this.closeStream();
  41979. this.readyState = state.CLOSED;
  41980. if (this.onclose) {
  41981. this.onclose({
  41982. code: code,
  41983. reason: reason,
  41984. wasClean: wasClean
  41985. });
  41986. }
  41987. };
  41988. HTTPSocket.prototype.onChunk = function (chunk) {
  41989. if (chunk.status !== 200) {
  41990. return;
  41991. }
  41992. if (this.readyState === state.OPEN) {
  41993. this.onActivity();
  41994. }
  41995. var payload;
  41996. var type = chunk.data.slice(0, 1);
  41997. switch (type) {
  41998. case 'o':
  41999. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42000. this.onOpen(payload);
  42001. break;
  42002. case 'a':
  42003. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42004. for (var i = 0; i < payload.length; i++) {
  42005. this.onEvent(payload[i]);
  42006. }
  42007. break;
  42008. case 'm':
  42009. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42010. this.onEvent(payload);
  42011. break;
  42012. case 'h':
  42013. this.hooks.onHeartbeat(this);
  42014. break;
  42015. case 'c':
  42016. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42017. this.onClose(payload[0], payload[1], true);
  42018. break;
  42019. }
  42020. };
  42021. HTTPSocket.prototype.onOpen = function (options) {
  42022. if (this.readyState === state.CONNECTING) {
  42023. if (options && options.hostname) {
  42024. this.location.base = replaceHost(this.location.base, options.hostname);
  42025. }
  42026. this.readyState = state.OPEN;
  42027. if (this.onopen) {
  42028. this.onopen();
  42029. }
  42030. }
  42031. else {
  42032. this.onClose(1006, "Server lost session", true);
  42033. }
  42034. };
  42035. HTTPSocket.prototype.onEvent = function (event) {
  42036. if (this.readyState === state.OPEN && this.onmessage) {
  42037. this.onmessage({ data: event });
  42038. }
  42039. };
  42040. HTTPSocket.prototype.onActivity = function () {
  42041. if (this.onactivity) {
  42042. this.onactivity();
  42043. }
  42044. };
  42045. HTTPSocket.prototype.onError = function (error) {
  42046. if (this.onerror) {
  42047. this.onerror(error);
  42048. }
  42049. };
  42050. HTTPSocket.prototype.openStream = function () {
  42051. var _this = this;
  42052. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42053. this.stream.bind("chunk", function (chunk) {
  42054. _this.onChunk(chunk);
  42055. });
  42056. this.stream.bind("finished", function (status) {
  42057. _this.hooks.onFinished(_this, status);
  42058. });
  42059. this.stream.bind("buffer_too_long", function () {
  42060. _this.reconnect();
  42061. });
  42062. try {
  42063. this.stream.start();
  42064. }
  42065. catch (error) {
  42066. util.defer(function () {
  42067. _this.onError(error);
  42068. _this.onClose(1006, "Could not start streaming", false);
  42069. });
  42070. }
  42071. };
  42072. HTTPSocket.prototype.closeStream = function () {
  42073. if (this.stream) {
  42074. this.stream.unbind_all();
  42075. this.stream.close();
  42076. this.stream = null;
  42077. }
  42078. };
  42079. return HTTPSocket;
  42080. }());
  42081. function getLocation(url) {
  42082. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42083. return {
  42084. base: parts[1],
  42085. queryString: parts[2]
  42086. };
  42087. }
  42088. function getSendURL(url, session) {
  42089. return url.base + "/" + session + "/xhr_send";
  42090. }
  42091. function getUniqueURL(url) {
  42092. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42093. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42094. }
  42095. function replaceHost(url, hostname) {
  42096. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42097. return urlParts[1] + hostname + urlParts[3];
  42098. }
  42099. function randomNumber(max) {
  42100. return Math.floor(Math.random() * max);
  42101. }
  42102. function randomString(length) {
  42103. var result = [];
  42104. for (var i = 0; i < length; i++) {
  42105. result.push(randomNumber(32).toString(32));
  42106. }
  42107. return result.join('');
  42108. }
  42109. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42110. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42111. var http_streaming_socket_hooks = {
  42112. getReceiveURL: function (url, session) {
  42113. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42114. },
  42115. onHeartbeat: function (socket) {
  42116. socket.sendRaw("[]");
  42117. },
  42118. sendHeartbeat: function (socket) {
  42119. socket.sendRaw("[]");
  42120. },
  42121. onFinished: function (socket, status) {
  42122. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42123. }
  42124. };
  42125. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42126. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42127. var http_polling_socket_hooks = {
  42128. getReceiveURL: function (url, session) {
  42129. return url.base + "/" + session + "/xhr" + url.queryString;
  42130. },
  42131. onHeartbeat: function () {
  42132. },
  42133. sendHeartbeat: function (socket) {
  42134. socket.sendRaw("[]");
  42135. },
  42136. onFinished: function (socket, status) {
  42137. if (status === 200) {
  42138. socket.reconnect();
  42139. }
  42140. else {
  42141. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42142. }
  42143. }
  42144. };
  42145. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42146. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42147. var http_xhr_request_hooks = {
  42148. getRequest: function (socket) {
  42149. var Constructor = runtime.getXHRAPI();
  42150. var xhr = new Constructor();
  42151. xhr.onreadystatechange = xhr.onprogress = function () {
  42152. switch (xhr.readyState) {
  42153. case 3:
  42154. if (xhr.responseText && xhr.responseText.length > 0) {
  42155. socket.onChunk(xhr.status, xhr.responseText);
  42156. }
  42157. break;
  42158. case 4:
  42159. if (xhr.responseText && xhr.responseText.length > 0) {
  42160. socket.onChunk(xhr.status, xhr.responseText);
  42161. }
  42162. socket.emit("finished", xhr.status);
  42163. socket.close();
  42164. break;
  42165. }
  42166. };
  42167. return xhr;
  42168. },
  42169. abortRequest: function (xhr) {
  42170. xhr.onreadystatechange = null;
  42171. xhr.abort();
  42172. }
  42173. };
  42174. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42175. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42176. var HTTP = {
  42177. createStreamingSocket: function (url) {
  42178. return this.createSocket(http_streaming_socket, url);
  42179. },
  42180. createPollingSocket: function (url) {
  42181. return this.createSocket(http_polling_socket, url);
  42182. },
  42183. createSocket: function (hooks, url) {
  42184. return new http_socket(hooks, url);
  42185. },
  42186. createXHR: function (method, url) {
  42187. return this.createRequest(http_xhr_request, method, url);
  42188. },
  42189. createRequest: function (hooks, method, url) {
  42190. return new http_request(hooks, method, url);
  42191. }
  42192. };
  42193. /* harmony default export */ var http_http = (HTTP);
  42194. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42195. http_http.createXDR = function (method, url) {
  42196. return this.createRequest(http_xdomain_request, method, url);
  42197. };
  42198. /* harmony default export */ var web_http_http = (http_http);
  42199. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42200. var Runtime = {
  42201. nextAuthCallbackID: 1,
  42202. auth_callbacks: {},
  42203. ScriptReceivers: ScriptReceivers,
  42204. DependenciesReceivers: DependenciesReceivers,
  42205. getDefaultStrategy: default_strategy,
  42206. Transports: transports_transports,
  42207. transportConnectionInitializer: transport_connection_initializer,
  42208. HTTPFactory: web_http_http,
  42209. TimelineTransport: jsonp_timeline,
  42210. getXHRAPI: function () {
  42211. return window.XMLHttpRequest;
  42212. },
  42213. getWebSocketAPI: function () {
  42214. return window.WebSocket || window.MozWebSocket;
  42215. },
  42216. setup: function (PusherClass) {
  42217. var _this = this;
  42218. window.Pusher = PusherClass;
  42219. var initializeOnDocumentBody = function () {
  42220. _this.onDocumentBody(PusherClass.ready);
  42221. };
  42222. if (!window.JSON) {
  42223. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42224. }
  42225. else {
  42226. initializeOnDocumentBody();
  42227. }
  42228. },
  42229. getDocument: function () {
  42230. return document;
  42231. },
  42232. getProtocol: function () {
  42233. return this.getDocument().location.protocol;
  42234. },
  42235. getAuthorizers: function () {
  42236. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42237. },
  42238. onDocumentBody: function (callback) {
  42239. var _this = this;
  42240. if (document.body) {
  42241. callback();
  42242. }
  42243. else {
  42244. setTimeout(function () {
  42245. _this.onDocumentBody(callback);
  42246. }, 0);
  42247. }
  42248. },
  42249. createJSONPRequest: function (url, data) {
  42250. return new jsonp_request(url, data);
  42251. },
  42252. createScriptRequest: function (src) {
  42253. return new script_request(src);
  42254. },
  42255. getLocalStorage: function () {
  42256. try {
  42257. return window.localStorage;
  42258. }
  42259. catch (e) {
  42260. return undefined;
  42261. }
  42262. },
  42263. createXHR: function () {
  42264. if (this.getXHRAPI()) {
  42265. return this.createXMLHttpRequest();
  42266. }
  42267. else {
  42268. return this.createMicrosoftXHR();
  42269. }
  42270. },
  42271. createXMLHttpRequest: function () {
  42272. var Constructor = this.getXHRAPI();
  42273. return new Constructor();
  42274. },
  42275. createMicrosoftXHR: function () {
  42276. return new ActiveXObject("Microsoft.XMLHTTP");
  42277. },
  42278. getNetwork: function () {
  42279. return net_info_Network;
  42280. },
  42281. createWebSocket: function (url) {
  42282. var Constructor = this.getWebSocketAPI();
  42283. return new Constructor(url);
  42284. },
  42285. createSocketRequest: function (method, url) {
  42286. if (this.isXHRSupported()) {
  42287. return this.HTTPFactory.createXHR(method, url);
  42288. }
  42289. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42290. return this.HTTPFactory.createXDR(method, url);
  42291. }
  42292. else {
  42293. throw "Cross-origin HTTP requests are not supported";
  42294. }
  42295. },
  42296. isXHRSupported: function () {
  42297. var Constructor = this.getXHRAPI();
  42298. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42299. },
  42300. isXDRSupported: function (useTLS) {
  42301. var protocol = useTLS ? "https:" : "http:";
  42302. var documentProtocol = this.getProtocol();
  42303. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42304. },
  42305. addUnloadListener: function (listener) {
  42306. if (window.addEventListener !== undefined) {
  42307. window.addEventListener("unload", listener, false);
  42308. }
  42309. else if (window.attachEvent !== undefined) {
  42310. window.attachEvent("onunload", listener);
  42311. }
  42312. },
  42313. removeUnloadListener: function (listener) {
  42314. if (window.addEventListener !== undefined) {
  42315. window.removeEventListener("unload", listener, false);
  42316. }
  42317. else if (window.detachEvent !== undefined) {
  42318. window.detachEvent("onunload", listener);
  42319. }
  42320. }
  42321. };
  42322. /* harmony default export */ var runtime = (Runtime);
  42323. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42324. var TimelineLevel;
  42325. (function (TimelineLevel) {
  42326. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42327. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42328. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42329. })(TimelineLevel || (TimelineLevel = {}));
  42330. /* harmony default export */ var timeline_level = (TimelineLevel);
  42331. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42332. var timeline_Timeline = (function () {
  42333. function Timeline(key, session, options) {
  42334. this.key = key;
  42335. this.session = session;
  42336. this.events = [];
  42337. this.options = options || {};
  42338. this.sent = 0;
  42339. this.uniqueID = 0;
  42340. }
  42341. Timeline.prototype.log = function (level, event) {
  42342. if (level <= this.options.level) {
  42343. this.events.push(extend({}, event, { timestamp: util.now() }));
  42344. if (this.options.limit && this.events.length > this.options.limit) {
  42345. this.events.shift();
  42346. }
  42347. }
  42348. };
  42349. Timeline.prototype.error = function (event) {
  42350. this.log(timeline_level.ERROR, event);
  42351. };
  42352. Timeline.prototype.info = function (event) {
  42353. this.log(timeline_level.INFO, event);
  42354. };
  42355. Timeline.prototype.debug = function (event) {
  42356. this.log(timeline_level.DEBUG, event);
  42357. };
  42358. Timeline.prototype.isEmpty = function () {
  42359. return this.events.length === 0;
  42360. };
  42361. Timeline.prototype.send = function (sendfn, callback) {
  42362. var _this = this;
  42363. var data = extend({
  42364. session: this.session,
  42365. bundle: this.sent + 1,
  42366. key: this.key,
  42367. lib: "js",
  42368. version: this.options.version,
  42369. cluster: this.options.cluster,
  42370. features: this.options.features,
  42371. timeline: this.events
  42372. }, this.options.params);
  42373. this.events = [];
  42374. sendfn(data, function (error, result) {
  42375. if (!error) {
  42376. _this.sent++;
  42377. }
  42378. if (callback) {
  42379. callback(error, result);
  42380. }
  42381. });
  42382. return true;
  42383. };
  42384. Timeline.prototype.generateUniqueID = function () {
  42385. this.uniqueID++;
  42386. return this.uniqueID;
  42387. };
  42388. return Timeline;
  42389. }());
  42390. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42391. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42392. var transport_strategy_TransportStrategy = (function () {
  42393. function TransportStrategy(name, priority, transport, options) {
  42394. this.name = name;
  42395. this.priority = priority;
  42396. this.transport = transport;
  42397. this.options = options || {};
  42398. }
  42399. TransportStrategy.prototype.isSupported = function () {
  42400. return this.transport.isSupported({
  42401. useTLS: this.options.useTLS
  42402. });
  42403. };
  42404. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42405. var _this = this;
  42406. if (!this.isSupported()) {
  42407. return failAttempt(new UnsupportedStrategy(), callback);
  42408. }
  42409. else if (this.priority < minPriority) {
  42410. return failAttempt(new TransportPriorityTooLow(), callback);
  42411. }
  42412. var connected = false;
  42413. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42414. var handshake = null;
  42415. var onInitialized = function () {
  42416. transport.unbind("initialized", onInitialized);
  42417. transport.connect();
  42418. };
  42419. var onOpen = function () {
  42420. handshake = factory.createHandshake(transport, function (result) {
  42421. connected = true;
  42422. unbindListeners();
  42423. callback(null, result);
  42424. });
  42425. };
  42426. var onError = function (error) {
  42427. unbindListeners();
  42428. callback(error);
  42429. };
  42430. var onClosed = function () {
  42431. unbindListeners();
  42432. var serializedTransport;
  42433. serializedTransport = safeJSONStringify(transport);
  42434. callback(new TransportClosed(serializedTransport));
  42435. };
  42436. var unbindListeners = function () {
  42437. transport.unbind("initialized", onInitialized);
  42438. transport.unbind("open", onOpen);
  42439. transport.unbind("error", onError);
  42440. transport.unbind("closed", onClosed);
  42441. };
  42442. transport.bind("initialized", onInitialized);
  42443. transport.bind("open", onOpen);
  42444. transport.bind("error", onError);
  42445. transport.bind("closed", onClosed);
  42446. transport.initialize();
  42447. return {
  42448. abort: function () {
  42449. if (connected) {
  42450. return;
  42451. }
  42452. unbindListeners();
  42453. if (handshake) {
  42454. handshake.close();
  42455. }
  42456. else {
  42457. transport.close();
  42458. }
  42459. },
  42460. forceMinPriority: function (p) {
  42461. if (connected) {
  42462. return;
  42463. }
  42464. if (_this.priority < p) {
  42465. if (handshake) {
  42466. handshake.close();
  42467. }
  42468. else {
  42469. transport.close();
  42470. }
  42471. }
  42472. }
  42473. };
  42474. };
  42475. return TransportStrategy;
  42476. }());
  42477. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42478. function failAttempt(error, callback) {
  42479. util.defer(function () {
  42480. callback(error);
  42481. });
  42482. return {
  42483. abort: function () { },
  42484. forceMinPriority: function () { }
  42485. };
  42486. }
  42487. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42488. var strategy_builder_Transports = runtime.Transports;
  42489. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42490. var transportClass = strategy_builder_Transports[type];
  42491. if (!transportClass) {
  42492. throw new UnsupportedTransport(type);
  42493. }
  42494. var enabled = (!config.enabledTransports ||
  42495. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42496. (!config.disabledTransports ||
  42497. arrayIndexOf(config.disabledTransports, name) === -1);
  42498. var transport;
  42499. if (enabled) {
  42500. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42501. key: config.key,
  42502. useTLS: config.useTLS,
  42503. timeline: config.timeline,
  42504. ignoreNullOrigin: config.ignoreNullOrigin
  42505. }, options));
  42506. }
  42507. else {
  42508. transport = strategy_builder_UnsupportedStrategy;
  42509. }
  42510. return transport;
  42511. };
  42512. var strategy_builder_UnsupportedStrategy = {
  42513. isSupported: function () {
  42514. return false;
  42515. },
  42516. connect: function (_, callback) {
  42517. var deferred = util.defer(function () {
  42518. callback(new UnsupportedStrategy());
  42519. });
  42520. return {
  42521. abort: function () {
  42522. deferred.ensureAborted();
  42523. },
  42524. forceMinPriority: function () { }
  42525. };
  42526. }
  42527. };
  42528. // CONCATENATED MODULE: ./src/core/config.ts
  42529. var getGlobalConfig = function () {
  42530. return {
  42531. wsHost: defaults.host,
  42532. wsPort: defaults.ws_port,
  42533. wssPort: defaults.wss_port,
  42534. wsPath: defaults.ws_path,
  42535. httpHost: defaults.sockjs_host,
  42536. httpPort: defaults.sockjs_http_port,
  42537. httpsPort: defaults.sockjs_https_port,
  42538. httpPath: defaults.sockjs_path,
  42539. statsHost: defaults.stats_host,
  42540. authEndpoint: defaults.channel_auth_endpoint,
  42541. authTransport: defaults.channel_auth_transport,
  42542. activity_timeout: defaults.activity_timeout,
  42543. pong_timeout: defaults.pong_timeout,
  42544. unavailable_timeout: defaults.unavailable_timeout
  42545. };
  42546. };
  42547. var getClusterConfig = function (clusterName) {
  42548. return {
  42549. wsHost: 'ws-' + clusterName + '.pusher.com',
  42550. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42551. };
  42552. };
  42553. // CONCATENATED MODULE: ./src/core/pusher.ts
  42554. var pusher_Pusher = (function () {
  42555. function Pusher(app_key, options) {
  42556. var _this = this;
  42557. checkAppKey(app_key);
  42558. options = options || {};
  42559. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42560. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42561. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42562. }
  42563. this.key = app_key;
  42564. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42565. this.channels = factory.createChannels();
  42566. this.global_emitter = new dispatcher();
  42567. this.sessionID = Math.floor(Math.random() * 1000000000);
  42568. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42569. cluster: this.config.cluster,
  42570. features: Pusher.getClientFeatures(),
  42571. params: this.config.timelineParams || {},
  42572. limit: 50,
  42573. level: timeline_level.INFO,
  42574. version: defaults.VERSION
  42575. });
  42576. if (!this.config.disableStats) {
  42577. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42578. host: this.config.statsHost,
  42579. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42580. });
  42581. }
  42582. var getStrategy = function (options) {
  42583. var config = extend({}, _this.config, options);
  42584. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42585. };
  42586. this.connection = factory.createConnectionManager(this.key, extend({
  42587. getStrategy: getStrategy,
  42588. timeline: this.timeline,
  42589. activityTimeout: this.config.activity_timeout,
  42590. pongTimeout: this.config.pong_timeout,
  42591. unavailableTimeout: this.config.unavailable_timeout
  42592. }, this.config, { useTLS: this.shouldUseTLS() }));
  42593. this.connection.bind('connected', function () {
  42594. _this.subscribeAll();
  42595. if (_this.timelineSender) {
  42596. _this.timelineSender.send(_this.connection.isUsingTLS());
  42597. }
  42598. });
  42599. this.connection.bind('message', function (event) {
  42600. var eventName = event.event;
  42601. var internal = eventName.indexOf('pusher_internal:') === 0;
  42602. if (event.channel) {
  42603. var channel = _this.channel(event.channel);
  42604. if (channel) {
  42605. channel.handleEvent(event);
  42606. }
  42607. }
  42608. if (!internal) {
  42609. _this.global_emitter.emit(event.event, event.data);
  42610. }
  42611. });
  42612. this.connection.bind('connecting', function () {
  42613. _this.channels.disconnect();
  42614. });
  42615. this.connection.bind('disconnected', function () {
  42616. _this.channels.disconnect();
  42617. });
  42618. this.connection.bind('error', function (err) {
  42619. logger.warn(err);
  42620. });
  42621. Pusher.instances.push(this);
  42622. this.timeline.info({ instances: Pusher.instances.length });
  42623. if (Pusher.isReady) {
  42624. this.connect();
  42625. }
  42626. }
  42627. Pusher.ready = function () {
  42628. Pusher.isReady = true;
  42629. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42630. Pusher.instances[i].connect();
  42631. }
  42632. };
  42633. Pusher.getClientFeatures = function () {
  42634. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42635. return t.isSupported({});
  42636. }));
  42637. };
  42638. Pusher.prototype.channel = function (name) {
  42639. return this.channels.find(name);
  42640. };
  42641. Pusher.prototype.allChannels = function () {
  42642. return this.channels.all();
  42643. };
  42644. Pusher.prototype.connect = function () {
  42645. this.connection.connect();
  42646. if (this.timelineSender) {
  42647. if (!this.timelineSenderTimer) {
  42648. var usingTLS = this.connection.isUsingTLS();
  42649. var timelineSender = this.timelineSender;
  42650. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42651. timelineSender.send(usingTLS);
  42652. });
  42653. }
  42654. }
  42655. };
  42656. Pusher.prototype.disconnect = function () {
  42657. this.connection.disconnect();
  42658. if (this.timelineSenderTimer) {
  42659. this.timelineSenderTimer.ensureAborted();
  42660. this.timelineSenderTimer = null;
  42661. }
  42662. };
  42663. Pusher.prototype.bind = function (event_name, callback, context) {
  42664. this.global_emitter.bind(event_name, callback, context);
  42665. return this;
  42666. };
  42667. Pusher.prototype.unbind = function (event_name, callback, context) {
  42668. this.global_emitter.unbind(event_name, callback, context);
  42669. return this;
  42670. };
  42671. Pusher.prototype.bind_global = function (callback) {
  42672. this.global_emitter.bind_global(callback);
  42673. return this;
  42674. };
  42675. Pusher.prototype.unbind_global = function (callback) {
  42676. this.global_emitter.unbind_global(callback);
  42677. return this;
  42678. };
  42679. Pusher.prototype.unbind_all = function (callback) {
  42680. this.global_emitter.unbind_all();
  42681. return this;
  42682. };
  42683. Pusher.prototype.subscribeAll = function () {
  42684. var channelName;
  42685. for (channelName in this.channels.channels) {
  42686. if (this.channels.channels.hasOwnProperty(channelName)) {
  42687. this.subscribe(channelName);
  42688. }
  42689. }
  42690. };
  42691. Pusher.prototype.subscribe = function (channel_name) {
  42692. var channel = this.channels.add(channel_name, this);
  42693. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42694. channel.reinstateSubscription();
  42695. }
  42696. else if (!channel.subscriptionPending &&
  42697. this.connection.state === 'connected') {
  42698. channel.subscribe();
  42699. }
  42700. return channel;
  42701. };
  42702. Pusher.prototype.unsubscribe = function (channel_name) {
  42703. var channel = this.channels.find(channel_name);
  42704. if (channel && channel.subscriptionPending) {
  42705. channel.cancelSubscription();
  42706. }
  42707. else {
  42708. channel = this.channels.remove(channel_name);
  42709. if (channel && this.connection.state === 'connected') {
  42710. channel.unsubscribe();
  42711. }
  42712. }
  42713. };
  42714. Pusher.prototype.send_event = function (event_name, data, channel) {
  42715. return this.connection.send_event(event_name, data, channel);
  42716. };
  42717. Pusher.prototype.shouldUseTLS = function () {
  42718. if (runtime.getProtocol() === 'https:') {
  42719. return true;
  42720. }
  42721. else if (this.config.forceTLS === true) {
  42722. return true;
  42723. }
  42724. else {
  42725. return Boolean(this.config.encrypted);
  42726. }
  42727. };
  42728. Pusher.instances = [];
  42729. Pusher.isReady = false;
  42730. Pusher.logToConsole = false;
  42731. Pusher.Runtime = runtime;
  42732. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42733. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42734. Pusher.auth_callbacks = runtime.auth_callbacks;
  42735. return Pusher;
  42736. }());
  42737. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42738. function checkAppKey(key) {
  42739. if (key === null || key === undefined) {
  42740. throw 'You must pass your app key when you instantiate Pusher.';
  42741. }
  42742. }
  42743. runtime.setup(pusher_Pusher);
  42744. /***/ })
  42745. /******/ ]);
  42746. });
  42747. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42748. /***/ }),
  42749. /***/ "./node_modules/setimmediate/setImmediate.js":
  42750. /*!***************************************************!*\
  42751. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42752. \***************************************************/
  42753. /*! no static exports found */
  42754. /***/ (function(module, exports, __webpack_require__) {
  42755. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42756. "use strict";
  42757. if (global.setImmediate) {
  42758. return;
  42759. }
  42760. var nextHandle = 1; // Spec says greater than zero
  42761. var tasksByHandle = {};
  42762. var currentlyRunningATask = false;
  42763. var doc = global.document;
  42764. var registerImmediate;
  42765. function setImmediate(callback) {
  42766. // Callback can either be a function or a string
  42767. if (typeof callback !== "function") {
  42768. callback = new Function("" + callback);
  42769. }
  42770. // Copy function arguments
  42771. var args = new Array(arguments.length - 1);
  42772. for (var i = 0; i < args.length; i++) {
  42773. args[i] = arguments[i + 1];
  42774. }
  42775. // Store and register the task
  42776. var task = { callback: callback, args: args };
  42777. tasksByHandle[nextHandle] = task;
  42778. registerImmediate(nextHandle);
  42779. return nextHandle++;
  42780. }
  42781. function clearImmediate(handle) {
  42782. delete tasksByHandle[handle];
  42783. }
  42784. function run(task) {
  42785. var callback = task.callback;
  42786. var args = task.args;
  42787. switch (args.length) {
  42788. case 0:
  42789. callback();
  42790. break;
  42791. case 1:
  42792. callback(args[0]);
  42793. break;
  42794. case 2:
  42795. callback(args[0], args[1]);
  42796. break;
  42797. case 3:
  42798. callback(args[0], args[1], args[2]);
  42799. break;
  42800. default:
  42801. callback.apply(undefined, args);
  42802. break;
  42803. }
  42804. }
  42805. function runIfPresent(handle) {
  42806. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42807. // So if we're currently running a task, we'll need to delay this invocation.
  42808. if (currentlyRunningATask) {
  42809. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42810. // "too much recursion" error.
  42811. setTimeout(runIfPresent, 0, handle);
  42812. } else {
  42813. var task = tasksByHandle[handle];
  42814. if (task) {
  42815. currentlyRunningATask = true;
  42816. try {
  42817. run(task);
  42818. } finally {
  42819. clearImmediate(handle);
  42820. currentlyRunningATask = false;
  42821. }
  42822. }
  42823. }
  42824. }
  42825. function installNextTickImplementation() {
  42826. registerImmediate = function(handle) {
  42827. process.nextTick(function () { runIfPresent(handle); });
  42828. };
  42829. }
  42830. function canUsePostMessage() {
  42831. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42832. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42833. if (global.postMessage && !global.importScripts) {
  42834. var postMessageIsAsynchronous = true;
  42835. var oldOnMessage = global.onmessage;
  42836. global.onmessage = function() {
  42837. postMessageIsAsynchronous = false;
  42838. };
  42839. global.postMessage("", "*");
  42840. global.onmessage = oldOnMessage;
  42841. return postMessageIsAsynchronous;
  42842. }
  42843. }
  42844. function installPostMessageImplementation() {
  42845. // Installs an event handler on `global` for the `message` event: see
  42846. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42847. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42848. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42849. var onGlobalMessage = function(event) {
  42850. if (event.source === global &&
  42851. typeof event.data === "string" &&
  42852. event.data.indexOf(messagePrefix) === 0) {
  42853. runIfPresent(+event.data.slice(messagePrefix.length));
  42854. }
  42855. };
  42856. if (global.addEventListener) {
  42857. global.addEventListener("message", onGlobalMessage, false);
  42858. } else {
  42859. global.attachEvent("onmessage", onGlobalMessage);
  42860. }
  42861. registerImmediate = function(handle) {
  42862. global.postMessage(messagePrefix + handle, "*");
  42863. };
  42864. }
  42865. function installMessageChannelImplementation() {
  42866. var channel = new MessageChannel();
  42867. channel.port1.onmessage = function(event) {
  42868. var handle = event.data;
  42869. runIfPresent(handle);
  42870. };
  42871. registerImmediate = function(handle) {
  42872. channel.port2.postMessage(handle);
  42873. };
  42874. }
  42875. function installReadyStateChangeImplementation() {
  42876. var html = doc.documentElement;
  42877. registerImmediate = function(handle) {
  42878. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42879. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42880. var script = doc.createElement("script");
  42881. script.onreadystatechange = function () {
  42882. runIfPresent(handle);
  42883. script.onreadystatechange = null;
  42884. html.removeChild(script);
  42885. script = null;
  42886. };
  42887. html.appendChild(script);
  42888. };
  42889. }
  42890. function installSetTimeoutImplementation() {
  42891. registerImmediate = function(handle) {
  42892. setTimeout(runIfPresent, 0, handle);
  42893. };
  42894. }
  42895. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42896. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42897. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42898. // Don't get fooled by e.g. browserify environments.
  42899. if ({}.toString.call(global.process) === "[object process]") {
  42900. // For Node.js before 0.9
  42901. installNextTickImplementation();
  42902. } else if (canUsePostMessage()) {
  42903. // For non-IE10 modern browsers
  42904. installPostMessageImplementation();
  42905. } else if (global.MessageChannel) {
  42906. // For web workers, where supported
  42907. installMessageChannelImplementation();
  42908. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42909. // For IE 6–8
  42910. installReadyStateChangeImplementation();
  42911. } else {
  42912. // For older browsers
  42913. installSetTimeoutImplementation();
  42914. }
  42915. attachTo.setImmediate = setImmediate;
  42916. attachTo.clearImmediate = clearImmediate;
  42917. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42918. /* 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")))
  42919. /***/ }),
  42920. /***/ "./node_modules/timers-browserify/main.js":
  42921. /*!************************************************!*\
  42922. !*** ./node_modules/timers-browserify/main.js ***!
  42923. \************************************************/
  42924. /*! no static exports found */
  42925. /***/ (function(module, exports, __webpack_require__) {
  42926. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42927. (typeof self !== "undefined" && self) ||
  42928. window;
  42929. var apply = Function.prototype.apply;
  42930. // DOM APIs, for completeness
  42931. exports.setTimeout = function() {
  42932. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42933. };
  42934. exports.setInterval = function() {
  42935. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42936. };
  42937. exports.clearTimeout =
  42938. exports.clearInterval = function(timeout) {
  42939. if (timeout) {
  42940. timeout.close();
  42941. }
  42942. };
  42943. function Timeout(id, clearFn) {
  42944. this._id = id;
  42945. this._clearFn = clearFn;
  42946. }
  42947. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42948. Timeout.prototype.close = function() {
  42949. this._clearFn.call(scope, this._id);
  42950. };
  42951. // Does not start the time, just sets up the members needed.
  42952. exports.enroll = function(item, msecs) {
  42953. clearTimeout(item._idleTimeoutId);
  42954. item._idleTimeout = msecs;
  42955. };
  42956. exports.unenroll = function(item) {
  42957. clearTimeout(item._idleTimeoutId);
  42958. item._idleTimeout = -1;
  42959. };
  42960. exports._unrefActive = exports.active = function(item) {
  42961. clearTimeout(item._idleTimeoutId);
  42962. var msecs = item._idleTimeout;
  42963. if (msecs >= 0) {
  42964. item._idleTimeoutId = setTimeout(function onTimeout() {
  42965. if (item._onTimeout)
  42966. item._onTimeout();
  42967. }, msecs);
  42968. }
  42969. };
  42970. // setimmediate attaches itself to the global object
  42971. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42972. // On some exotic environments, it's not clear which object `setimmediate` was
  42973. // able to install onto. Search each possibility in the same order as the
  42974. // `setimmediate` library.
  42975. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42976. (typeof global !== "undefined" && global.setImmediate) ||
  42977. (this && this.setImmediate);
  42978. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42979. (typeof global !== "undefined" && global.clearImmediate) ||
  42980. (this && this.clearImmediate);
  42981. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42982. /***/ }),
  42983. /***/ "./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&":
  42984. /*!*******************************************************************************************************************************************************************************************************************!*\
  42985. !*** ./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& ***!
  42986. \*******************************************************************************************************************************************************************************************************************/
  42987. /*! exports provided: render, staticRenderFns */
  42988. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42989. "use strict";
  42990. __webpack_require__.r(__webpack_exports__);
  42991. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42992. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42993. var render = function() {
  42994. var _vm = this
  42995. var _h = _vm.$createElement
  42996. var _c = _vm._self._c || _h
  42997. return _vm._m(0)
  42998. }
  42999. var staticRenderFns = [
  43000. function() {
  43001. var _vm = this
  43002. var _h = _vm.$createElement
  43003. var _c = _vm._self._c || _h
  43004. return _c("div", { staticClass: "container" }, [
  43005. _c("div", { staticClass: "row justify-content-center" }, [
  43006. _c("div", { staticClass: "col-md-8" }, [
  43007. _c("div", { staticClass: "card" }, [
  43008. _c("div", { staticClass: "card-header" }, [
  43009. _vm._v("Example Component")
  43010. ]),
  43011. _vm._v(" "),
  43012. _c("div", { staticClass: "card-body" }, [
  43013. _vm._v(
  43014. "\n I'm an example component.\n "
  43015. )
  43016. ])
  43017. ])
  43018. ])
  43019. ])
  43020. ])
  43021. }
  43022. ]
  43023. render._withStripped = true
  43024. /***/ }),
  43025. /***/ "./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&":
  43026. /*!************************************************************************************************************************************************************************************************************!*\
  43027. !*** ./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& ***!
  43028. \************************************************************************************************************************************************************************************************************/
  43029. /*! exports provided: render, staticRenderFns */
  43030. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43031. "use strict";
  43032. __webpack_require__.r(__webpack_exports__);
  43033. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43034. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43035. var render = function() {
  43036. var _vm = this
  43037. var _h = _vm.$createElement
  43038. var _c = _vm._self._c || _h
  43039. return _c(
  43040. "div",
  43041. [
  43042. _c(
  43043. "modal",
  43044. {
  43045. attrs: {
  43046. id: "asseteditModal",
  43047. tabindex: "-1",
  43048. role: "dialog",
  43049. "aria-labelledby": "asseteditModalLabel"
  43050. }
  43051. },
  43052. [
  43053. _c(
  43054. "h5",
  43055. {
  43056. staticClass: "modal-title",
  43057. attrs: { slot: "header", id: "asseteditModalLabel" },
  43058. slot: "header"
  43059. },
  43060. [_vm._v("\n Edit Work Order Information\n ")]
  43061. ),
  43062. _vm._v(" "),
  43063. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43064. _c("div", { staticClass: "form-group" }, [
  43065. _c("label", { attrs: { for: "manufacturer" } }, [
  43066. _vm._v("Manufacturer")
  43067. ]),
  43068. _vm._v(" "),
  43069. _c("input", {
  43070. directives: [
  43071. {
  43072. name: "model",
  43073. rawName: "v-model.lazy",
  43074. value: _vm.data.pcmanu,
  43075. expression: "data.pcmanu",
  43076. modifiers: { lazy: true }
  43077. }
  43078. ],
  43079. staticClass: "form-control",
  43080. attrs: {
  43081. type: "text",
  43082. name: "manufacturer",
  43083. id: "manufacturer"
  43084. },
  43085. domProps: { value: _vm.data.pcmanu },
  43086. on: {
  43087. change: function($event) {
  43088. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43089. }
  43090. }
  43091. })
  43092. ]),
  43093. _vm._v(" "),
  43094. _c("div", { staticClass: "form-group" }, [
  43095. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43096. _vm._v(" "),
  43097. _c("input", {
  43098. directives: [
  43099. {
  43100. name: "model",
  43101. rawName: "v-model.lazy",
  43102. value: _vm.data.pcmake,
  43103. expression: "data.pcmake",
  43104. modifiers: { lazy: true }
  43105. }
  43106. ],
  43107. staticClass: "form-control",
  43108. attrs: { type: "text", name: "make", id: "make" },
  43109. domProps: { value: _vm.data.pcmake },
  43110. on: {
  43111. change: function($event) {
  43112. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43113. }
  43114. }
  43115. })
  43116. ]),
  43117. _vm._v(" "),
  43118. _c("div", { staticClass: "form-group" }, [
  43119. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43120. _vm._v(" "),
  43121. _c("input", {
  43122. directives: [
  43123. {
  43124. name: "model",
  43125. rawName: "v-model.lazy",
  43126. value: _vm.data.pcnickname,
  43127. expression: "data.pcnickname",
  43128. modifiers: { lazy: true }
  43129. }
  43130. ],
  43131. staticClass: "form-control",
  43132. attrs: { type: "text", name: "nickname", id: "nickname" },
  43133. domProps: { value: _vm.data.pcnickname },
  43134. on: {
  43135. change: function($event) {
  43136. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43137. }
  43138. }
  43139. })
  43140. ]),
  43141. _vm._v(" "),
  43142. _c("div", { staticClass: "form-group" }, [
  43143. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43144. _vm._v(" "),
  43145. _c("input", {
  43146. directives: [
  43147. {
  43148. name: "model",
  43149. rawName: "v-model.lazy",
  43150. value: _vm.pcextra[2],
  43151. expression: "pcextra[2]",
  43152. modifiers: { lazy: true }
  43153. }
  43154. ],
  43155. staticClass: "form-control",
  43156. attrs: { type: "text", name: "os", id: "os" },
  43157. domProps: { value: _vm.pcextra[2] },
  43158. on: {
  43159. change: function($event) {
  43160. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43161. }
  43162. }
  43163. })
  43164. ]),
  43165. _vm._v(" "),
  43166. _c("div", { staticClass: "form-group" }, [
  43167. _c("label", { attrs: { for: "serial" } }, [
  43168. _vm._v("Serial Number")
  43169. ]),
  43170. _vm._v(" "),
  43171. _c("input", {
  43172. directives: [
  43173. {
  43174. name: "model",
  43175. rawName: "v-model.lazy",
  43176. value: _vm.pcextra[104],
  43177. expression: "pcextra[104]",
  43178. modifiers: { lazy: true }
  43179. }
  43180. ],
  43181. staticClass: "form-control",
  43182. attrs: { type: "text", id: "serial", name: "serial" },
  43183. domProps: { value: _vm.pcextra[104] },
  43184. on: {
  43185. change: function($event) {
  43186. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43187. }
  43188. }
  43189. })
  43190. ]),
  43191. _vm._v(" "),
  43192. _c("div", { staticClass: "form-group" }, [
  43193. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43194. _vm._v(" "),
  43195. _c("input", {
  43196. directives: [
  43197. {
  43198. name: "model",
  43199. rawName: "v-model.lazy",
  43200. value: _vm.pcextra[101],
  43201. expression: "pcextra[101]",
  43202. modifiers: { lazy: true }
  43203. }
  43204. ],
  43205. staticClass: "form-control",
  43206. attrs: { type: "text", id: "cpu", name: "cpu" },
  43207. domProps: { value: _vm.pcextra[101] },
  43208. on: {
  43209. change: function($event) {
  43210. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43211. }
  43212. }
  43213. })
  43214. ]),
  43215. _vm._v(" "),
  43216. _c("div", { staticClass: "form-group" }, [
  43217. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43218. _vm._v(" "),
  43219. _c("input", {
  43220. directives: [
  43221. {
  43222. name: "model",
  43223. rawName: "v-model.lazy",
  43224. value: _vm.pcextra[100],
  43225. expression: "pcextra[100]",
  43226. modifiers: { lazy: true }
  43227. }
  43228. ],
  43229. staticClass: "form-control",
  43230. attrs: { type: "text", name: "ram", id: "ram" },
  43231. domProps: { value: _vm.pcextra[100] },
  43232. on: {
  43233. change: function($event) {
  43234. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43235. }
  43236. }
  43237. })
  43238. ]),
  43239. _vm._v(" "),
  43240. _c("div", { staticClass: "form-group" }, [
  43241. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43242. _vm._v(" "),
  43243. _c("input", {
  43244. directives: [
  43245. {
  43246. name: "model",
  43247. rawName: "v-model.lazy",
  43248. value: _vm.pcextra[4],
  43249. expression: "pcextra[4]",
  43250. modifiers: { lazy: true }
  43251. }
  43252. ],
  43253. staticClass: "form-control",
  43254. attrs: { type: "text", name: "graphics", id: "grapics" },
  43255. domProps: { value: _vm.pcextra[4] },
  43256. on: {
  43257. change: function($event) {
  43258. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43259. }
  43260. }
  43261. })
  43262. ])
  43263. ]),
  43264. _vm._v(" "),
  43265. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43266. _c(
  43267. "button",
  43268. {
  43269. staticClass: "btn btn-secondary",
  43270. attrs: { type: "button", "data-dismiss": "modal" }
  43271. },
  43272. [_vm._v("Close")]
  43273. ),
  43274. _vm._v(" "),
  43275. _c(
  43276. "button",
  43277. {
  43278. staticClass: "btn btn-primary",
  43279. attrs: { type: "button" },
  43280. on: {
  43281. click: function($event) {
  43282. return _vm.updateAsset()
  43283. }
  43284. }
  43285. },
  43286. [_vm._v("Save")]
  43287. )
  43288. ])
  43289. ]
  43290. ),
  43291. _vm._v(" "),
  43292. _c("h4", { staticClass: "text-center" }, [
  43293. _vm._v(
  43294. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43295. ),
  43296. _c("small", { staticClass: "text-muted" }, [
  43297. _vm._v(_vm._s(this.data.pcnickname))
  43298. ])
  43299. ]),
  43300. _vm._v(" "),
  43301. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43302. _vm._v(" "),
  43303. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43304. _vm._v(" "),
  43305. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43306. _vm._v(" "),
  43307. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43308. _vm._v(" "),
  43309. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43310. _vm._v(" "),
  43311. _c(
  43312. "button",
  43313. {
  43314. staticClass: "btn btn-primary",
  43315. attrs: {
  43316. type: "button",
  43317. "data-toggle": "modal",
  43318. "data-target": "#asseteditModal"
  43319. }
  43320. },
  43321. [_vm._v("Edit")]
  43322. )
  43323. ],
  43324. 1
  43325. )
  43326. }
  43327. var staticRenderFns = []
  43328. render._withStripped = true
  43329. /***/ }),
  43330. /***/ "./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&":
  43331. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43332. !*** ./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& ***!
  43333. \*******************************************************************************************************************************************************************************************************************************/
  43334. /*! exports provided: render, staticRenderFns */
  43335. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43336. "use strict";
  43337. __webpack_require__.r(__webpack_exports__);
  43338. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43339. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43340. var render = function() {
  43341. var _vm = this
  43342. var _h = _vm.$createElement
  43343. var _c = _vm._self._c || _h
  43344. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43345. _c("div", { staticClass: "input-group" }, [
  43346. _c("input", {
  43347. directives: [
  43348. {
  43349. name: "model",
  43350. rawName: "v-model",
  43351. value: _vm.searchText,
  43352. expression: "searchText"
  43353. }
  43354. ],
  43355. staticClass: "form-control",
  43356. attrs: { type: "text" },
  43357. domProps: { value: _vm.searchText },
  43358. on: {
  43359. input: [
  43360. function($event) {
  43361. if ($event.target.composing) {
  43362. return
  43363. }
  43364. _vm.searchText = $event.target.value
  43365. },
  43366. _vm.searchChanged
  43367. ]
  43368. }
  43369. }),
  43370. _vm._v(" "),
  43371. _c("div", { staticClass: "form-group-append" }, [
  43372. _c(
  43373. "a",
  43374. {
  43375. staticClass: "toggle input-group-text bg-primary text-light",
  43376. on: {
  43377. mousedown: function($event) {
  43378. $event.preventDefault()
  43379. },
  43380. click: function($event) {
  43381. return _vm.setOpen(!_vm.open)
  43382. }
  43383. }
  43384. },
  43385. [
  43386. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43387. _vm._v(" "),
  43388. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43389. ]
  43390. )
  43391. ])
  43392. ]),
  43393. _vm._v(" "),
  43394. _c(
  43395. "ul",
  43396. { staticClass: "suggestion-list list-unstyled" },
  43397. _vm._l(_vm.matches, function(suggestion, index) {
  43398. return _c(
  43399. "li",
  43400. {
  43401. key: index,
  43402. on: {
  43403. mousedown: function($event) {
  43404. $event.preventDefault()
  43405. },
  43406. click: function($event) {
  43407. return _vm.suggestionSelected(suggestion)
  43408. }
  43409. }
  43410. },
  43411. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43412. )
  43413. }),
  43414. 0
  43415. )
  43416. ])
  43417. }
  43418. var staticRenderFns = []
  43419. render._withStripped = true
  43420. /***/ }),
  43421. /***/ "./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&":
  43422. /*!************************************************************************************************************************************************************************************************************************!*\
  43423. !*** ./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& ***!
  43424. \************************************************************************************************************************************************************************************************************************/
  43425. /*! exports provided: render, staticRenderFns */
  43426. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43427. "use strict";
  43428. __webpack_require__.r(__webpack_exports__);
  43429. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43430. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43431. var render = function() {
  43432. var _vm = this
  43433. var _h = _vm.$createElement
  43434. var _c = _vm._self._c || _h
  43435. return _c(
  43436. "modal",
  43437. {
  43438. attrs: {
  43439. id: _vm.id,
  43440. tabindex: "-1",
  43441. role: "dialog",
  43442. "aria-labelledby": _vm.id + "Label"
  43443. }
  43444. },
  43445. [
  43446. _c(
  43447. "h5",
  43448. {
  43449. staticClass: "modal-title",
  43450. attrs: { slot: "header", id: _vm.id + "Label" },
  43451. slot: "header"
  43452. },
  43453. [_vm._v("\n Edit Credential\n ")]
  43454. ),
  43455. _vm._v(" "),
  43456. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43457. _c(
  43458. "div",
  43459. { staticClass: "form" },
  43460. [
  43461. _c("autocomplete-custom-dropdown", {
  43462. attrs: {
  43463. options: _vm.descriptions,
  43464. value: _vm.creddesc,
  43465. "allow-custom": true
  43466. },
  43467. model: {
  43468. value: _vm.creddesc,
  43469. callback: function($$v) {
  43470. _vm.creddesc = $$v
  43471. },
  43472. expression: "creddesc"
  43473. }
  43474. })
  43475. ],
  43476. 1
  43477. ),
  43478. _vm._v(" "),
  43479. _c("div", { staticClass: "form-group" }, [
  43480. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43481. _vm._v(" "),
  43482. _c("input", {
  43483. directives: [
  43484. {
  43485. name: "model",
  43486. rawName: "v-model",
  43487. value: _vm.data.creduser,
  43488. expression: "data.creduser"
  43489. }
  43490. ],
  43491. staticClass: "form-control credential",
  43492. attrs: {
  43493. type: "text",
  43494. name: "newusername" + _vm.data.credid,
  43495. id: "newusername" + _vm.data.credid
  43496. },
  43497. domProps: { value: _vm.data.creduser },
  43498. on: {
  43499. input: function($event) {
  43500. if ($event.target.composing) {
  43501. return
  43502. }
  43503. _vm.$set(_vm.data, "creduser", $event.target.value)
  43504. }
  43505. }
  43506. })
  43507. ]),
  43508. _vm._v(" "),
  43509. _c("div", { staticClass: "form-group" }, [
  43510. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43511. _vm._v(" "),
  43512. _c("input", {
  43513. directives: [
  43514. {
  43515. name: "model",
  43516. rawName: "v-model",
  43517. value: _vm.data.credpass,
  43518. expression: "data.credpass"
  43519. }
  43520. ],
  43521. staticClass: "form-control credential",
  43522. attrs: {
  43523. type: "text",
  43524. name: "newpassword" + _vm.data.credid,
  43525. id: "newpassword" + _vm.data.credid
  43526. },
  43527. domProps: { value: _vm.data.credpass },
  43528. on: {
  43529. input: function($event) {
  43530. if ($event.target.composing) {
  43531. return
  43532. }
  43533. _vm.$set(_vm.data, "credpass", $event.target.value)
  43534. }
  43535. }
  43536. }),
  43537. _vm._v(" "),
  43538. _c(
  43539. "button",
  43540. {
  43541. staticClass: "btn btn-secondary",
  43542. attrs: { type: "button" },
  43543. on: {
  43544. click: function($event) {
  43545. return _vm.getRandomPassword(_vm.data.credid)
  43546. }
  43547. }
  43548. },
  43549. [_vm._v("Generate Random")]
  43550. )
  43551. ]),
  43552. _vm._v(" "),
  43553. _c("div", { staticClass: "form-group" })
  43554. ]),
  43555. _vm._v(" "),
  43556. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43557. _c(
  43558. "button",
  43559. {
  43560. staticClass: "btn btn-secondary",
  43561. attrs: { type: "button", "data-dismiss": "modal" }
  43562. },
  43563. [_vm._v("Close")]
  43564. ),
  43565. _vm._v(" "),
  43566. _c(
  43567. "button",
  43568. {
  43569. staticClass: "btn btn-primary",
  43570. attrs: { type: "button" },
  43571. on: {
  43572. click: function($event) {
  43573. return _vm.updateCredential()
  43574. }
  43575. }
  43576. },
  43577. [_vm._v("Save")]
  43578. )
  43579. ])
  43580. ]
  43581. )
  43582. }
  43583. var staticRenderFns = []
  43584. render._withStripped = true
  43585. /***/ }),
  43586. /***/ "./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&":
  43587. /*!******************************************************************************************************************************************************************************************************************!*\
  43588. !*** ./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& ***!
  43589. \******************************************************************************************************************************************************************************************************************/
  43590. /*! exports provided: render, staticRenderFns */
  43591. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43592. "use strict";
  43593. __webpack_require__.r(__webpack_exports__);
  43594. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43595. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43596. var render = function() {
  43597. var _vm = this
  43598. var _h = _vm.$createElement
  43599. var _c = _vm._self._c || _h
  43600. return _c(
  43601. "div",
  43602. [
  43603. _c("credential-form-modal", {
  43604. attrs: {
  43605. "modal-id": "newCredentialModal",
  43606. descriptions: _vm.creddescList,
  43607. create: true,
  43608. pcid: _vm.pcid
  43609. }
  43610. }),
  43611. _vm._v(" "),
  43612. _c(
  43613. "button",
  43614. {
  43615. staticClass: "btn btn-primary",
  43616. attrs: {
  43617. type: "button",
  43618. "data-toggle": "modal",
  43619. "data-target": "#newCredentialModal"
  43620. }
  43621. },
  43622. [_vm._v("New Credential")]
  43623. ),
  43624. _vm._v(" "),
  43625. _vm._l(_vm.credentials, function(credential, index) {
  43626. return _c(
  43627. "div",
  43628. { key: index },
  43629. [
  43630. _c("credential", {
  43631. attrs: { credential: credential, descriptions: _vm.creddescList },
  43632. on: {
  43633. "delete-cred": function($event) {
  43634. return _vm.deleteCred(index)
  43635. }
  43636. }
  43637. })
  43638. ],
  43639. 1
  43640. )
  43641. })
  43642. ],
  43643. 2
  43644. )
  43645. }
  43646. var staticRenderFns = []
  43647. render._withStripped = true
  43648. /***/ }),
  43649. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  43650. /*!*************************************************************************************************************************************************************************************************************!*\
  43651. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  43652. \*************************************************************************************************************************************************************************************************************/
  43653. /*! exports provided: render, staticRenderFns */
  43654. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43655. "use strict";
  43656. __webpack_require__.r(__webpack_exports__);
  43657. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43658. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43659. var render = function() {
  43660. var _vm = this
  43661. var _h = _vm.$createElement
  43662. var _c = _vm._self._c || _h
  43663. return _c(
  43664. "div",
  43665. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43666. [
  43667. _c("credential-form-modal", {
  43668. attrs: {
  43669. descriptions: _vm.creddescList,
  43670. "modal-id": "credential" + this.data.credid + "editModal",
  43671. populateWith: this.data
  43672. }
  43673. }),
  43674. _vm._v(" "),
  43675. _c(
  43676. "modal",
  43677. {
  43678. attrs: {
  43679. id: "credential" + this.data.credid + "deleteModal",
  43680. tabindex: "-1"
  43681. }
  43682. },
  43683. [
  43684. _c(
  43685. "h5",
  43686. {
  43687. staticClass: "modal-title",
  43688. attrs: {
  43689. slot: "header",
  43690. id: "credential" + this.data.credid + "deleteModalLabel"
  43691. },
  43692. slot: "header"
  43693. },
  43694. [_vm._v("\r\n Delete Credential\r\n ")]
  43695. ),
  43696. _vm._v(" "),
  43697. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43698. _vm._v("\r\n Are you sure?\r\n ")
  43699. ]),
  43700. _vm._v(" "),
  43701. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43702. _c(
  43703. "button",
  43704. {
  43705. staticClass: "btn btn-secondary",
  43706. attrs: { type: "button", "data-dismiss": "modal" }
  43707. },
  43708. [_vm._v("Cancel")]
  43709. ),
  43710. _vm._v(" "),
  43711. _c(
  43712. "button",
  43713. {
  43714. staticClass: "btn btn-danger",
  43715. attrs: { type: "button" },
  43716. on: {
  43717. click: function($event) {
  43718. return _vm.deleteCredential()
  43719. }
  43720. }
  43721. },
  43722. [_vm._v("Confirm")]
  43723. )
  43724. ])
  43725. ]
  43726. ),
  43727. _vm._v(" "),
  43728. _c("div", { staticClass: "row no-gutters" }, [
  43729. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43730. _vm._v(_vm._s(this.data.creddesc))
  43731. ]),
  43732. _vm._v(" "),
  43733. _c("div", { staticClass: "col-9 text-right" }, [
  43734. _vm._v(_vm._s(this.data.creddate))
  43735. ])
  43736. ]),
  43737. _vm._v(" "),
  43738. _c("div", { staticClass: "row" }, [
  43739. _c("div", { staticClass: "col-lg-9" }, [
  43740. _c("div", [
  43741. _vm._m(0),
  43742. _vm._v(" "),
  43743. _c("input", {
  43744. staticClass: "border-0 credential",
  43745. attrs: {
  43746. type: "text",
  43747. id: "username" + this.data.credid,
  43748. readonly: ""
  43749. },
  43750. domProps: { value: this.data.creduser }
  43751. }),
  43752. _vm._v(" "),
  43753. _c(
  43754. "button",
  43755. {
  43756. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43757. attrs: {
  43758. id: "btn-username" + this.data.credid,
  43759. "data-clipboard-target": "#username" + this.data.credid
  43760. }
  43761. },
  43762. [_c("i", { staticClass: "far fa-clone" })]
  43763. )
  43764. ]),
  43765. _vm._v(" "),
  43766. _c("div", [
  43767. _vm._m(1),
  43768. _vm._v(" "),
  43769. _c("input", {
  43770. staticClass: "border-0 credential",
  43771. attrs: {
  43772. type: "text",
  43773. id: "password" + this.data.credid,
  43774. readonly: ""
  43775. },
  43776. domProps: { value: this.data.credpass }
  43777. }),
  43778. _vm._v(" "),
  43779. _c(
  43780. "button",
  43781. {
  43782. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43783. attrs: {
  43784. id: "btn-password" + this.data.credid,
  43785. "data-clipboard-target": "#password" + this.data.credid
  43786. }
  43787. },
  43788. [_c("i", { staticClass: "far fa-clone" })]
  43789. )
  43790. ])
  43791. ]),
  43792. _vm._v(" "),
  43793. _c(
  43794. "div",
  43795. {
  43796. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43797. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43798. },
  43799. [
  43800. _c(
  43801. "button",
  43802. {
  43803. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43804. attrs: {
  43805. type: "button",
  43806. "data-toggle": "modal",
  43807. "data-target": "#credential" + this.data.credid + "editModal"
  43808. }
  43809. },
  43810. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43811. ),
  43812. _vm._v(" "),
  43813. _c(
  43814. "button",
  43815. {
  43816. staticClass: "btn btn-sm btn-danger p-lg-1",
  43817. attrs: {
  43818. type: "button",
  43819. "data-toggle": "modal",
  43820. "data-target":
  43821. "#credential" + this.data.credid + "deleteModal"
  43822. }
  43823. },
  43824. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43825. )
  43826. ]
  43827. )
  43828. ])
  43829. ],
  43830. 1
  43831. )
  43832. }
  43833. var staticRenderFns = [
  43834. function() {
  43835. var _vm = this
  43836. var _h = _vm.$createElement
  43837. var _c = _vm._self._c || _h
  43838. return _c("label", { attrs: { for: "username" } }, [
  43839. _c("i", { staticClass: "fas fa-fw fa-user" })
  43840. ])
  43841. },
  43842. function() {
  43843. var _vm = this
  43844. var _h = _vm.$createElement
  43845. var _c = _vm._self._c || _h
  43846. return _c("label", { attrs: { for: "password" } }, [
  43847. _c("i", { staticClass: "fas fa-fw fa-key" })
  43848. ])
  43849. }
  43850. ]
  43851. render._withStripped = true
  43852. /***/ }),
  43853. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  43854. /*!************************************************************************************************************************************************************************************************************!*\
  43855. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  43856. \************************************************************************************************************************************************************************************************************/
  43857. /*! exports provided: render, staticRenderFns */
  43858. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43859. "use strict";
  43860. __webpack_require__.r(__webpack_exports__);
  43861. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43862. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43863. var render = function() {
  43864. var _vm = this
  43865. var _h = _vm.$createElement
  43866. var _c = _vm._self._c || _h
  43867. return _c(
  43868. "ul",
  43869. { staticClass: "list-unstyled" },
  43870. _vm._l(_vm.errorList, function(error) {
  43871. return _c("li", { key: error, staticClass: "text-danger" }, [
  43872. _vm._v(" " + _vm._s(error) + " ")
  43873. ])
  43874. }),
  43875. 0
  43876. )
  43877. }
  43878. var staticRenderFns = []
  43879. render._withStripped = true
  43880. /***/ }),
  43881. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  43882. /*!********************************************************************************************************************************************************************************************************!*\
  43883. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  43884. \********************************************************************************************************************************************************************************************************/
  43885. /*! exports provided: render, staticRenderFns */
  43886. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43887. "use strict";
  43888. __webpack_require__.r(__webpack_exports__);
  43889. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43890. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43891. var render = function() {
  43892. var _vm = this
  43893. var _h = _vm.$createElement
  43894. var _c = _vm._self._c || _h
  43895. return _c("div", { staticClass: "modal fade" }, [
  43896. _c(
  43897. "div",
  43898. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43899. [
  43900. _c("div", { staticClass: "modal-content" }, [
  43901. _c(
  43902. "div",
  43903. { staticClass: "modal-header" },
  43904. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43905. 2
  43906. ),
  43907. _vm._v(" "),
  43908. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43909. _vm._v(" "),
  43910. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43911. ])
  43912. ]
  43913. )
  43914. ])
  43915. }
  43916. var staticRenderFns = [
  43917. function() {
  43918. var _vm = this
  43919. var _h = _vm.$createElement
  43920. var _c = _vm._self._c || _h
  43921. return _c(
  43922. "button",
  43923. {
  43924. staticClass: "close",
  43925. attrs: {
  43926. type: "button",
  43927. "data-dismiss": "modal",
  43928. "aria-label": "Close"
  43929. }
  43930. },
  43931. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43932. )
  43933. }
  43934. ]
  43935. render._withStripped = true
  43936. /***/ }),
  43937. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  43938. /*!********************************************************************************************************************************************************************************************************!*\
  43939. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  43940. \********************************************************************************************************************************************************************************************************/
  43941. /*! exports provided: render, staticRenderFns */
  43942. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43943. "use strict";
  43944. __webpack_require__.r(__webpack_exports__);
  43945. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43946. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43947. var render = function() {
  43948. var _vm = this
  43949. var _h = _vm.$createElement
  43950. var _c = _vm._self._c || _h
  43951. return _c(
  43952. "ul",
  43953. { staticClass: "list-unstyled" },
  43954. _vm._l(this.notes, function(note) {
  43955. return _c(
  43956. "li",
  43957. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43958. [
  43959. _c(
  43960. "modal",
  43961. {
  43962. attrs: {
  43963. id: "note" + note.noteid + "editModal",
  43964. tabindex: "-1",
  43965. role: "dialog",
  43966. "aria-labelledby": "note" + note.noteid + "editModalLabel"
  43967. }
  43968. },
  43969. [
  43970. _c(
  43971. "h5",
  43972. {
  43973. staticClass: "modal-title",
  43974. attrs: {
  43975. slot: "header",
  43976. id: "note" + note.noteid + "editModalLabel"
  43977. },
  43978. slot: "header"
  43979. },
  43980. [_vm._v("\n Edit Note\n ")]
  43981. ),
  43982. _vm._v(" "),
  43983. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43984. _c("div", { staticClass: "form-group" }, [
  43985. _c("label", { attrs: { for: "content" } }, [
  43986. _vm._v("Content")
  43987. ]),
  43988. _vm._v(" "),
  43989. _c("textarea", {
  43990. directives: [
  43991. {
  43992. name: "model",
  43993. rawName: "v-model",
  43994. value: note.thenote,
  43995. expression: "note.thenote"
  43996. }
  43997. ],
  43998. staticClass: "form-control",
  43999. attrs: {
  44000. name: "content" + note.noteid,
  44001. id: "content" + note.noteid
  44002. },
  44003. domProps: { value: note.thenote },
  44004. on: {
  44005. input: function($event) {
  44006. if ($event.target.composing) {
  44007. return
  44008. }
  44009. _vm.$set(note, "thenote", $event.target.value)
  44010. }
  44011. }
  44012. })
  44013. ])
  44014. ]),
  44015. _vm._v(" "),
  44016. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44017. _c(
  44018. "button",
  44019. {
  44020. staticClass: "btn btn-secondary",
  44021. attrs: { type: "button", "data-dismiss": "modal" }
  44022. },
  44023. [_vm._v("Close")]
  44024. ),
  44025. _vm._v(" "),
  44026. _c(
  44027. "button",
  44028. {
  44029. staticClass: "btn btn-primary",
  44030. attrs: { type: "button" },
  44031. on: {
  44032. click: function($event) {
  44033. return _vm.updateNote(note.noteid)
  44034. }
  44035. }
  44036. },
  44037. [_vm._v("Save")]
  44038. )
  44039. ])
  44040. ]
  44041. ),
  44042. _vm._v(" "),
  44043. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  44044. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44045. _vm._v(_vm._s(note.noteuser))
  44046. ]),
  44047. _vm._v(" "),
  44048. _c(
  44049. "div",
  44050. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44051. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44052. ),
  44053. _vm._v(" "),
  44054. _c(
  44055. "div",
  44056. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44057. [
  44058. _vm.authusername === note.noteuser ||
  44059. _vm.authusername === "admin"
  44060. ? [
  44061. _c(
  44062. "button",
  44063. {
  44064. staticClass: "btn btn-sm btn-primary m-1",
  44065. attrs: {
  44066. "data-toggle": "modal",
  44067. "data-target": "#note" + note.noteid + "editModal"
  44068. }
  44069. },
  44070. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44071. ),
  44072. _vm._v(" "),
  44073. _vm._m(0, true),
  44074. _vm._v(" "),
  44075. _vm._m(1, true)
  44076. ]
  44077. : _vm._e()
  44078. ],
  44079. 2
  44080. )
  44081. ]),
  44082. _vm._v(" "),
  44083. _c("div", { staticClass: "col-md-10" }, [
  44084. _c("div", { staticClass: "card m-2" }, [
  44085. _c("div", { staticClass: "card-body p-2" }, [
  44086. _vm._v(
  44087. "\n " +
  44088. _vm._s(note.thenote) +
  44089. "\n "
  44090. )
  44091. ])
  44092. ])
  44093. ])
  44094. ],
  44095. 1
  44096. )
  44097. }),
  44098. 0
  44099. )
  44100. }
  44101. var staticRenderFns = [
  44102. function() {
  44103. var _vm = this
  44104. var _h = _vm.$createElement
  44105. var _c = _vm._self._c || _h
  44106. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44107. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44108. ])
  44109. },
  44110. function() {
  44111. var _vm = this
  44112. var _h = _vm.$createElement
  44113. var _c = _vm._self._c || _h
  44114. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44115. _c("i", { staticClass: "fa fa-fw fa-random" })
  44116. ])
  44117. }
  44118. ]
  44119. render._withStripped = true
  44120. /***/ }),
  44121. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  44122. /*!********************************************************************************************************************************************************************************************************************!*\
  44123. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  44124. \********************************************************************************************************************************************************************************************************************/
  44125. /*! exports provided: render, staticRenderFns */
  44126. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44127. "use strict";
  44128. __webpack_require__.r(__webpack_exports__);
  44129. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44130. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44131. var render = function() {
  44132. var _vm = this
  44133. var _h = _vm.$createElement
  44134. var _c = _vm._self._c || _h
  44135. return _c(
  44136. "modal",
  44137. {
  44138. attrs: {
  44139. id: _vm.id,
  44140. tabindex: "-1",
  44141. role: "dialog",
  44142. "aria-labelledby": _vm.id + "Label"
  44143. }
  44144. },
  44145. [
  44146. _c(
  44147. "h5",
  44148. {
  44149. staticClass: "modal-title",
  44150. attrs: { slot: "header", id: _vm.id + "Label" },
  44151. slot: "header"
  44152. },
  44153. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44154. ),
  44155. _vm._v(" "),
  44156. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44157. _c(
  44158. "div",
  44159. { staticClass: "form-group" },
  44160. [
  44161. _c("label", { attrs: { for: "probdesc" } }, [
  44162. _vm._v("Problem Description")
  44163. ]),
  44164. _vm._v(" "),
  44165. _c("textarea", {
  44166. directives: [
  44167. {
  44168. name: "model",
  44169. rawName: "v-model",
  44170. value: _vm.data.probdesc,
  44171. expression: "data.probdesc"
  44172. }
  44173. ],
  44174. class: {
  44175. "form-control": true,
  44176. "is-invalid": _vm.errors.probdesc
  44177. },
  44178. attrs: { id: "probdesc", name: "probdesc" },
  44179. domProps: { value: _vm.data.probdesc },
  44180. on: {
  44181. input: function($event) {
  44182. if ($event.target.composing) {
  44183. return
  44184. }
  44185. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44186. }
  44187. }
  44188. }),
  44189. _vm._v(" "),
  44190. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44191. ],
  44192. 1
  44193. ),
  44194. _vm._v(" "),
  44195. _c(
  44196. "div",
  44197. { staticClass: "form-group" },
  44198. [
  44199. _c("label", { attrs: { for: "suggested" } }, [
  44200. _vm._v("Suggested Solution")
  44201. ]),
  44202. _vm._v(" "),
  44203. _c("textarea", {
  44204. directives: [
  44205. {
  44206. name: "model",
  44207. rawName: "v-model",
  44208. value: _vm.data.suggested,
  44209. expression: "data.suggested"
  44210. }
  44211. ],
  44212. class: {
  44213. "form-control": true,
  44214. "is-invalid": _vm.errors.suggested
  44215. },
  44216. attrs: { id: "suggested", name: "suggested" },
  44217. domProps: { value: _vm.data.suggested },
  44218. on: {
  44219. input: function($event) {
  44220. if ($event.target.composing) {
  44221. return
  44222. }
  44223. _vm.$set(_vm.data, "suggested", $event.target.value)
  44224. }
  44225. }
  44226. }),
  44227. _vm._v(" "),
  44228. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44229. ],
  44230. 1
  44231. ),
  44232. _vm._v(" "),
  44233. _c(
  44234. "div",
  44235. { staticClass: "form-group" },
  44236. [
  44237. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44238. _vm._v(" "),
  44239. _c("autocomplete-custom-dropdown", {
  44240. attrs: { options: _vm.storeList, value: this.store },
  44241. model: {
  44242. value: _vm.store,
  44243. callback: function($$v) {
  44244. _vm.store = $$v
  44245. },
  44246. expression: "store"
  44247. }
  44248. })
  44249. ],
  44250. 1
  44251. )
  44252. ]),
  44253. _vm._v(" "),
  44254. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44255. _c(
  44256. "button",
  44257. {
  44258. staticClass: "btn btn-secondary",
  44259. attrs: { type: "button", "data-dismiss": "modal" }
  44260. },
  44261. [_vm._v("Close")]
  44262. ),
  44263. _vm._v(" "),
  44264. _c(
  44265. "button",
  44266. {
  44267. staticClass: "btn btn-primary",
  44268. attrs: { type: "button" },
  44269. on: {
  44270. click: function($event) {
  44271. return _vm.updateWorkOrder()
  44272. }
  44273. }
  44274. },
  44275. [_vm._v("Save")]
  44276. )
  44277. ])
  44278. ]
  44279. )
  44280. }
  44281. var staticRenderFns = []
  44282. render._withStripped = true
  44283. /***/ }),
  44284. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  44285. /*!*********************************************************************************************************************************************************************************************************!*\
  44286. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  44287. \*********************************************************************************************************************************************************************************************************/
  44288. /*! exports provided: render, staticRenderFns */
  44289. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44290. "use strict";
  44291. __webpack_require__.r(__webpack_exports__);
  44292. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44293. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44294. var render = function() {
  44295. var _vm = this
  44296. var _h = _vm.$createElement
  44297. var _c = _vm._self._c || _h
  44298. return _c(
  44299. "div",
  44300. [
  44301. _c("woinfo-edit-modal", {
  44302. attrs: {
  44303. "modal-id": "workordereditModal",
  44304. "populate-with": this.data,
  44305. "store-list": this.storeList
  44306. }
  44307. }),
  44308. _vm._v(" "),
  44309. _c("p", [
  44310. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44311. _vm._v(" "),
  44312. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44313. ]),
  44314. _vm._v(" "),
  44315. _c("p", [
  44316. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44317. _vm._v(" "),
  44318. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44319. ]),
  44320. _vm._v(" "),
  44321. _c("p", [
  44322. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44323. _vm._v(" "),
  44324. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44325. ]),
  44326. _vm._v(" "),
  44327. _c("p", [
  44328. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44329. _vm._v(" "),
  44330. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44331. ]),
  44332. _vm._v(" "),
  44333. _c("p", [
  44334. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44335. _vm._v(" "),
  44336. _c(
  44337. "span",
  44338. {
  44339. staticClass: "dashed-underline",
  44340. attrs: {
  44341. "data-toggle": "tooltip",
  44342. "data-placement": "bottom",
  44343. title: this.getHRDate(this.data.dropdate)
  44344. }
  44345. },
  44346. [
  44347. _vm._v(
  44348. "\n " +
  44349. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44350. " days ago\n "
  44351. )
  44352. ]
  44353. )
  44354. ]),
  44355. _vm._v(" "),
  44356. _c("p", [
  44357. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44358. _vm._v(" "),
  44359. !this.isZero(this.data.pickupdate)
  44360. ? _c(
  44361. "span",
  44362. {
  44363. staticClass: "dashed-underline",
  44364. attrs: {
  44365. "data-toggle": "tooltip",
  44366. "data-placement": "bottom",
  44367. title: this.getHRDate(this.data.pickupdate)
  44368. }
  44369. },
  44370. [
  44371. _vm._v(
  44372. "\n " +
  44373. _vm._s(
  44374. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44375. ) +
  44376. " days ago\n "
  44377. )
  44378. ]
  44379. )
  44380. : _vm._e()
  44381. ]),
  44382. _vm._v(" "),
  44383. _c(
  44384. "button",
  44385. {
  44386. staticClass: "btn btn-primary",
  44387. attrs: {
  44388. type: "button",
  44389. "data-toggle": "modal",
  44390. "data-target": "#workordereditModal"
  44391. }
  44392. },
  44393. [_vm._v("Edit")]
  44394. )
  44395. ],
  44396. 1
  44397. )
  44398. }
  44399. var staticRenderFns = []
  44400. render._withStripped = true
  44401. /***/ }),
  44402. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44403. /*!********************************************************************!*\
  44404. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44405. \********************************************************************/
  44406. /*! exports provided: default */
  44407. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44408. "use strict";
  44409. __webpack_require__.r(__webpack_exports__);
  44410. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44411. /* globals __VUE_SSR_CONTEXT__ */
  44412. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44413. // This module is a runtime utility for cleaner component module output and will
  44414. // be included in the final webpack user bundle.
  44415. function normalizeComponent (
  44416. scriptExports,
  44417. render,
  44418. staticRenderFns,
  44419. functionalTemplate,
  44420. injectStyles,
  44421. scopeId,
  44422. moduleIdentifier, /* server only */
  44423. shadowMode /* vue-cli only */
  44424. ) {
  44425. // Vue.extend constructor export interop
  44426. var options = typeof scriptExports === 'function'
  44427. ? scriptExports.options
  44428. : scriptExports
  44429. // render functions
  44430. if (render) {
  44431. options.render = render
  44432. options.staticRenderFns = staticRenderFns
  44433. options._compiled = true
  44434. }
  44435. // functional template
  44436. if (functionalTemplate) {
  44437. options.functional = true
  44438. }
  44439. // scopedId
  44440. if (scopeId) {
  44441. options._scopeId = 'data-v-' + scopeId
  44442. }
  44443. var hook
  44444. if (moduleIdentifier) { // server build
  44445. hook = function (context) {
  44446. // 2.3 injection
  44447. context =
  44448. context || // cached call
  44449. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44450. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44451. // 2.2 with runInNewContext: true
  44452. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44453. context = __VUE_SSR_CONTEXT__
  44454. }
  44455. // inject component styles
  44456. if (injectStyles) {
  44457. injectStyles.call(this, context)
  44458. }
  44459. // register component module identifier for async chunk inferrence
  44460. if (context && context._registeredComponents) {
  44461. context._registeredComponents.add(moduleIdentifier)
  44462. }
  44463. }
  44464. // used by ssr in case component is cached and beforeCreate
  44465. // never gets called
  44466. options._ssrRegister = hook
  44467. } else if (injectStyles) {
  44468. hook = shadowMode
  44469. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44470. : injectStyles
  44471. }
  44472. if (hook) {
  44473. if (options.functional) {
  44474. // for template-only hot-reload because in that case the render fn doesn't
  44475. // go through the normalizer
  44476. options._injectStyles = hook
  44477. // register for functioal component in vue file
  44478. var originalRender = options.render
  44479. options.render = function renderWithStyleInjection (h, context) {
  44480. hook.call(context)
  44481. return originalRender(h, context)
  44482. }
  44483. } else {
  44484. // inject component registration as beforeCreate hook
  44485. var existing = options.beforeCreate
  44486. options.beforeCreate = existing
  44487. ? [].concat(existing, hook)
  44488. : [hook]
  44489. }
  44490. }
  44491. return {
  44492. exports: scriptExports,
  44493. options: options
  44494. }
  44495. }
  44496. /***/ }),
  44497. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44498. /*!*************************************************!*\
  44499. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44500. \*************************************************/
  44501. /*! no static exports found */
  44502. /***/ (function(module, exports, __webpack_require__) {
  44503. "use strict";
  44504. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44505. * Vue.js v2.6.11
  44506. * (c) 2014-2019 Evan You
  44507. * Released under the MIT License.
  44508. */
  44509. /* */
  44510. var emptyObject = Object.freeze({});
  44511. // These helpers produce better VM code in JS engines due to their
  44512. // explicitness and function inlining.
  44513. function isUndef (v) {
  44514. return v === undefined || v === null
  44515. }
  44516. function isDef (v) {
  44517. return v !== undefined && v !== null
  44518. }
  44519. function isTrue (v) {
  44520. return v === true
  44521. }
  44522. function isFalse (v) {
  44523. return v === false
  44524. }
  44525. /**
  44526. * Check if value is primitive.
  44527. */
  44528. function isPrimitive (value) {
  44529. return (
  44530. typeof value === 'string' ||
  44531. typeof value === 'number' ||
  44532. // $flow-disable-line
  44533. typeof value === 'symbol' ||
  44534. typeof value === 'boolean'
  44535. )
  44536. }
  44537. /**
  44538. * Quick object check - this is primarily used to tell
  44539. * Objects from primitive values when we know the value
  44540. * is a JSON-compliant type.
  44541. */
  44542. function isObject (obj) {
  44543. return obj !== null && typeof obj === 'object'
  44544. }
  44545. /**
  44546. * Get the raw type string of a value, e.g., [object Object].
  44547. */
  44548. var _toString = Object.prototype.toString;
  44549. function toRawType (value) {
  44550. return _toString.call(value).slice(8, -1)
  44551. }
  44552. /**
  44553. * Strict object type check. Only returns true
  44554. * for plain JavaScript objects.
  44555. */
  44556. function isPlainObject (obj) {
  44557. return _toString.call(obj) === '[object Object]'
  44558. }
  44559. function isRegExp (v) {
  44560. return _toString.call(v) === '[object RegExp]'
  44561. }
  44562. /**
  44563. * Check if val is a valid array index.
  44564. */
  44565. function isValidArrayIndex (val) {
  44566. var n = parseFloat(String(val));
  44567. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44568. }
  44569. function isPromise (val) {
  44570. return (
  44571. isDef(val) &&
  44572. typeof val.then === 'function' &&
  44573. typeof val.catch === 'function'
  44574. )
  44575. }
  44576. /**
  44577. * Convert a value to a string that is actually rendered.
  44578. */
  44579. function toString (val) {
  44580. return val == null
  44581. ? ''
  44582. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44583. ? JSON.stringify(val, null, 2)
  44584. : String(val)
  44585. }
  44586. /**
  44587. * Convert an input value to a number for persistence.
  44588. * If the conversion fails, return original string.
  44589. */
  44590. function toNumber (val) {
  44591. var n = parseFloat(val);
  44592. return isNaN(n) ? val : n
  44593. }
  44594. /**
  44595. * Make a map and return a function for checking if a key
  44596. * is in that map.
  44597. */
  44598. function makeMap (
  44599. str,
  44600. expectsLowerCase
  44601. ) {
  44602. var map = Object.create(null);
  44603. var list = str.split(',');
  44604. for (var i = 0; i < list.length; i++) {
  44605. map[list[i]] = true;
  44606. }
  44607. return expectsLowerCase
  44608. ? function (val) { return map[val.toLowerCase()]; }
  44609. : function (val) { return map[val]; }
  44610. }
  44611. /**
  44612. * Check if a tag is a built-in tag.
  44613. */
  44614. var isBuiltInTag = makeMap('slot,component', true);
  44615. /**
  44616. * Check if an attribute is a reserved attribute.
  44617. */
  44618. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44619. /**
  44620. * Remove an item from an array.
  44621. */
  44622. function remove (arr, item) {
  44623. if (arr.length) {
  44624. var index = arr.indexOf(item);
  44625. if (index > -1) {
  44626. return arr.splice(index, 1)
  44627. }
  44628. }
  44629. }
  44630. /**
  44631. * Check whether an object has the property.
  44632. */
  44633. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44634. function hasOwn (obj, key) {
  44635. return hasOwnProperty.call(obj, key)
  44636. }
  44637. /**
  44638. * Create a cached version of a pure function.
  44639. */
  44640. function cached (fn) {
  44641. var cache = Object.create(null);
  44642. return (function cachedFn (str) {
  44643. var hit = cache[str];
  44644. return hit || (cache[str] = fn(str))
  44645. })
  44646. }
  44647. /**
  44648. * Camelize a hyphen-delimited string.
  44649. */
  44650. var camelizeRE = /-(\w)/g;
  44651. var camelize = cached(function (str) {
  44652. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44653. });
  44654. /**
  44655. * Capitalize a string.
  44656. */
  44657. var capitalize = cached(function (str) {
  44658. return str.charAt(0).toUpperCase() + str.slice(1)
  44659. });
  44660. /**
  44661. * Hyphenate a camelCase string.
  44662. */
  44663. var hyphenateRE = /\B([A-Z])/g;
  44664. var hyphenate = cached(function (str) {
  44665. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44666. });
  44667. /**
  44668. * Simple bind polyfill for environments that do not support it,
  44669. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44670. * since native bind is now performant enough in most browsers.
  44671. * But removing it would mean breaking code that was able to run in
  44672. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44673. */
  44674. /* istanbul ignore next */
  44675. function polyfillBind (fn, ctx) {
  44676. function boundFn (a) {
  44677. var l = arguments.length;
  44678. return l
  44679. ? l > 1
  44680. ? fn.apply(ctx, arguments)
  44681. : fn.call(ctx, a)
  44682. : fn.call(ctx)
  44683. }
  44684. boundFn._length = fn.length;
  44685. return boundFn
  44686. }
  44687. function nativeBind (fn, ctx) {
  44688. return fn.bind(ctx)
  44689. }
  44690. var bind = Function.prototype.bind
  44691. ? nativeBind
  44692. : polyfillBind;
  44693. /**
  44694. * Convert an Array-like object to a real Array.
  44695. */
  44696. function toArray (list, start) {
  44697. start = start || 0;
  44698. var i = list.length - start;
  44699. var ret = new Array(i);
  44700. while (i--) {
  44701. ret[i] = list[i + start];
  44702. }
  44703. return ret
  44704. }
  44705. /**
  44706. * Mix properties into target object.
  44707. */
  44708. function extend (to, _from) {
  44709. for (var key in _from) {
  44710. to[key] = _from[key];
  44711. }
  44712. return to
  44713. }
  44714. /**
  44715. * Merge an Array of Objects into a single Object.
  44716. */
  44717. function toObject (arr) {
  44718. var res = {};
  44719. for (var i = 0; i < arr.length; i++) {
  44720. if (arr[i]) {
  44721. extend(res, arr[i]);
  44722. }
  44723. }
  44724. return res
  44725. }
  44726. /* eslint-disable no-unused-vars */
  44727. /**
  44728. * Perform no operation.
  44729. * Stubbing args to make Flow happy without leaving useless transpiled code
  44730. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44731. */
  44732. function noop (a, b, c) {}
  44733. /**
  44734. * Always return false.
  44735. */
  44736. var no = function (a, b, c) { return false; };
  44737. /* eslint-enable no-unused-vars */
  44738. /**
  44739. * Return the same value.
  44740. */
  44741. var identity = function (_) { return _; };
  44742. /**
  44743. * Generate a string containing static keys from compiler modules.
  44744. */
  44745. function genStaticKeys (modules) {
  44746. return modules.reduce(function (keys, m) {
  44747. return keys.concat(m.staticKeys || [])
  44748. }, []).join(',')
  44749. }
  44750. /**
  44751. * Check if two values are loosely equal - that is,
  44752. * if they are plain objects, do they have the same shape?
  44753. */
  44754. function looseEqual (a, b) {
  44755. if (a === b) { return true }
  44756. var isObjectA = isObject(a);
  44757. var isObjectB = isObject(b);
  44758. if (isObjectA && isObjectB) {
  44759. try {
  44760. var isArrayA = Array.isArray(a);
  44761. var isArrayB = Array.isArray(b);
  44762. if (isArrayA && isArrayB) {
  44763. return a.length === b.length && a.every(function (e, i) {
  44764. return looseEqual(e, b[i])
  44765. })
  44766. } else if (a instanceof Date && b instanceof Date) {
  44767. return a.getTime() === b.getTime()
  44768. } else if (!isArrayA && !isArrayB) {
  44769. var keysA = Object.keys(a);
  44770. var keysB = Object.keys(b);
  44771. return keysA.length === keysB.length && keysA.every(function (key) {
  44772. return looseEqual(a[key], b[key])
  44773. })
  44774. } else {
  44775. /* istanbul ignore next */
  44776. return false
  44777. }
  44778. } catch (e) {
  44779. /* istanbul ignore next */
  44780. return false
  44781. }
  44782. } else if (!isObjectA && !isObjectB) {
  44783. return String(a) === String(b)
  44784. } else {
  44785. return false
  44786. }
  44787. }
  44788. /**
  44789. * Return the first index at which a loosely equal value can be
  44790. * found in the array (if value is a plain object, the array must
  44791. * contain an object of the same shape), or -1 if it is not present.
  44792. */
  44793. function looseIndexOf (arr, val) {
  44794. for (var i = 0; i < arr.length; i++) {
  44795. if (looseEqual(arr[i], val)) { return i }
  44796. }
  44797. return -1
  44798. }
  44799. /**
  44800. * Ensure a function is called only once.
  44801. */
  44802. function once (fn) {
  44803. var called = false;
  44804. return function () {
  44805. if (!called) {
  44806. called = true;
  44807. fn.apply(this, arguments);
  44808. }
  44809. }
  44810. }
  44811. var SSR_ATTR = 'data-server-rendered';
  44812. var ASSET_TYPES = [
  44813. 'component',
  44814. 'directive',
  44815. 'filter'
  44816. ];
  44817. var LIFECYCLE_HOOKS = [
  44818. 'beforeCreate',
  44819. 'created',
  44820. 'beforeMount',
  44821. 'mounted',
  44822. 'beforeUpdate',
  44823. 'updated',
  44824. 'beforeDestroy',
  44825. 'destroyed',
  44826. 'activated',
  44827. 'deactivated',
  44828. 'errorCaptured',
  44829. 'serverPrefetch'
  44830. ];
  44831. /* */
  44832. var config = ({
  44833. /**
  44834. * Option merge strategies (used in core/util/options)
  44835. */
  44836. // $flow-disable-line
  44837. optionMergeStrategies: Object.create(null),
  44838. /**
  44839. * Whether to suppress warnings.
  44840. */
  44841. silent: false,
  44842. /**
  44843. * Show production mode tip message on boot?
  44844. */
  44845. productionTip: "development" !== 'production',
  44846. /**
  44847. * Whether to enable devtools
  44848. */
  44849. devtools: "development" !== 'production',
  44850. /**
  44851. * Whether to record perf
  44852. */
  44853. performance: false,
  44854. /**
  44855. * Error handler for watcher errors
  44856. */
  44857. errorHandler: null,
  44858. /**
  44859. * Warn handler for watcher warns
  44860. */
  44861. warnHandler: null,
  44862. /**
  44863. * Ignore certain custom elements
  44864. */
  44865. ignoredElements: [],
  44866. /**
  44867. * Custom user key aliases for v-on
  44868. */
  44869. // $flow-disable-line
  44870. keyCodes: Object.create(null),
  44871. /**
  44872. * Check if a tag is reserved so that it cannot be registered as a
  44873. * component. This is platform-dependent and may be overwritten.
  44874. */
  44875. isReservedTag: no,
  44876. /**
  44877. * Check if an attribute is reserved so that it cannot be used as a component
  44878. * prop. This is platform-dependent and may be overwritten.
  44879. */
  44880. isReservedAttr: no,
  44881. /**
  44882. * Check if a tag is an unknown element.
  44883. * Platform-dependent.
  44884. */
  44885. isUnknownElement: no,
  44886. /**
  44887. * Get the namespace of an element
  44888. */
  44889. getTagNamespace: noop,
  44890. /**
  44891. * Parse the real tag name for the specific platform.
  44892. */
  44893. parsePlatformTagName: identity,
  44894. /**
  44895. * Check if an attribute must be bound using property, e.g. value
  44896. * Platform-dependent.
  44897. */
  44898. mustUseProp: no,
  44899. /**
  44900. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44901. * This will significantly reduce performance if set to false.
  44902. */
  44903. async: true,
  44904. /**
  44905. * Exposed for legacy reasons
  44906. */
  44907. _lifecycleHooks: LIFECYCLE_HOOKS
  44908. });
  44909. /* */
  44910. /**
  44911. * unicode letters used for parsing html tags, component names and property paths.
  44912. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44913. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44914. */
  44915. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  44916. /**
  44917. * Check if a string starts with $ or _
  44918. */
  44919. function isReserved (str) {
  44920. var c = (str + '').charCodeAt(0);
  44921. return c === 0x24 || c === 0x5F
  44922. }
  44923. /**
  44924. * Define a property.
  44925. */
  44926. function def (obj, key, val, enumerable) {
  44927. Object.defineProperty(obj, key, {
  44928. value: val,
  44929. enumerable: !!enumerable,
  44930. writable: true,
  44931. configurable: true
  44932. });
  44933. }
  44934. /**
  44935. * Parse simple path.
  44936. */
  44937. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44938. function parsePath (path) {
  44939. if (bailRE.test(path)) {
  44940. return
  44941. }
  44942. var segments = path.split('.');
  44943. return function (obj) {
  44944. for (var i = 0; i < segments.length; i++) {
  44945. if (!obj) { return }
  44946. obj = obj[segments[i]];
  44947. }
  44948. return obj
  44949. }
  44950. }
  44951. /* */
  44952. // can we use __proto__?
  44953. var hasProto = '__proto__' in {};
  44954. // Browser environment sniffing
  44955. var inBrowser = typeof window !== 'undefined';
  44956. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44957. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44958. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44959. var isIE = UA && /msie|trident/.test(UA);
  44960. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44961. var isEdge = UA && UA.indexOf('edge/') > 0;
  44962. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44963. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44964. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44965. var isPhantomJS = UA && /phantomjs/.test(UA);
  44966. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44967. // Firefox has a "watch" function on Object.prototype...
  44968. var nativeWatch = ({}).watch;
  44969. var supportsPassive = false;
  44970. if (inBrowser) {
  44971. try {
  44972. var opts = {};
  44973. Object.defineProperty(opts, 'passive', ({
  44974. get: function get () {
  44975. /* istanbul ignore next */
  44976. supportsPassive = true;
  44977. }
  44978. })); // https://github.com/facebook/flow/issues/285
  44979. window.addEventListener('test-passive', null, opts);
  44980. } catch (e) {}
  44981. }
  44982. // this needs to be lazy-evaled because vue may be required before
  44983. // vue-server-renderer can set VUE_ENV
  44984. var _isServer;
  44985. var isServerRendering = function () {
  44986. if (_isServer === undefined) {
  44987. /* istanbul ignore if */
  44988. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  44989. // detect presence of vue-server-renderer and avoid
  44990. // Webpack shimming the process
  44991. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  44992. } else {
  44993. _isServer = false;
  44994. }
  44995. }
  44996. return _isServer
  44997. };
  44998. // detect devtools
  44999. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45000. /* istanbul ignore next */
  45001. function isNative (Ctor) {
  45002. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45003. }
  45004. var hasSymbol =
  45005. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45006. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45007. var _Set;
  45008. /* istanbul ignore if */ // $flow-disable-line
  45009. if (typeof Set !== 'undefined' && isNative(Set)) {
  45010. // use native Set when available.
  45011. _Set = Set;
  45012. } else {
  45013. // a non-standard Set polyfill that only works with primitive keys.
  45014. _Set = /*@__PURE__*/(function () {
  45015. function Set () {
  45016. this.set = Object.create(null);
  45017. }
  45018. Set.prototype.has = function has (key) {
  45019. return this.set[key] === true
  45020. };
  45021. Set.prototype.add = function add (key) {
  45022. this.set[key] = true;
  45023. };
  45024. Set.prototype.clear = function clear () {
  45025. this.set = Object.create(null);
  45026. };
  45027. return Set;
  45028. }());
  45029. }
  45030. /* */
  45031. var warn = noop;
  45032. var tip = noop;
  45033. var generateComponentTrace = (noop); // work around flow check
  45034. var formatComponentName = (noop);
  45035. {
  45036. var hasConsole = typeof console !== 'undefined';
  45037. var classifyRE = /(?:^|[-_])(\w)/g;
  45038. var classify = function (str) { return str
  45039. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45040. .replace(/[-_]/g, ''); };
  45041. warn = function (msg, vm) {
  45042. var trace = vm ? generateComponentTrace(vm) : '';
  45043. if (config.warnHandler) {
  45044. config.warnHandler.call(null, msg, vm, trace);
  45045. } else if (hasConsole && (!config.silent)) {
  45046. console.error(("[Vue warn]: " + msg + trace));
  45047. }
  45048. };
  45049. tip = function (msg, vm) {
  45050. if (hasConsole && (!config.silent)) {
  45051. console.warn("[Vue tip]: " + msg + (
  45052. vm ? generateComponentTrace(vm) : ''
  45053. ));
  45054. }
  45055. };
  45056. formatComponentName = function (vm, includeFile) {
  45057. if (vm.$root === vm) {
  45058. return '<Root>'
  45059. }
  45060. var options = typeof vm === 'function' && vm.cid != null
  45061. ? vm.options
  45062. : vm._isVue
  45063. ? vm.$options || vm.constructor.options
  45064. : vm;
  45065. var name = options.name || options._componentTag;
  45066. var file = options.__file;
  45067. if (!name && file) {
  45068. var match = file.match(/([^/\\]+)\.vue$/);
  45069. name = match && match[1];
  45070. }
  45071. return (
  45072. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45073. (file && includeFile !== false ? (" at " + file) : '')
  45074. )
  45075. };
  45076. var repeat = function (str, n) {
  45077. var res = '';
  45078. while (n) {
  45079. if (n % 2 === 1) { res += str; }
  45080. if (n > 1) { str += str; }
  45081. n >>= 1;
  45082. }
  45083. return res
  45084. };
  45085. generateComponentTrace = function (vm) {
  45086. if (vm._isVue && vm.$parent) {
  45087. var tree = [];
  45088. var currentRecursiveSequence = 0;
  45089. while (vm) {
  45090. if (tree.length > 0) {
  45091. var last = tree[tree.length - 1];
  45092. if (last.constructor === vm.constructor) {
  45093. currentRecursiveSequence++;
  45094. vm = vm.$parent;
  45095. continue
  45096. } else if (currentRecursiveSequence > 0) {
  45097. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45098. currentRecursiveSequence = 0;
  45099. }
  45100. }
  45101. tree.push(vm);
  45102. vm = vm.$parent;
  45103. }
  45104. return '\n\nfound in\n\n' + tree
  45105. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45106. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45107. : formatComponentName(vm))); })
  45108. .join('\n')
  45109. } else {
  45110. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45111. }
  45112. };
  45113. }
  45114. /* */
  45115. var uid = 0;
  45116. /**
  45117. * A dep is an observable that can have multiple
  45118. * directives subscribing to it.
  45119. */
  45120. var Dep = function Dep () {
  45121. this.id = uid++;
  45122. this.subs = [];
  45123. };
  45124. Dep.prototype.addSub = function addSub (sub) {
  45125. this.subs.push(sub);
  45126. };
  45127. Dep.prototype.removeSub = function removeSub (sub) {
  45128. remove(this.subs, sub);
  45129. };
  45130. Dep.prototype.depend = function depend () {
  45131. if (Dep.target) {
  45132. Dep.target.addDep(this);
  45133. }
  45134. };
  45135. Dep.prototype.notify = function notify () {
  45136. // stabilize the subscriber list first
  45137. var subs = this.subs.slice();
  45138. if (!config.async) {
  45139. // subs aren't sorted in scheduler if not running async
  45140. // we need to sort them now to make sure they fire in correct
  45141. // order
  45142. subs.sort(function (a, b) { return a.id - b.id; });
  45143. }
  45144. for (var i = 0, l = subs.length; i < l; i++) {
  45145. subs[i].update();
  45146. }
  45147. };
  45148. // The current target watcher being evaluated.
  45149. // This is globally unique because only one watcher
  45150. // can be evaluated at a time.
  45151. Dep.target = null;
  45152. var targetStack = [];
  45153. function pushTarget (target) {
  45154. targetStack.push(target);
  45155. Dep.target = target;
  45156. }
  45157. function popTarget () {
  45158. targetStack.pop();
  45159. Dep.target = targetStack[targetStack.length - 1];
  45160. }
  45161. /* */
  45162. var VNode = function VNode (
  45163. tag,
  45164. data,
  45165. children,
  45166. text,
  45167. elm,
  45168. context,
  45169. componentOptions,
  45170. asyncFactory
  45171. ) {
  45172. this.tag = tag;
  45173. this.data = data;
  45174. this.children = children;
  45175. this.text = text;
  45176. this.elm = elm;
  45177. this.ns = undefined;
  45178. this.context = context;
  45179. this.fnContext = undefined;
  45180. this.fnOptions = undefined;
  45181. this.fnScopeId = undefined;
  45182. this.key = data && data.key;
  45183. this.componentOptions = componentOptions;
  45184. this.componentInstance = undefined;
  45185. this.parent = undefined;
  45186. this.raw = false;
  45187. this.isStatic = false;
  45188. this.isRootInsert = true;
  45189. this.isComment = false;
  45190. this.isCloned = false;
  45191. this.isOnce = false;
  45192. this.asyncFactory = asyncFactory;
  45193. this.asyncMeta = undefined;
  45194. this.isAsyncPlaceholder = false;
  45195. };
  45196. var prototypeAccessors = { child: { configurable: true } };
  45197. // DEPRECATED: alias for componentInstance for backwards compat.
  45198. /* istanbul ignore next */
  45199. prototypeAccessors.child.get = function () {
  45200. return this.componentInstance
  45201. };
  45202. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45203. var createEmptyVNode = function (text) {
  45204. if ( text === void 0 ) text = '';
  45205. var node = new VNode();
  45206. node.text = text;
  45207. node.isComment = true;
  45208. return node
  45209. };
  45210. function createTextVNode (val) {
  45211. return new VNode(undefined, undefined, undefined, String(val))
  45212. }
  45213. // optimized shallow clone
  45214. // used for static nodes and slot nodes because they may be reused across
  45215. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45216. // on their elm reference.
  45217. function cloneVNode (vnode) {
  45218. var cloned = new VNode(
  45219. vnode.tag,
  45220. vnode.data,
  45221. // #7975
  45222. // clone children array to avoid mutating original in case of cloning
  45223. // a child.
  45224. vnode.children && vnode.children.slice(),
  45225. vnode.text,
  45226. vnode.elm,
  45227. vnode.context,
  45228. vnode.componentOptions,
  45229. vnode.asyncFactory
  45230. );
  45231. cloned.ns = vnode.ns;
  45232. cloned.isStatic = vnode.isStatic;
  45233. cloned.key = vnode.key;
  45234. cloned.isComment = vnode.isComment;
  45235. cloned.fnContext = vnode.fnContext;
  45236. cloned.fnOptions = vnode.fnOptions;
  45237. cloned.fnScopeId = vnode.fnScopeId;
  45238. cloned.asyncMeta = vnode.asyncMeta;
  45239. cloned.isCloned = true;
  45240. return cloned
  45241. }
  45242. /*
  45243. * not type checking this file because flow doesn't play well with
  45244. * dynamically accessing methods on Array prototype
  45245. */
  45246. var arrayProto = Array.prototype;
  45247. var arrayMethods = Object.create(arrayProto);
  45248. var methodsToPatch = [
  45249. 'push',
  45250. 'pop',
  45251. 'shift',
  45252. 'unshift',
  45253. 'splice',
  45254. 'sort',
  45255. 'reverse'
  45256. ];
  45257. /**
  45258. * Intercept mutating methods and emit events
  45259. */
  45260. methodsToPatch.forEach(function (method) {
  45261. // cache original method
  45262. var original = arrayProto[method];
  45263. def(arrayMethods, method, function mutator () {
  45264. var args = [], len = arguments.length;
  45265. while ( len-- ) args[ len ] = arguments[ len ];
  45266. var result = original.apply(this, args);
  45267. var ob = this.__ob__;
  45268. var inserted;
  45269. switch (method) {
  45270. case 'push':
  45271. case 'unshift':
  45272. inserted = args;
  45273. break
  45274. case 'splice':
  45275. inserted = args.slice(2);
  45276. break
  45277. }
  45278. if (inserted) { ob.observeArray(inserted); }
  45279. // notify change
  45280. ob.dep.notify();
  45281. return result
  45282. });
  45283. });
  45284. /* */
  45285. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45286. /**
  45287. * In some cases we may want to disable observation inside a component's
  45288. * update computation.
  45289. */
  45290. var shouldObserve = true;
  45291. function toggleObserving (value) {
  45292. shouldObserve = value;
  45293. }
  45294. /**
  45295. * Observer class that is attached to each observed
  45296. * object. Once attached, the observer converts the target
  45297. * object's property keys into getter/setters that
  45298. * collect dependencies and dispatch updates.
  45299. */
  45300. var Observer = function Observer (value) {
  45301. this.value = value;
  45302. this.dep = new Dep();
  45303. this.vmCount = 0;
  45304. def(value, '__ob__', this);
  45305. if (Array.isArray(value)) {
  45306. if (hasProto) {
  45307. protoAugment(value, arrayMethods);
  45308. } else {
  45309. copyAugment(value, arrayMethods, arrayKeys);
  45310. }
  45311. this.observeArray(value);
  45312. } else {
  45313. this.walk(value);
  45314. }
  45315. };
  45316. /**
  45317. * Walk through all properties and convert them into
  45318. * getter/setters. This method should only be called when
  45319. * value type is Object.
  45320. */
  45321. Observer.prototype.walk = function walk (obj) {
  45322. var keys = Object.keys(obj);
  45323. for (var i = 0; i < keys.length; i++) {
  45324. defineReactive$$1(obj, keys[i]);
  45325. }
  45326. };
  45327. /**
  45328. * Observe a list of Array items.
  45329. */
  45330. Observer.prototype.observeArray = function observeArray (items) {
  45331. for (var i = 0, l = items.length; i < l; i++) {
  45332. observe(items[i]);
  45333. }
  45334. };
  45335. // helpers
  45336. /**
  45337. * Augment a target Object or Array by intercepting
  45338. * the prototype chain using __proto__
  45339. */
  45340. function protoAugment (target, src) {
  45341. /* eslint-disable no-proto */
  45342. target.__proto__ = src;
  45343. /* eslint-enable no-proto */
  45344. }
  45345. /**
  45346. * Augment a target Object or Array by defining
  45347. * hidden properties.
  45348. */
  45349. /* istanbul ignore next */
  45350. function copyAugment (target, src, keys) {
  45351. for (var i = 0, l = keys.length; i < l; i++) {
  45352. var key = keys[i];
  45353. def(target, key, src[key]);
  45354. }
  45355. }
  45356. /**
  45357. * Attempt to create an observer instance for a value,
  45358. * returns the new observer if successfully observed,
  45359. * or the existing observer if the value already has one.
  45360. */
  45361. function observe (value, asRootData) {
  45362. if (!isObject(value) || value instanceof VNode) {
  45363. return
  45364. }
  45365. var ob;
  45366. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45367. ob = value.__ob__;
  45368. } else if (
  45369. shouldObserve &&
  45370. !isServerRendering() &&
  45371. (Array.isArray(value) || isPlainObject(value)) &&
  45372. Object.isExtensible(value) &&
  45373. !value._isVue
  45374. ) {
  45375. ob = new Observer(value);
  45376. }
  45377. if (asRootData && ob) {
  45378. ob.vmCount++;
  45379. }
  45380. return ob
  45381. }
  45382. /**
  45383. * Define a reactive property on an Object.
  45384. */
  45385. function defineReactive$$1 (
  45386. obj,
  45387. key,
  45388. val,
  45389. customSetter,
  45390. shallow
  45391. ) {
  45392. var dep = new Dep();
  45393. var property = Object.getOwnPropertyDescriptor(obj, key);
  45394. if (property && property.configurable === false) {
  45395. return
  45396. }
  45397. // cater for pre-defined getter/setters
  45398. var getter = property && property.get;
  45399. var setter = property && property.set;
  45400. if ((!getter || setter) && arguments.length === 2) {
  45401. val = obj[key];
  45402. }
  45403. var childOb = !shallow && observe(val);
  45404. Object.defineProperty(obj, key, {
  45405. enumerable: true,
  45406. configurable: true,
  45407. get: function reactiveGetter () {
  45408. var value = getter ? getter.call(obj) : val;
  45409. if (Dep.target) {
  45410. dep.depend();
  45411. if (childOb) {
  45412. childOb.dep.depend();
  45413. if (Array.isArray(value)) {
  45414. dependArray(value);
  45415. }
  45416. }
  45417. }
  45418. return value
  45419. },
  45420. set: function reactiveSetter (newVal) {
  45421. var value = getter ? getter.call(obj) : val;
  45422. /* eslint-disable no-self-compare */
  45423. if (newVal === value || (newVal !== newVal && value !== value)) {
  45424. return
  45425. }
  45426. /* eslint-enable no-self-compare */
  45427. if (customSetter) {
  45428. customSetter();
  45429. }
  45430. // #7981: for accessor properties without setter
  45431. if (getter && !setter) { return }
  45432. if (setter) {
  45433. setter.call(obj, newVal);
  45434. } else {
  45435. val = newVal;
  45436. }
  45437. childOb = !shallow && observe(newVal);
  45438. dep.notify();
  45439. }
  45440. });
  45441. }
  45442. /**
  45443. * Set a property on an object. Adds the new property and
  45444. * triggers change notification if the property doesn't
  45445. * already exist.
  45446. */
  45447. function set (target, key, val) {
  45448. if (isUndef(target) || isPrimitive(target)
  45449. ) {
  45450. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45451. }
  45452. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45453. target.length = Math.max(target.length, key);
  45454. target.splice(key, 1, val);
  45455. return val
  45456. }
  45457. if (key in target && !(key in Object.prototype)) {
  45458. target[key] = val;
  45459. return val
  45460. }
  45461. var ob = (target).__ob__;
  45462. if (target._isVue || (ob && ob.vmCount)) {
  45463. warn(
  45464. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45465. 'at runtime - declare it upfront in the data option.'
  45466. );
  45467. return val
  45468. }
  45469. if (!ob) {
  45470. target[key] = val;
  45471. return val
  45472. }
  45473. defineReactive$$1(ob.value, key, val);
  45474. ob.dep.notify();
  45475. return val
  45476. }
  45477. /**
  45478. * Delete a property and trigger change if necessary.
  45479. */
  45480. function del (target, key) {
  45481. if (isUndef(target) || isPrimitive(target)
  45482. ) {
  45483. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45484. }
  45485. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45486. target.splice(key, 1);
  45487. return
  45488. }
  45489. var ob = (target).__ob__;
  45490. if (target._isVue || (ob && ob.vmCount)) {
  45491. warn(
  45492. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45493. '- just set it to null.'
  45494. );
  45495. return
  45496. }
  45497. if (!hasOwn(target, key)) {
  45498. return
  45499. }
  45500. delete target[key];
  45501. if (!ob) {
  45502. return
  45503. }
  45504. ob.dep.notify();
  45505. }
  45506. /**
  45507. * Collect dependencies on array elements when the array is touched, since
  45508. * we cannot intercept array element access like property getters.
  45509. */
  45510. function dependArray (value) {
  45511. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45512. e = value[i];
  45513. e && e.__ob__ && e.__ob__.dep.depend();
  45514. if (Array.isArray(e)) {
  45515. dependArray(e);
  45516. }
  45517. }
  45518. }
  45519. /* */
  45520. /**
  45521. * Option overwriting strategies are functions that handle
  45522. * how to merge a parent option value and a child option
  45523. * value into the final value.
  45524. */
  45525. var strats = config.optionMergeStrategies;
  45526. /**
  45527. * Options with restrictions
  45528. */
  45529. {
  45530. strats.el = strats.propsData = function (parent, child, vm, key) {
  45531. if (!vm) {
  45532. warn(
  45533. "option \"" + key + "\" can only be used during instance " +
  45534. 'creation with the `new` keyword.'
  45535. );
  45536. }
  45537. return defaultStrat(parent, child)
  45538. };
  45539. }
  45540. /**
  45541. * Helper that recursively merges two data objects together.
  45542. */
  45543. function mergeData (to, from) {
  45544. if (!from) { return to }
  45545. var key, toVal, fromVal;
  45546. var keys = hasSymbol
  45547. ? Reflect.ownKeys(from)
  45548. : Object.keys(from);
  45549. for (var i = 0; i < keys.length; i++) {
  45550. key = keys[i];
  45551. // in case the object is already observed...
  45552. if (key === '__ob__') { continue }
  45553. toVal = to[key];
  45554. fromVal = from[key];
  45555. if (!hasOwn(to, key)) {
  45556. set(to, key, fromVal);
  45557. } else if (
  45558. toVal !== fromVal &&
  45559. isPlainObject(toVal) &&
  45560. isPlainObject(fromVal)
  45561. ) {
  45562. mergeData(toVal, fromVal);
  45563. }
  45564. }
  45565. return to
  45566. }
  45567. /**
  45568. * Data
  45569. */
  45570. function mergeDataOrFn (
  45571. parentVal,
  45572. childVal,
  45573. vm
  45574. ) {
  45575. if (!vm) {
  45576. // in a Vue.extend merge, both should be functions
  45577. if (!childVal) {
  45578. return parentVal
  45579. }
  45580. if (!parentVal) {
  45581. return childVal
  45582. }
  45583. // when parentVal & childVal are both present,
  45584. // we need to return a function that returns the
  45585. // merged result of both functions... no need to
  45586. // check if parentVal is a function here because
  45587. // it has to be a function to pass previous merges.
  45588. return function mergedDataFn () {
  45589. return mergeData(
  45590. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45591. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45592. )
  45593. }
  45594. } else {
  45595. return function mergedInstanceDataFn () {
  45596. // instance merge
  45597. var instanceData = typeof childVal === 'function'
  45598. ? childVal.call(vm, vm)
  45599. : childVal;
  45600. var defaultData = typeof parentVal === 'function'
  45601. ? parentVal.call(vm, vm)
  45602. : parentVal;
  45603. if (instanceData) {
  45604. return mergeData(instanceData, defaultData)
  45605. } else {
  45606. return defaultData
  45607. }
  45608. }
  45609. }
  45610. }
  45611. strats.data = function (
  45612. parentVal,
  45613. childVal,
  45614. vm
  45615. ) {
  45616. if (!vm) {
  45617. if (childVal && typeof childVal !== 'function') {
  45618. warn(
  45619. 'The "data" option should be a function ' +
  45620. 'that returns a per-instance value in component ' +
  45621. 'definitions.',
  45622. vm
  45623. );
  45624. return parentVal
  45625. }
  45626. return mergeDataOrFn(parentVal, childVal)
  45627. }
  45628. return mergeDataOrFn(parentVal, childVal, vm)
  45629. };
  45630. /**
  45631. * Hooks and props are merged as arrays.
  45632. */
  45633. function mergeHook (
  45634. parentVal,
  45635. childVal
  45636. ) {
  45637. var res = childVal
  45638. ? parentVal
  45639. ? parentVal.concat(childVal)
  45640. : Array.isArray(childVal)
  45641. ? childVal
  45642. : [childVal]
  45643. : parentVal;
  45644. return res
  45645. ? dedupeHooks(res)
  45646. : res
  45647. }
  45648. function dedupeHooks (hooks) {
  45649. var res = [];
  45650. for (var i = 0; i < hooks.length; i++) {
  45651. if (res.indexOf(hooks[i]) === -1) {
  45652. res.push(hooks[i]);
  45653. }
  45654. }
  45655. return res
  45656. }
  45657. LIFECYCLE_HOOKS.forEach(function (hook) {
  45658. strats[hook] = mergeHook;
  45659. });
  45660. /**
  45661. * Assets
  45662. *
  45663. * When a vm is present (instance creation), we need to do
  45664. * a three-way merge between constructor options, instance
  45665. * options and parent options.
  45666. */
  45667. function mergeAssets (
  45668. parentVal,
  45669. childVal,
  45670. vm,
  45671. key
  45672. ) {
  45673. var res = Object.create(parentVal || null);
  45674. if (childVal) {
  45675. assertObjectType(key, childVal, vm);
  45676. return extend(res, childVal)
  45677. } else {
  45678. return res
  45679. }
  45680. }
  45681. ASSET_TYPES.forEach(function (type) {
  45682. strats[type + 's'] = mergeAssets;
  45683. });
  45684. /**
  45685. * Watchers.
  45686. *
  45687. * Watchers hashes should not overwrite one
  45688. * another, so we merge them as arrays.
  45689. */
  45690. strats.watch = function (
  45691. parentVal,
  45692. childVal,
  45693. vm,
  45694. key
  45695. ) {
  45696. // work around Firefox's Object.prototype.watch...
  45697. if (parentVal === nativeWatch) { parentVal = undefined; }
  45698. if (childVal === nativeWatch) { childVal = undefined; }
  45699. /* istanbul ignore if */
  45700. if (!childVal) { return Object.create(parentVal || null) }
  45701. {
  45702. assertObjectType(key, childVal, vm);
  45703. }
  45704. if (!parentVal) { return childVal }
  45705. var ret = {};
  45706. extend(ret, parentVal);
  45707. for (var key$1 in childVal) {
  45708. var parent = ret[key$1];
  45709. var child = childVal[key$1];
  45710. if (parent && !Array.isArray(parent)) {
  45711. parent = [parent];
  45712. }
  45713. ret[key$1] = parent
  45714. ? parent.concat(child)
  45715. : Array.isArray(child) ? child : [child];
  45716. }
  45717. return ret
  45718. };
  45719. /**
  45720. * Other object hashes.
  45721. */
  45722. strats.props =
  45723. strats.methods =
  45724. strats.inject =
  45725. strats.computed = function (
  45726. parentVal,
  45727. childVal,
  45728. vm,
  45729. key
  45730. ) {
  45731. if (childVal && "development" !== 'production') {
  45732. assertObjectType(key, childVal, vm);
  45733. }
  45734. if (!parentVal) { return childVal }
  45735. var ret = Object.create(null);
  45736. extend(ret, parentVal);
  45737. if (childVal) { extend(ret, childVal); }
  45738. return ret
  45739. };
  45740. strats.provide = mergeDataOrFn;
  45741. /**
  45742. * Default strategy.
  45743. */
  45744. var defaultStrat = function (parentVal, childVal) {
  45745. return childVal === undefined
  45746. ? parentVal
  45747. : childVal
  45748. };
  45749. /**
  45750. * Validate component names
  45751. */
  45752. function checkComponents (options) {
  45753. for (var key in options.components) {
  45754. validateComponentName(key);
  45755. }
  45756. }
  45757. function validateComponentName (name) {
  45758. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45759. warn(
  45760. 'Invalid component name: "' + name + '". Component names ' +
  45761. 'should conform to valid custom element name in html5 specification.'
  45762. );
  45763. }
  45764. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45765. warn(
  45766. 'Do not use built-in or reserved HTML elements as component ' +
  45767. 'id: ' + name
  45768. );
  45769. }
  45770. }
  45771. /**
  45772. * Ensure all props option syntax are normalized into the
  45773. * Object-based format.
  45774. */
  45775. function normalizeProps (options, vm) {
  45776. var props = options.props;
  45777. if (!props) { return }
  45778. var res = {};
  45779. var i, val, name;
  45780. if (Array.isArray(props)) {
  45781. i = props.length;
  45782. while (i--) {
  45783. val = props[i];
  45784. if (typeof val === 'string') {
  45785. name = camelize(val);
  45786. res[name] = { type: null };
  45787. } else {
  45788. warn('props must be strings when using array syntax.');
  45789. }
  45790. }
  45791. } else if (isPlainObject(props)) {
  45792. for (var key in props) {
  45793. val = props[key];
  45794. name = camelize(key);
  45795. res[name] = isPlainObject(val)
  45796. ? val
  45797. : { type: val };
  45798. }
  45799. } else {
  45800. warn(
  45801. "Invalid value for option \"props\": expected an Array or an Object, " +
  45802. "but got " + (toRawType(props)) + ".",
  45803. vm
  45804. );
  45805. }
  45806. options.props = res;
  45807. }
  45808. /**
  45809. * Normalize all injections into Object-based format
  45810. */
  45811. function normalizeInject (options, vm) {
  45812. var inject = options.inject;
  45813. if (!inject) { return }
  45814. var normalized = options.inject = {};
  45815. if (Array.isArray(inject)) {
  45816. for (var i = 0; i < inject.length; i++) {
  45817. normalized[inject[i]] = { from: inject[i] };
  45818. }
  45819. } else if (isPlainObject(inject)) {
  45820. for (var key in inject) {
  45821. var val = inject[key];
  45822. normalized[key] = isPlainObject(val)
  45823. ? extend({ from: key }, val)
  45824. : { from: val };
  45825. }
  45826. } else {
  45827. warn(
  45828. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45829. "but got " + (toRawType(inject)) + ".",
  45830. vm
  45831. );
  45832. }
  45833. }
  45834. /**
  45835. * Normalize raw function directives into object format.
  45836. */
  45837. function normalizeDirectives (options) {
  45838. var dirs = options.directives;
  45839. if (dirs) {
  45840. for (var key in dirs) {
  45841. var def$$1 = dirs[key];
  45842. if (typeof def$$1 === 'function') {
  45843. dirs[key] = { bind: def$$1, update: def$$1 };
  45844. }
  45845. }
  45846. }
  45847. }
  45848. function assertObjectType (name, value, vm) {
  45849. if (!isPlainObject(value)) {
  45850. warn(
  45851. "Invalid value for option \"" + name + "\": expected an Object, " +
  45852. "but got " + (toRawType(value)) + ".",
  45853. vm
  45854. );
  45855. }
  45856. }
  45857. /**
  45858. * Merge two option objects into a new one.
  45859. * Core utility used in both instantiation and inheritance.
  45860. */
  45861. function mergeOptions (
  45862. parent,
  45863. child,
  45864. vm
  45865. ) {
  45866. {
  45867. checkComponents(child);
  45868. }
  45869. if (typeof child === 'function') {
  45870. child = child.options;
  45871. }
  45872. normalizeProps(child, vm);
  45873. normalizeInject(child, vm);
  45874. normalizeDirectives(child);
  45875. // Apply extends and mixins on the child options,
  45876. // but only if it is a raw options object that isn't
  45877. // the result of another mergeOptions call.
  45878. // Only merged options has the _base property.
  45879. if (!child._base) {
  45880. if (child.extends) {
  45881. parent = mergeOptions(parent, child.extends, vm);
  45882. }
  45883. if (child.mixins) {
  45884. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45885. parent = mergeOptions(parent, child.mixins[i], vm);
  45886. }
  45887. }
  45888. }
  45889. var options = {};
  45890. var key;
  45891. for (key in parent) {
  45892. mergeField(key);
  45893. }
  45894. for (key in child) {
  45895. if (!hasOwn(parent, key)) {
  45896. mergeField(key);
  45897. }
  45898. }
  45899. function mergeField (key) {
  45900. var strat = strats[key] || defaultStrat;
  45901. options[key] = strat(parent[key], child[key], vm, key);
  45902. }
  45903. return options
  45904. }
  45905. /**
  45906. * Resolve an asset.
  45907. * This function is used because child instances need access
  45908. * to assets defined in its ancestor chain.
  45909. */
  45910. function resolveAsset (
  45911. options,
  45912. type,
  45913. id,
  45914. warnMissing
  45915. ) {
  45916. /* istanbul ignore if */
  45917. if (typeof id !== 'string') {
  45918. return
  45919. }
  45920. var assets = options[type];
  45921. // check local registration variations first
  45922. if (hasOwn(assets, id)) { return assets[id] }
  45923. var camelizedId = camelize(id);
  45924. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45925. var PascalCaseId = capitalize(camelizedId);
  45926. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45927. // fallback to prototype chain
  45928. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45929. if (warnMissing && !res) {
  45930. warn(
  45931. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45932. options
  45933. );
  45934. }
  45935. return res
  45936. }
  45937. /* */
  45938. function validateProp (
  45939. key,
  45940. propOptions,
  45941. propsData,
  45942. vm
  45943. ) {
  45944. var prop = propOptions[key];
  45945. var absent = !hasOwn(propsData, key);
  45946. var value = propsData[key];
  45947. // boolean casting
  45948. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45949. if (booleanIndex > -1) {
  45950. if (absent && !hasOwn(prop, 'default')) {
  45951. value = false;
  45952. } else if (value === '' || value === hyphenate(key)) {
  45953. // only cast empty string / same name to boolean if
  45954. // boolean has higher priority
  45955. var stringIndex = getTypeIndex(String, prop.type);
  45956. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45957. value = true;
  45958. }
  45959. }
  45960. }
  45961. // check default value
  45962. if (value === undefined) {
  45963. value = getPropDefaultValue(vm, prop, key);
  45964. // since the default value is a fresh copy,
  45965. // make sure to observe it.
  45966. var prevShouldObserve = shouldObserve;
  45967. toggleObserving(true);
  45968. observe(value);
  45969. toggleObserving(prevShouldObserve);
  45970. }
  45971. {
  45972. assertProp(prop, key, value, vm, absent);
  45973. }
  45974. return value
  45975. }
  45976. /**
  45977. * Get the default value of a prop.
  45978. */
  45979. function getPropDefaultValue (vm, prop, key) {
  45980. // no default, return undefined
  45981. if (!hasOwn(prop, 'default')) {
  45982. return undefined
  45983. }
  45984. var def = prop.default;
  45985. // warn against non-factory defaults for Object & Array
  45986. if (isObject(def)) {
  45987. warn(
  45988. 'Invalid default value for prop "' + key + '": ' +
  45989. 'Props with type Object/Array must use a factory function ' +
  45990. 'to return the default value.',
  45991. vm
  45992. );
  45993. }
  45994. // the raw prop value was also undefined from previous render,
  45995. // return previous default value to avoid unnecessary watcher trigger
  45996. if (vm && vm.$options.propsData &&
  45997. vm.$options.propsData[key] === undefined &&
  45998. vm._props[key] !== undefined
  45999. ) {
  46000. return vm._props[key]
  46001. }
  46002. // call factory function for non-Function types
  46003. // a value is Function if its prototype is function even across different execution context
  46004. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46005. ? def.call(vm)
  46006. : def
  46007. }
  46008. /**
  46009. * Assert whether a prop is valid.
  46010. */
  46011. function assertProp (
  46012. prop,
  46013. name,
  46014. value,
  46015. vm,
  46016. absent
  46017. ) {
  46018. if (prop.required && absent) {
  46019. warn(
  46020. 'Missing required prop: "' + name + '"',
  46021. vm
  46022. );
  46023. return
  46024. }
  46025. if (value == null && !prop.required) {
  46026. return
  46027. }
  46028. var type = prop.type;
  46029. var valid = !type || type === true;
  46030. var expectedTypes = [];
  46031. if (type) {
  46032. if (!Array.isArray(type)) {
  46033. type = [type];
  46034. }
  46035. for (var i = 0; i < type.length && !valid; i++) {
  46036. var assertedType = assertType(value, type[i]);
  46037. expectedTypes.push(assertedType.expectedType || '');
  46038. valid = assertedType.valid;
  46039. }
  46040. }
  46041. if (!valid) {
  46042. warn(
  46043. getInvalidTypeMessage(name, value, expectedTypes),
  46044. vm
  46045. );
  46046. return
  46047. }
  46048. var validator = prop.validator;
  46049. if (validator) {
  46050. if (!validator(value)) {
  46051. warn(
  46052. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46053. vm
  46054. );
  46055. }
  46056. }
  46057. }
  46058. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46059. function assertType (value, type) {
  46060. var valid;
  46061. var expectedType = getType(type);
  46062. if (simpleCheckRE.test(expectedType)) {
  46063. var t = typeof value;
  46064. valid = t === expectedType.toLowerCase();
  46065. // for primitive wrapper objects
  46066. if (!valid && t === 'object') {
  46067. valid = value instanceof type;
  46068. }
  46069. } else if (expectedType === 'Object') {
  46070. valid = isPlainObject(value);
  46071. } else if (expectedType === 'Array') {
  46072. valid = Array.isArray(value);
  46073. } else {
  46074. valid = value instanceof type;
  46075. }
  46076. return {
  46077. valid: valid,
  46078. expectedType: expectedType
  46079. }
  46080. }
  46081. /**
  46082. * Use function string name to check built-in types,
  46083. * because a simple equality check will fail when running
  46084. * across different vms / iframes.
  46085. */
  46086. function getType (fn) {
  46087. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46088. return match ? match[1] : ''
  46089. }
  46090. function isSameType (a, b) {
  46091. return getType(a) === getType(b)
  46092. }
  46093. function getTypeIndex (type, expectedTypes) {
  46094. if (!Array.isArray(expectedTypes)) {
  46095. return isSameType(expectedTypes, type) ? 0 : -1
  46096. }
  46097. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46098. if (isSameType(expectedTypes[i], type)) {
  46099. return i
  46100. }
  46101. }
  46102. return -1
  46103. }
  46104. function getInvalidTypeMessage (name, value, expectedTypes) {
  46105. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46106. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46107. var expectedType = expectedTypes[0];
  46108. var receivedType = toRawType(value);
  46109. var expectedValue = styleValue(value, expectedType);
  46110. var receivedValue = styleValue(value, receivedType);
  46111. // check if we need to specify expected value
  46112. if (expectedTypes.length === 1 &&
  46113. isExplicable(expectedType) &&
  46114. !isBoolean(expectedType, receivedType)) {
  46115. message += " with value " + expectedValue;
  46116. }
  46117. message += ", got " + receivedType + " ";
  46118. // check if we need to specify received value
  46119. if (isExplicable(receivedType)) {
  46120. message += "with value " + receivedValue + ".";
  46121. }
  46122. return message
  46123. }
  46124. function styleValue (value, type) {
  46125. if (type === 'String') {
  46126. return ("\"" + value + "\"")
  46127. } else if (type === 'Number') {
  46128. return ("" + (Number(value)))
  46129. } else {
  46130. return ("" + value)
  46131. }
  46132. }
  46133. function isExplicable (value) {
  46134. var explicitTypes = ['string', 'number', 'boolean'];
  46135. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46136. }
  46137. function isBoolean () {
  46138. var args = [], len = arguments.length;
  46139. while ( len-- ) args[ len ] = arguments[ len ];
  46140. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46141. }
  46142. /* */
  46143. function handleError (err, vm, info) {
  46144. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46145. // See: https://github.com/vuejs/vuex/issues/1505
  46146. pushTarget();
  46147. try {
  46148. if (vm) {
  46149. var cur = vm;
  46150. while ((cur = cur.$parent)) {
  46151. var hooks = cur.$options.errorCaptured;
  46152. if (hooks) {
  46153. for (var i = 0; i < hooks.length; i++) {
  46154. try {
  46155. var capture = hooks[i].call(cur, err, vm, info) === false;
  46156. if (capture) { return }
  46157. } catch (e) {
  46158. globalHandleError(e, cur, 'errorCaptured hook');
  46159. }
  46160. }
  46161. }
  46162. }
  46163. }
  46164. globalHandleError(err, vm, info);
  46165. } finally {
  46166. popTarget();
  46167. }
  46168. }
  46169. function invokeWithErrorHandling (
  46170. handler,
  46171. context,
  46172. args,
  46173. vm,
  46174. info
  46175. ) {
  46176. var res;
  46177. try {
  46178. res = args ? handler.apply(context, args) : handler.call(context);
  46179. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46180. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46181. // issue #9511
  46182. // avoid catch triggering multiple times when nested calls
  46183. res._handled = true;
  46184. }
  46185. } catch (e) {
  46186. handleError(e, vm, info);
  46187. }
  46188. return res
  46189. }
  46190. function globalHandleError (err, vm, info) {
  46191. if (config.errorHandler) {
  46192. try {
  46193. return config.errorHandler.call(null, err, vm, info)
  46194. } catch (e) {
  46195. // if the user intentionally throws the original error in the handler,
  46196. // do not log it twice
  46197. if (e !== err) {
  46198. logError(e, null, 'config.errorHandler');
  46199. }
  46200. }
  46201. }
  46202. logError(err, vm, info);
  46203. }
  46204. function logError (err, vm, info) {
  46205. {
  46206. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46207. }
  46208. /* istanbul ignore else */
  46209. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46210. console.error(err);
  46211. } else {
  46212. throw err
  46213. }
  46214. }
  46215. /* */
  46216. var isUsingMicroTask = false;
  46217. var callbacks = [];
  46218. var pending = false;
  46219. function flushCallbacks () {
  46220. pending = false;
  46221. var copies = callbacks.slice(0);
  46222. callbacks.length = 0;
  46223. for (var i = 0; i < copies.length; i++) {
  46224. copies[i]();
  46225. }
  46226. }
  46227. // Here we have async deferring wrappers using microtasks.
  46228. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46229. // However, it has subtle problems when state is changed right before repaint
  46230. // (e.g. #6813, out-in transitions).
  46231. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46232. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46233. // So we now use microtasks everywhere, again.
  46234. // A major drawback of this tradeoff is that there are some scenarios
  46235. // where microtasks have too high a priority and fire in between supposedly
  46236. // sequential events (e.g. #4521, #6690, which have workarounds)
  46237. // or even between bubbling of the same event (#6566).
  46238. var timerFunc;
  46239. // The nextTick behavior leverages the microtask queue, which can be accessed
  46240. // via either native Promise.then or MutationObserver.
  46241. // MutationObserver has wider support, however it is seriously bugged in
  46242. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46243. // completely stops working after triggering a few times... so, if native
  46244. // Promise is available, we will use it:
  46245. /* istanbul ignore next, $flow-disable-line */
  46246. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46247. var p = Promise.resolve();
  46248. timerFunc = function () {
  46249. p.then(flushCallbacks);
  46250. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46251. // it can get stuck in a weird state where callbacks are pushed into the
  46252. // microtask queue but the queue isn't being flushed, until the browser
  46253. // needs to do some other work, e.g. handle a timer. Therefore we can
  46254. // "force" the microtask queue to be flushed by adding an empty timer.
  46255. if (isIOS) { setTimeout(noop); }
  46256. };
  46257. isUsingMicroTask = true;
  46258. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46259. isNative(MutationObserver) ||
  46260. // PhantomJS and iOS 7.x
  46261. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46262. )) {
  46263. // Use MutationObserver where native Promise is not available,
  46264. // e.g. PhantomJS, iOS7, Android 4.4
  46265. // (#6466 MutationObserver is unreliable in IE11)
  46266. var counter = 1;
  46267. var observer = new MutationObserver(flushCallbacks);
  46268. var textNode = document.createTextNode(String(counter));
  46269. observer.observe(textNode, {
  46270. characterData: true
  46271. });
  46272. timerFunc = function () {
  46273. counter = (counter + 1) % 2;
  46274. textNode.data = String(counter);
  46275. };
  46276. isUsingMicroTask = true;
  46277. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46278. // Fallback to setImmediate.
  46279. // Technically it leverages the (macro) task queue,
  46280. // but it is still a better choice than setTimeout.
  46281. timerFunc = function () {
  46282. setImmediate(flushCallbacks);
  46283. };
  46284. } else {
  46285. // Fallback to setTimeout.
  46286. timerFunc = function () {
  46287. setTimeout(flushCallbacks, 0);
  46288. };
  46289. }
  46290. function nextTick (cb, ctx) {
  46291. var _resolve;
  46292. callbacks.push(function () {
  46293. if (cb) {
  46294. try {
  46295. cb.call(ctx);
  46296. } catch (e) {
  46297. handleError(e, ctx, 'nextTick');
  46298. }
  46299. } else if (_resolve) {
  46300. _resolve(ctx);
  46301. }
  46302. });
  46303. if (!pending) {
  46304. pending = true;
  46305. timerFunc();
  46306. }
  46307. // $flow-disable-line
  46308. if (!cb && typeof Promise !== 'undefined') {
  46309. return new Promise(function (resolve) {
  46310. _resolve = resolve;
  46311. })
  46312. }
  46313. }
  46314. /* */
  46315. var mark;
  46316. var measure;
  46317. {
  46318. var perf = inBrowser && window.performance;
  46319. /* istanbul ignore if */
  46320. if (
  46321. perf &&
  46322. perf.mark &&
  46323. perf.measure &&
  46324. perf.clearMarks &&
  46325. perf.clearMeasures
  46326. ) {
  46327. mark = function (tag) { return perf.mark(tag); };
  46328. measure = function (name, startTag, endTag) {
  46329. perf.measure(name, startTag, endTag);
  46330. perf.clearMarks(startTag);
  46331. perf.clearMarks(endTag);
  46332. // perf.clearMeasures(name)
  46333. };
  46334. }
  46335. }
  46336. /* not type checking this file because flow doesn't play well with Proxy */
  46337. var initProxy;
  46338. {
  46339. var allowedGlobals = makeMap(
  46340. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46341. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46342. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46343. 'require' // for Webpack/Browserify
  46344. );
  46345. var warnNonPresent = function (target, key) {
  46346. warn(
  46347. "Property or method \"" + key + "\" is not defined on the instance but " +
  46348. 'referenced during render. Make sure that this property is reactive, ' +
  46349. 'either in the data option, or for class-based components, by ' +
  46350. 'initializing the property. ' +
  46351. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46352. target
  46353. );
  46354. };
  46355. var warnReservedPrefix = function (target, key) {
  46356. warn(
  46357. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46358. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46359. 'prevent conflicts with Vue internals. ' +
  46360. 'See: https://vuejs.org/v2/api/#data',
  46361. target
  46362. );
  46363. };
  46364. var hasProxy =
  46365. typeof Proxy !== 'undefined' && isNative(Proxy);
  46366. if (hasProxy) {
  46367. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46368. config.keyCodes = new Proxy(config.keyCodes, {
  46369. set: function set (target, key, value) {
  46370. if (isBuiltInModifier(key)) {
  46371. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46372. return false
  46373. } else {
  46374. target[key] = value;
  46375. return true
  46376. }
  46377. }
  46378. });
  46379. }
  46380. var hasHandler = {
  46381. has: function has (target, key) {
  46382. var has = key in target;
  46383. var isAllowed = allowedGlobals(key) ||
  46384. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46385. if (!has && !isAllowed) {
  46386. if (key in target.$data) { warnReservedPrefix(target, key); }
  46387. else { warnNonPresent(target, key); }
  46388. }
  46389. return has || !isAllowed
  46390. }
  46391. };
  46392. var getHandler = {
  46393. get: function get (target, key) {
  46394. if (typeof key === 'string' && !(key in target)) {
  46395. if (key in target.$data) { warnReservedPrefix(target, key); }
  46396. else { warnNonPresent(target, key); }
  46397. }
  46398. return target[key]
  46399. }
  46400. };
  46401. initProxy = function initProxy (vm) {
  46402. if (hasProxy) {
  46403. // determine which proxy handler to use
  46404. var options = vm.$options;
  46405. var handlers = options.render && options.render._withStripped
  46406. ? getHandler
  46407. : hasHandler;
  46408. vm._renderProxy = new Proxy(vm, handlers);
  46409. } else {
  46410. vm._renderProxy = vm;
  46411. }
  46412. };
  46413. }
  46414. /* */
  46415. var seenObjects = new _Set();
  46416. /**
  46417. * Recursively traverse an object to evoke all converted
  46418. * getters, so that every nested property inside the object
  46419. * is collected as a "deep" dependency.
  46420. */
  46421. function traverse (val) {
  46422. _traverse(val, seenObjects);
  46423. seenObjects.clear();
  46424. }
  46425. function _traverse (val, seen) {
  46426. var i, keys;
  46427. var isA = Array.isArray(val);
  46428. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46429. return
  46430. }
  46431. if (val.__ob__) {
  46432. var depId = val.__ob__.dep.id;
  46433. if (seen.has(depId)) {
  46434. return
  46435. }
  46436. seen.add(depId);
  46437. }
  46438. if (isA) {
  46439. i = val.length;
  46440. while (i--) { _traverse(val[i], seen); }
  46441. } else {
  46442. keys = Object.keys(val);
  46443. i = keys.length;
  46444. while (i--) { _traverse(val[keys[i]], seen); }
  46445. }
  46446. }
  46447. /* */
  46448. var normalizeEvent = cached(function (name) {
  46449. var passive = name.charAt(0) === '&';
  46450. name = passive ? name.slice(1) : name;
  46451. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46452. name = once$$1 ? name.slice(1) : name;
  46453. var capture = name.charAt(0) === '!';
  46454. name = capture ? name.slice(1) : name;
  46455. return {
  46456. name: name,
  46457. once: once$$1,
  46458. capture: capture,
  46459. passive: passive
  46460. }
  46461. });
  46462. function createFnInvoker (fns, vm) {
  46463. function invoker () {
  46464. var arguments$1 = arguments;
  46465. var fns = invoker.fns;
  46466. if (Array.isArray(fns)) {
  46467. var cloned = fns.slice();
  46468. for (var i = 0; i < cloned.length; i++) {
  46469. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46470. }
  46471. } else {
  46472. // return handler return value for single handlers
  46473. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46474. }
  46475. }
  46476. invoker.fns = fns;
  46477. return invoker
  46478. }
  46479. function updateListeners (
  46480. on,
  46481. oldOn,
  46482. add,
  46483. remove$$1,
  46484. createOnceHandler,
  46485. vm
  46486. ) {
  46487. var name, def$$1, cur, old, event;
  46488. for (name in on) {
  46489. def$$1 = cur = on[name];
  46490. old = oldOn[name];
  46491. event = normalizeEvent(name);
  46492. if (isUndef(cur)) {
  46493. warn(
  46494. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46495. vm
  46496. );
  46497. } else if (isUndef(old)) {
  46498. if (isUndef(cur.fns)) {
  46499. cur = on[name] = createFnInvoker(cur, vm);
  46500. }
  46501. if (isTrue(event.once)) {
  46502. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46503. }
  46504. add(event.name, cur, event.capture, event.passive, event.params);
  46505. } else if (cur !== old) {
  46506. old.fns = cur;
  46507. on[name] = old;
  46508. }
  46509. }
  46510. for (name in oldOn) {
  46511. if (isUndef(on[name])) {
  46512. event = normalizeEvent(name);
  46513. remove$$1(event.name, oldOn[name], event.capture);
  46514. }
  46515. }
  46516. }
  46517. /* */
  46518. function mergeVNodeHook (def, hookKey, hook) {
  46519. if (def instanceof VNode) {
  46520. def = def.data.hook || (def.data.hook = {});
  46521. }
  46522. var invoker;
  46523. var oldHook = def[hookKey];
  46524. function wrappedHook () {
  46525. hook.apply(this, arguments);
  46526. // important: remove merged hook to ensure it's called only once
  46527. // and prevent memory leak
  46528. remove(invoker.fns, wrappedHook);
  46529. }
  46530. if (isUndef(oldHook)) {
  46531. // no existing hook
  46532. invoker = createFnInvoker([wrappedHook]);
  46533. } else {
  46534. /* istanbul ignore if */
  46535. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46536. // already a merged invoker
  46537. invoker = oldHook;
  46538. invoker.fns.push(wrappedHook);
  46539. } else {
  46540. // existing plain hook
  46541. invoker = createFnInvoker([oldHook, wrappedHook]);
  46542. }
  46543. }
  46544. invoker.merged = true;
  46545. def[hookKey] = invoker;
  46546. }
  46547. /* */
  46548. function extractPropsFromVNodeData (
  46549. data,
  46550. Ctor,
  46551. tag
  46552. ) {
  46553. // we are only extracting raw values here.
  46554. // validation and default values are handled in the child
  46555. // component itself.
  46556. var propOptions = Ctor.options.props;
  46557. if (isUndef(propOptions)) {
  46558. return
  46559. }
  46560. var res = {};
  46561. var attrs = data.attrs;
  46562. var props = data.props;
  46563. if (isDef(attrs) || isDef(props)) {
  46564. for (var key in propOptions) {
  46565. var altKey = hyphenate(key);
  46566. {
  46567. var keyInLowerCase = key.toLowerCase();
  46568. if (
  46569. key !== keyInLowerCase &&
  46570. attrs && hasOwn(attrs, keyInLowerCase)
  46571. ) {
  46572. tip(
  46573. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46574. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46575. " \"" + key + "\". " +
  46576. "Note that HTML attributes are case-insensitive and camelCased " +
  46577. "props need to use their kebab-case equivalents when using in-DOM " +
  46578. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46579. );
  46580. }
  46581. }
  46582. checkProp(res, props, key, altKey, true) ||
  46583. checkProp(res, attrs, key, altKey, false);
  46584. }
  46585. }
  46586. return res
  46587. }
  46588. function checkProp (
  46589. res,
  46590. hash,
  46591. key,
  46592. altKey,
  46593. preserve
  46594. ) {
  46595. if (isDef(hash)) {
  46596. if (hasOwn(hash, key)) {
  46597. res[key] = hash[key];
  46598. if (!preserve) {
  46599. delete hash[key];
  46600. }
  46601. return true
  46602. } else if (hasOwn(hash, altKey)) {
  46603. res[key] = hash[altKey];
  46604. if (!preserve) {
  46605. delete hash[altKey];
  46606. }
  46607. return true
  46608. }
  46609. }
  46610. return false
  46611. }
  46612. /* */
  46613. // The template compiler attempts to minimize the need for normalization by
  46614. // statically analyzing the template at compile time.
  46615. //
  46616. // For plain HTML markup, normalization can be completely skipped because the
  46617. // generated render function is guaranteed to return Array<VNode>. There are
  46618. // two cases where extra normalization is needed:
  46619. // 1. When the children contains components - because a functional component
  46620. // may return an Array instead of a single root. In this case, just a simple
  46621. // normalization is needed - if any child is an Array, we flatten the whole
  46622. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46623. // because functional components already normalize their own children.
  46624. function simpleNormalizeChildren (children) {
  46625. for (var i = 0; i < children.length; i++) {
  46626. if (Array.isArray(children[i])) {
  46627. return Array.prototype.concat.apply([], children)
  46628. }
  46629. }
  46630. return children
  46631. }
  46632. // 2. When the children contains constructs that always generated nested Arrays,
  46633. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46634. // with hand-written render functions / JSX. In such cases a full normalization
  46635. // is needed to cater to all possible types of children values.
  46636. function normalizeChildren (children) {
  46637. return isPrimitive(children)
  46638. ? [createTextVNode(children)]
  46639. : Array.isArray(children)
  46640. ? normalizeArrayChildren(children)
  46641. : undefined
  46642. }
  46643. function isTextNode (node) {
  46644. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46645. }
  46646. function normalizeArrayChildren (children, nestedIndex) {
  46647. var res = [];
  46648. var i, c, lastIndex, last;
  46649. for (i = 0; i < children.length; i++) {
  46650. c = children[i];
  46651. if (isUndef(c) || typeof c === 'boolean') { continue }
  46652. lastIndex = res.length - 1;
  46653. last = res[lastIndex];
  46654. // nested
  46655. if (Array.isArray(c)) {
  46656. if (c.length > 0) {
  46657. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46658. // merge adjacent text nodes
  46659. if (isTextNode(c[0]) && isTextNode(last)) {
  46660. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46661. c.shift();
  46662. }
  46663. res.push.apply(res, c);
  46664. }
  46665. } else if (isPrimitive(c)) {
  46666. if (isTextNode(last)) {
  46667. // merge adjacent text nodes
  46668. // this is necessary for SSR hydration because text nodes are
  46669. // essentially merged when rendered to HTML strings
  46670. res[lastIndex] = createTextVNode(last.text + c);
  46671. } else if (c !== '') {
  46672. // convert primitive to vnode
  46673. res.push(createTextVNode(c));
  46674. }
  46675. } else {
  46676. if (isTextNode(c) && isTextNode(last)) {
  46677. // merge adjacent text nodes
  46678. res[lastIndex] = createTextVNode(last.text + c.text);
  46679. } else {
  46680. // default key for nested array children (likely generated by v-for)
  46681. if (isTrue(children._isVList) &&
  46682. isDef(c.tag) &&
  46683. isUndef(c.key) &&
  46684. isDef(nestedIndex)) {
  46685. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46686. }
  46687. res.push(c);
  46688. }
  46689. }
  46690. }
  46691. return res
  46692. }
  46693. /* */
  46694. function initProvide (vm) {
  46695. var provide = vm.$options.provide;
  46696. if (provide) {
  46697. vm._provided = typeof provide === 'function'
  46698. ? provide.call(vm)
  46699. : provide;
  46700. }
  46701. }
  46702. function initInjections (vm) {
  46703. var result = resolveInject(vm.$options.inject, vm);
  46704. if (result) {
  46705. toggleObserving(false);
  46706. Object.keys(result).forEach(function (key) {
  46707. /* istanbul ignore else */
  46708. {
  46709. defineReactive$$1(vm, key, result[key], function () {
  46710. warn(
  46711. "Avoid mutating an injected value directly since the changes will be " +
  46712. "overwritten whenever the provided component re-renders. " +
  46713. "injection being mutated: \"" + key + "\"",
  46714. vm
  46715. );
  46716. });
  46717. }
  46718. });
  46719. toggleObserving(true);
  46720. }
  46721. }
  46722. function resolveInject (inject, vm) {
  46723. if (inject) {
  46724. // inject is :any because flow is not smart enough to figure out cached
  46725. var result = Object.create(null);
  46726. var keys = hasSymbol
  46727. ? Reflect.ownKeys(inject)
  46728. : Object.keys(inject);
  46729. for (var i = 0; i < keys.length; i++) {
  46730. var key = keys[i];
  46731. // #6574 in case the inject object is observed...
  46732. if (key === '__ob__') { continue }
  46733. var provideKey = inject[key].from;
  46734. var source = vm;
  46735. while (source) {
  46736. if (source._provided && hasOwn(source._provided, provideKey)) {
  46737. result[key] = source._provided[provideKey];
  46738. break
  46739. }
  46740. source = source.$parent;
  46741. }
  46742. if (!source) {
  46743. if ('default' in inject[key]) {
  46744. var provideDefault = inject[key].default;
  46745. result[key] = typeof provideDefault === 'function'
  46746. ? provideDefault.call(vm)
  46747. : provideDefault;
  46748. } else {
  46749. warn(("Injection \"" + key + "\" not found"), vm);
  46750. }
  46751. }
  46752. }
  46753. return result
  46754. }
  46755. }
  46756. /* */
  46757. /**
  46758. * Runtime helper for resolving raw children VNodes into a slot object.
  46759. */
  46760. function resolveSlots (
  46761. children,
  46762. context
  46763. ) {
  46764. if (!children || !children.length) {
  46765. return {}
  46766. }
  46767. var slots = {};
  46768. for (var i = 0, l = children.length; i < l; i++) {
  46769. var child = children[i];
  46770. var data = child.data;
  46771. // remove slot attribute if the node is resolved as a Vue slot node
  46772. if (data && data.attrs && data.attrs.slot) {
  46773. delete data.attrs.slot;
  46774. }
  46775. // named slots should only be respected if the vnode was rendered in the
  46776. // same context.
  46777. if ((child.context === context || child.fnContext === context) &&
  46778. data && data.slot != null
  46779. ) {
  46780. var name = data.slot;
  46781. var slot = (slots[name] || (slots[name] = []));
  46782. if (child.tag === 'template') {
  46783. slot.push.apply(slot, child.children || []);
  46784. } else {
  46785. slot.push(child);
  46786. }
  46787. } else {
  46788. (slots.default || (slots.default = [])).push(child);
  46789. }
  46790. }
  46791. // ignore slots that contains only whitespace
  46792. for (var name$1 in slots) {
  46793. if (slots[name$1].every(isWhitespace)) {
  46794. delete slots[name$1];
  46795. }
  46796. }
  46797. return slots
  46798. }
  46799. function isWhitespace (node) {
  46800. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46801. }
  46802. /* */
  46803. function normalizeScopedSlots (
  46804. slots,
  46805. normalSlots,
  46806. prevSlots
  46807. ) {
  46808. var res;
  46809. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46810. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46811. var key = slots && slots.$key;
  46812. if (!slots) {
  46813. res = {};
  46814. } else if (slots._normalized) {
  46815. // fast path 1: child component re-render only, parent did not change
  46816. return slots._normalized
  46817. } else if (
  46818. isStable &&
  46819. prevSlots &&
  46820. prevSlots !== emptyObject &&
  46821. key === prevSlots.$key &&
  46822. !hasNormalSlots &&
  46823. !prevSlots.$hasNormal
  46824. ) {
  46825. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46826. // only need to normalize once
  46827. return prevSlots
  46828. } else {
  46829. res = {};
  46830. for (var key$1 in slots) {
  46831. if (slots[key$1] && key$1[0] !== '$') {
  46832. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46833. }
  46834. }
  46835. }
  46836. // expose normal slots on scopedSlots
  46837. for (var key$2 in normalSlots) {
  46838. if (!(key$2 in res)) {
  46839. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46840. }
  46841. }
  46842. // avoriaz seems to mock a non-extensible $scopedSlots object
  46843. // and when that is passed down this would cause an error
  46844. if (slots && Object.isExtensible(slots)) {
  46845. (slots)._normalized = res;
  46846. }
  46847. def(res, '$stable', isStable);
  46848. def(res, '$key', key);
  46849. def(res, '$hasNormal', hasNormalSlots);
  46850. return res
  46851. }
  46852. function normalizeScopedSlot(normalSlots, key, fn) {
  46853. var normalized = function () {
  46854. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46855. res = res && typeof res === 'object' && !Array.isArray(res)
  46856. ? [res] // single vnode
  46857. : normalizeChildren(res);
  46858. return res && (
  46859. res.length === 0 ||
  46860. (res.length === 1 && res[0].isComment) // #9658
  46861. ) ? undefined
  46862. : res
  46863. };
  46864. // this is a slot using the new v-slot syntax without scope. although it is
  46865. // compiled as a scoped slot, render fn users would expect it to be present
  46866. // on this.$slots because the usage is semantically a normal slot.
  46867. if (fn.proxy) {
  46868. Object.defineProperty(normalSlots, key, {
  46869. get: normalized,
  46870. enumerable: true,
  46871. configurable: true
  46872. });
  46873. }
  46874. return normalized
  46875. }
  46876. function proxyNormalSlot(slots, key) {
  46877. return function () { return slots[key]; }
  46878. }
  46879. /* */
  46880. /**
  46881. * Runtime helper for rendering v-for lists.
  46882. */
  46883. function renderList (
  46884. val,
  46885. render
  46886. ) {
  46887. var ret, i, l, keys, key;
  46888. if (Array.isArray(val) || typeof val === 'string') {
  46889. ret = new Array(val.length);
  46890. for (i = 0, l = val.length; i < l; i++) {
  46891. ret[i] = render(val[i], i);
  46892. }
  46893. } else if (typeof val === 'number') {
  46894. ret = new Array(val);
  46895. for (i = 0; i < val; i++) {
  46896. ret[i] = render(i + 1, i);
  46897. }
  46898. } else if (isObject(val)) {
  46899. if (hasSymbol && val[Symbol.iterator]) {
  46900. ret = [];
  46901. var iterator = val[Symbol.iterator]();
  46902. var result = iterator.next();
  46903. while (!result.done) {
  46904. ret.push(render(result.value, ret.length));
  46905. result = iterator.next();
  46906. }
  46907. } else {
  46908. keys = Object.keys(val);
  46909. ret = new Array(keys.length);
  46910. for (i = 0, l = keys.length; i < l; i++) {
  46911. key = keys[i];
  46912. ret[i] = render(val[key], key, i);
  46913. }
  46914. }
  46915. }
  46916. if (!isDef(ret)) {
  46917. ret = [];
  46918. }
  46919. (ret)._isVList = true;
  46920. return ret
  46921. }
  46922. /* */
  46923. /**
  46924. * Runtime helper for rendering <slot>
  46925. */
  46926. function renderSlot (
  46927. name,
  46928. fallback,
  46929. props,
  46930. bindObject
  46931. ) {
  46932. var scopedSlotFn = this.$scopedSlots[name];
  46933. var nodes;
  46934. if (scopedSlotFn) { // scoped slot
  46935. props = props || {};
  46936. if (bindObject) {
  46937. if (!isObject(bindObject)) {
  46938. warn(
  46939. 'slot v-bind without argument expects an Object',
  46940. this
  46941. );
  46942. }
  46943. props = extend(extend({}, bindObject), props);
  46944. }
  46945. nodes = scopedSlotFn(props) || fallback;
  46946. } else {
  46947. nodes = this.$slots[name] || fallback;
  46948. }
  46949. var target = props && props.slot;
  46950. if (target) {
  46951. return this.$createElement('template', { slot: target }, nodes)
  46952. } else {
  46953. return nodes
  46954. }
  46955. }
  46956. /* */
  46957. /**
  46958. * Runtime helper for resolving filters
  46959. */
  46960. function resolveFilter (id) {
  46961. return resolveAsset(this.$options, 'filters', id, true) || identity
  46962. }
  46963. /* */
  46964. function isKeyNotMatch (expect, actual) {
  46965. if (Array.isArray(expect)) {
  46966. return expect.indexOf(actual) === -1
  46967. } else {
  46968. return expect !== actual
  46969. }
  46970. }
  46971. /**
  46972. * Runtime helper for checking keyCodes from config.
  46973. * exposed as Vue.prototype._k
  46974. * passing in eventKeyName as last argument separately for backwards compat
  46975. */
  46976. function checkKeyCodes (
  46977. eventKeyCode,
  46978. key,
  46979. builtInKeyCode,
  46980. eventKeyName,
  46981. builtInKeyName
  46982. ) {
  46983. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  46984. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  46985. return isKeyNotMatch(builtInKeyName, eventKeyName)
  46986. } else if (mappedKeyCode) {
  46987. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  46988. } else if (eventKeyName) {
  46989. return hyphenate(eventKeyName) !== key
  46990. }
  46991. }
  46992. /* */
  46993. /**
  46994. * Runtime helper for merging v-bind="object" into a VNode's data.
  46995. */
  46996. function bindObjectProps (
  46997. data,
  46998. tag,
  46999. value,
  47000. asProp,
  47001. isSync
  47002. ) {
  47003. if (value) {
  47004. if (!isObject(value)) {
  47005. warn(
  47006. 'v-bind without argument expects an Object or Array value',
  47007. this
  47008. );
  47009. } else {
  47010. if (Array.isArray(value)) {
  47011. value = toObject(value);
  47012. }
  47013. var hash;
  47014. var loop = function ( key ) {
  47015. if (
  47016. key === 'class' ||
  47017. key === 'style' ||
  47018. isReservedAttribute(key)
  47019. ) {
  47020. hash = data;
  47021. } else {
  47022. var type = data.attrs && data.attrs.type;
  47023. hash = asProp || config.mustUseProp(tag, type, key)
  47024. ? data.domProps || (data.domProps = {})
  47025. : data.attrs || (data.attrs = {});
  47026. }
  47027. var camelizedKey = camelize(key);
  47028. var hyphenatedKey = hyphenate(key);
  47029. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47030. hash[key] = value[key];
  47031. if (isSync) {
  47032. var on = data.on || (data.on = {});
  47033. on[("update:" + key)] = function ($event) {
  47034. value[key] = $event;
  47035. };
  47036. }
  47037. }
  47038. };
  47039. for (var key in value) loop( key );
  47040. }
  47041. }
  47042. return data
  47043. }
  47044. /* */
  47045. /**
  47046. * Runtime helper for rendering static trees.
  47047. */
  47048. function renderStatic (
  47049. index,
  47050. isInFor
  47051. ) {
  47052. var cached = this._staticTrees || (this._staticTrees = []);
  47053. var tree = cached[index];
  47054. // if has already-rendered static tree and not inside v-for,
  47055. // we can reuse the same tree.
  47056. if (tree && !isInFor) {
  47057. return tree
  47058. }
  47059. // otherwise, render a fresh tree.
  47060. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47061. this._renderProxy,
  47062. null,
  47063. this // for render fns generated for functional component templates
  47064. );
  47065. markStatic(tree, ("__static__" + index), false);
  47066. return tree
  47067. }
  47068. /**
  47069. * Runtime helper for v-once.
  47070. * Effectively it means marking the node as static with a unique key.
  47071. */
  47072. function markOnce (
  47073. tree,
  47074. index,
  47075. key
  47076. ) {
  47077. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47078. return tree
  47079. }
  47080. function markStatic (
  47081. tree,
  47082. key,
  47083. isOnce
  47084. ) {
  47085. if (Array.isArray(tree)) {
  47086. for (var i = 0; i < tree.length; i++) {
  47087. if (tree[i] && typeof tree[i] !== 'string') {
  47088. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47089. }
  47090. }
  47091. } else {
  47092. markStaticNode(tree, key, isOnce);
  47093. }
  47094. }
  47095. function markStaticNode (node, key, isOnce) {
  47096. node.isStatic = true;
  47097. node.key = key;
  47098. node.isOnce = isOnce;
  47099. }
  47100. /* */
  47101. function bindObjectListeners (data, value) {
  47102. if (value) {
  47103. if (!isPlainObject(value)) {
  47104. warn(
  47105. 'v-on without argument expects an Object value',
  47106. this
  47107. );
  47108. } else {
  47109. var on = data.on = data.on ? extend({}, data.on) : {};
  47110. for (var key in value) {
  47111. var existing = on[key];
  47112. var ours = value[key];
  47113. on[key] = existing ? [].concat(existing, ours) : ours;
  47114. }
  47115. }
  47116. }
  47117. return data
  47118. }
  47119. /* */
  47120. function resolveScopedSlots (
  47121. fns, // see flow/vnode
  47122. res,
  47123. // the following are added in 2.6
  47124. hasDynamicKeys,
  47125. contentHashKey
  47126. ) {
  47127. res = res || { $stable: !hasDynamicKeys };
  47128. for (var i = 0; i < fns.length; i++) {
  47129. var slot = fns[i];
  47130. if (Array.isArray(slot)) {
  47131. resolveScopedSlots(slot, res, hasDynamicKeys);
  47132. } else if (slot) {
  47133. // marker for reverse proxying v-slot without scope on this.$slots
  47134. if (slot.proxy) {
  47135. slot.fn.proxy = true;
  47136. }
  47137. res[slot.key] = slot.fn;
  47138. }
  47139. }
  47140. if (contentHashKey) {
  47141. (res).$key = contentHashKey;
  47142. }
  47143. return res
  47144. }
  47145. /* */
  47146. function bindDynamicKeys (baseObj, values) {
  47147. for (var i = 0; i < values.length; i += 2) {
  47148. var key = values[i];
  47149. if (typeof key === 'string' && key) {
  47150. baseObj[values[i]] = values[i + 1];
  47151. } else if (key !== '' && key !== null) {
  47152. // null is a special value for explicitly removing a binding
  47153. warn(
  47154. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47155. this
  47156. );
  47157. }
  47158. }
  47159. return baseObj
  47160. }
  47161. // helper to dynamically append modifier runtime markers to event names.
  47162. // ensure only append when value is already string, otherwise it will be cast
  47163. // to string and cause the type check to miss.
  47164. function prependModifier (value, symbol) {
  47165. return typeof value === 'string' ? symbol + value : value
  47166. }
  47167. /* */
  47168. function installRenderHelpers (target) {
  47169. target._o = markOnce;
  47170. target._n = toNumber;
  47171. target._s = toString;
  47172. target._l = renderList;
  47173. target._t = renderSlot;
  47174. target._q = looseEqual;
  47175. target._i = looseIndexOf;
  47176. target._m = renderStatic;
  47177. target._f = resolveFilter;
  47178. target._k = checkKeyCodes;
  47179. target._b = bindObjectProps;
  47180. target._v = createTextVNode;
  47181. target._e = createEmptyVNode;
  47182. target._u = resolveScopedSlots;
  47183. target._g = bindObjectListeners;
  47184. target._d = bindDynamicKeys;
  47185. target._p = prependModifier;
  47186. }
  47187. /* */
  47188. function FunctionalRenderContext (
  47189. data,
  47190. props,
  47191. children,
  47192. parent,
  47193. Ctor
  47194. ) {
  47195. var this$1 = this;
  47196. var options = Ctor.options;
  47197. // ensure the createElement function in functional components
  47198. // gets a unique context - this is necessary for correct named slot check
  47199. var contextVm;
  47200. if (hasOwn(parent, '_uid')) {
  47201. contextVm = Object.create(parent);
  47202. // $flow-disable-line
  47203. contextVm._original = parent;
  47204. } else {
  47205. // the context vm passed in is a functional context as well.
  47206. // in this case we want to make sure we are able to get a hold to the
  47207. // real context instance.
  47208. contextVm = parent;
  47209. // $flow-disable-line
  47210. parent = parent._original;
  47211. }
  47212. var isCompiled = isTrue(options._compiled);
  47213. var needNormalization = !isCompiled;
  47214. this.data = data;
  47215. this.props = props;
  47216. this.children = children;
  47217. this.parent = parent;
  47218. this.listeners = data.on || emptyObject;
  47219. this.injections = resolveInject(options.inject, parent);
  47220. this.slots = function () {
  47221. if (!this$1.$slots) {
  47222. normalizeScopedSlots(
  47223. data.scopedSlots,
  47224. this$1.$slots = resolveSlots(children, parent)
  47225. );
  47226. }
  47227. return this$1.$slots
  47228. };
  47229. Object.defineProperty(this, 'scopedSlots', ({
  47230. enumerable: true,
  47231. get: function get () {
  47232. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47233. }
  47234. }));
  47235. // support for compiled functional template
  47236. if (isCompiled) {
  47237. // exposing $options for renderStatic()
  47238. this.$options = options;
  47239. // pre-resolve slots for renderSlot()
  47240. this.$slots = this.slots();
  47241. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47242. }
  47243. if (options._scopeId) {
  47244. this._c = function (a, b, c, d) {
  47245. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47246. if (vnode && !Array.isArray(vnode)) {
  47247. vnode.fnScopeId = options._scopeId;
  47248. vnode.fnContext = parent;
  47249. }
  47250. return vnode
  47251. };
  47252. } else {
  47253. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47254. }
  47255. }
  47256. installRenderHelpers(FunctionalRenderContext.prototype);
  47257. function createFunctionalComponent (
  47258. Ctor,
  47259. propsData,
  47260. data,
  47261. contextVm,
  47262. children
  47263. ) {
  47264. var options = Ctor.options;
  47265. var props = {};
  47266. var propOptions = options.props;
  47267. if (isDef(propOptions)) {
  47268. for (var key in propOptions) {
  47269. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47270. }
  47271. } else {
  47272. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47273. if (isDef(data.props)) { mergeProps(props, data.props); }
  47274. }
  47275. var renderContext = new FunctionalRenderContext(
  47276. data,
  47277. props,
  47278. children,
  47279. contextVm,
  47280. Ctor
  47281. );
  47282. var vnode = options.render.call(null, renderContext._c, renderContext);
  47283. if (vnode instanceof VNode) {
  47284. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47285. } else if (Array.isArray(vnode)) {
  47286. var vnodes = normalizeChildren(vnode) || [];
  47287. var res = new Array(vnodes.length);
  47288. for (var i = 0; i < vnodes.length; i++) {
  47289. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47290. }
  47291. return res
  47292. }
  47293. }
  47294. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47295. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47296. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47297. // that should not be matched to match.
  47298. var clone = cloneVNode(vnode);
  47299. clone.fnContext = contextVm;
  47300. clone.fnOptions = options;
  47301. {
  47302. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47303. }
  47304. if (data.slot) {
  47305. (clone.data || (clone.data = {})).slot = data.slot;
  47306. }
  47307. return clone
  47308. }
  47309. function mergeProps (to, from) {
  47310. for (var key in from) {
  47311. to[camelize(key)] = from[key];
  47312. }
  47313. }
  47314. /* */
  47315. /* */
  47316. /* */
  47317. /* */
  47318. // inline hooks to be invoked on component VNodes during patch
  47319. var componentVNodeHooks = {
  47320. init: function init (vnode, hydrating) {
  47321. if (
  47322. vnode.componentInstance &&
  47323. !vnode.componentInstance._isDestroyed &&
  47324. vnode.data.keepAlive
  47325. ) {
  47326. // kept-alive components, treat as a patch
  47327. var mountedNode = vnode; // work around flow
  47328. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47329. } else {
  47330. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47331. vnode,
  47332. activeInstance
  47333. );
  47334. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47335. }
  47336. },
  47337. prepatch: function prepatch (oldVnode, vnode) {
  47338. var options = vnode.componentOptions;
  47339. var child = vnode.componentInstance = oldVnode.componentInstance;
  47340. updateChildComponent(
  47341. child,
  47342. options.propsData, // updated props
  47343. options.listeners, // updated listeners
  47344. vnode, // new parent vnode
  47345. options.children // new children
  47346. );
  47347. },
  47348. insert: function insert (vnode) {
  47349. var context = vnode.context;
  47350. var componentInstance = vnode.componentInstance;
  47351. if (!componentInstance._isMounted) {
  47352. componentInstance._isMounted = true;
  47353. callHook(componentInstance, 'mounted');
  47354. }
  47355. if (vnode.data.keepAlive) {
  47356. if (context._isMounted) {
  47357. // vue-router#1212
  47358. // During updates, a kept-alive component's child components may
  47359. // change, so directly walking the tree here may call activated hooks
  47360. // on incorrect children. Instead we push them into a queue which will
  47361. // be processed after the whole patch process ended.
  47362. queueActivatedComponent(componentInstance);
  47363. } else {
  47364. activateChildComponent(componentInstance, true /* direct */);
  47365. }
  47366. }
  47367. },
  47368. destroy: function destroy (vnode) {
  47369. var componentInstance = vnode.componentInstance;
  47370. if (!componentInstance._isDestroyed) {
  47371. if (!vnode.data.keepAlive) {
  47372. componentInstance.$destroy();
  47373. } else {
  47374. deactivateChildComponent(componentInstance, true /* direct */);
  47375. }
  47376. }
  47377. }
  47378. };
  47379. var hooksToMerge = Object.keys(componentVNodeHooks);
  47380. function createComponent (
  47381. Ctor,
  47382. data,
  47383. context,
  47384. children,
  47385. tag
  47386. ) {
  47387. if (isUndef(Ctor)) {
  47388. return
  47389. }
  47390. var baseCtor = context.$options._base;
  47391. // plain options object: turn it into a constructor
  47392. if (isObject(Ctor)) {
  47393. Ctor = baseCtor.extend(Ctor);
  47394. }
  47395. // if at this stage it's not a constructor or an async component factory,
  47396. // reject.
  47397. if (typeof Ctor !== 'function') {
  47398. {
  47399. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47400. }
  47401. return
  47402. }
  47403. // async component
  47404. var asyncFactory;
  47405. if (isUndef(Ctor.cid)) {
  47406. asyncFactory = Ctor;
  47407. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47408. if (Ctor === undefined) {
  47409. // return a placeholder node for async component, which is rendered
  47410. // as a comment node but preserves all the raw information for the node.
  47411. // the information will be used for async server-rendering and hydration.
  47412. return createAsyncPlaceholder(
  47413. asyncFactory,
  47414. data,
  47415. context,
  47416. children,
  47417. tag
  47418. )
  47419. }
  47420. }
  47421. data = data || {};
  47422. // resolve constructor options in case global mixins are applied after
  47423. // component constructor creation
  47424. resolveConstructorOptions(Ctor);
  47425. // transform component v-model data into props & events
  47426. if (isDef(data.model)) {
  47427. transformModel(Ctor.options, data);
  47428. }
  47429. // extract props
  47430. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47431. // functional component
  47432. if (isTrue(Ctor.options.functional)) {
  47433. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47434. }
  47435. // extract listeners, since these needs to be treated as
  47436. // child component listeners instead of DOM listeners
  47437. var listeners = data.on;
  47438. // replace with listeners with .native modifier
  47439. // so it gets processed during parent component patch.
  47440. data.on = data.nativeOn;
  47441. if (isTrue(Ctor.options.abstract)) {
  47442. // abstract components do not keep anything
  47443. // other than props & listeners & slot
  47444. // work around flow
  47445. var slot = data.slot;
  47446. data = {};
  47447. if (slot) {
  47448. data.slot = slot;
  47449. }
  47450. }
  47451. // install component management hooks onto the placeholder node
  47452. installComponentHooks(data);
  47453. // return a placeholder vnode
  47454. var name = Ctor.options.name || tag;
  47455. var vnode = new VNode(
  47456. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47457. data, undefined, undefined, undefined, context,
  47458. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47459. asyncFactory
  47460. );
  47461. return vnode
  47462. }
  47463. function createComponentInstanceForVnode (
  47464. vnode, // we know it's MountedComponentVNode but flow doesn't
  47465. parent // activeInstance in lifecycle state
  47466. ) {
  47467. var options = {
  47468. _isComponent: true,
  47469. _parentVnode: vnode,
  47470. parent: parent
  47471. };
  47472. // check inline-template render functions
  47473. var inlineTemplate = vnode.data.inlineTemplate;
  47474. if (isDef(inlineTemplate)) {
  47475. options.render = inlineTemplate.render;
  47476. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47477. }
  47478. return new vnode.componentOptions.Ctor(options)
  47479. }
  47480. function installComponentHooks (data) {
  47481. var hooks = data.hook || (data.hook = {});
  47482. for (var i = 0; i < hooksToMerge.length; i++) {
  47483. var key = hooksToMerge[i];
  47484. var existing = hooks[key];
  47485. var toMerge = componentVNodeHooks[key];
  47486. if (existing !== toMerge && !(existing && existing._merged)) {
  47487. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47488. }
  47489. }
  47490. }
  47491. function mergeHook$1 (f1, f2) {
  47492. var merged = function (a, b) {
  47493. // flow complains about extra args which is why we use any
  47494. f1(a, b);
  47495. f2(a, b);
  47496. };
  47497. merged._merged = true;
  47498. return merged
  47499. }
  47500. // transform component v-model info (value and callback) into
  47501. // prop and event handler respectively.
  47502. function transformModel (options, data) {
  47503. var prop = (options.model && options.model.prop) || 'value';
  47504. var event = (options.model && options.model.event) || 'input'
  47505. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47506. var on = data.on || (data.on = {});
  47507. var existing = on[event];
  47508. var callback = data.model.callback;
  47509. if (isDef(existing)) {
  47510. if (
  47511. Array.isArray(existing)
  47512. ? existing.indexOf(callback) === -1
  47513. : existing !== callback
  47514. ) {
  47515. on[event] = [callback].concat(existing);
  47516. }
  47517. } else {
  47518. on[event] = callback;
  47519. }
  47520. }
  47521. /* */
  47522. var SIMPLE_NORMALIZE = 1;
  47523. var ALWAYS_NORMALIZE = 2;
  47524. // wrapper function for providing a more flexible interface
  47525. // without getting yelled at by flow
  47526. function createElement (
  47527. context,
  47528. tag,
  47529. data,
  47530. children,
  47531. normalizationType,
  47532. alwaysNormalize
  47533. ) {
  47534. if (Array.isArray(data) || isPrimitive(data)) {
  47535. normalizationType = children;
  47536. children = data;
  47537. data = undefined;
  47538. }
  47539. if (isTrue(alwaysNormalize)) {
  47540. normalizationType = ALWAYS_NORMALIZE;
  47541. }
  47542. return _createElement(context, tag, data, children, normalizationType)
  47543. }
  47544. function _createElement (
  47545. context,
  47546. tag,
  47547. data,
  47548. children,
  47549. normalizationType
  47550. ) {
  47551. if (isDef(data) && isDef((data).__ob__)) {
  47552. warn(
  47553. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47554. 'Always create fresh vnode data objects in each render!',
  47555. context
  47556. );
  47557. return createEmptyVNode()
  47558. }
  47559. // object syntax in v-bind
  47560. if (isDef(data) && isDef(data.is)) {
  47561. tag = data.is;
  47562. }
  47563. if (!tag) {
  47564. // in case of component :is set to falsy value
  47565. return createEmptyVNode()
  47566. }
  47567. // warn against non-primitive key
  47568. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47569. ) {
  47570. {
  47571. warn(
  47572. 'Avoid using non-primitive value as key, ' +
  47573. 'use string/number value instead.',
  47574. context
  47575. );
  47576. }
  47577. }
  47578. // support single function children as default scoped slot
  47579. if (Array.isArray(children) &&
  47580. typeof children[0] === 'function'
  47581. ) {
  47582. data = data || {};
  47583. data.scopedSlots = { default: children[0] };
  47584. children.length = 0;
  47585. }
  47586. if (normalizationType === ALWAYS_NORMALIZE) {
  47587. children = normalizeChildren(children);
  47588. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47589. children = simpleNormalizeChildren(children);
  47590. }
  47591. var vnode, ns;
  47592. if (typeof tag === 'string') {
  47593. var Ctor;
  47594. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47595. if (config.isReservedTag(tag)) {
  47596. // platform built-in elements
  47597. if (isDef(data) && isDef(data.nativeOn)) {
  47598. warn(
  47599. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47600. context
  47601. );
  47602. }
  47603. vnode = new VNode(
  47604. config.parsePlatformTagName(tag), data, children,
  47605. undefined, undefined, context
  47606. );
  47607. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47608. // component
  47609. vnode = createComponent(Ctor, data, context, children, tag);
  47610. } else {
  47611. // unknown or unlisted namespaced elements
  47612. // check at runtime because it may get assigned a namespace when its
  47613. // parent normalizes children
  47614. vnode = new VNode(
  47615. tag, data, children,
  47616. undefined, undefined, context
  47617. );
  47618. }
  47619. } else {
  47620. // direct component options / constructor
  47621. vnode = createComponent(tag, data, context, children);
  47622. }
  47623. if (Array.isArray(vnode)) {
  47624. return vnode
  47625. } else if (isDef(vnode)) {
  47626. if (isDef(ns)) { applyNS(vnode, ns); }
  47627. if (isDef(data)) { registerDeepBindings(data); }
  47628. return vnode
  47629. } else {
  47630. return createEmptyVNode()
  47631. }
  47632. }
  47633. function applyNS (vnode, ns, force) {
  47634. vnode.ns = ns;
  47635. if (vnode.tag === 'foreignObject') {
  47636. // use default namespace inside foreignObject
  47637. ns = undefined;
  47638. force = true;
  47639. }
  47640. if (isDef(vnode.children)) {
  47641. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47642. var child = vnode.children[i];
  47643. if (isDef(child.tag) && (
  47644. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47645. applyNS(child, ns, force);
  47646. }
  47647. }
  47648. }
  47649. }
  47650. // ref #5318
  47651. // necessary to ensure parent re-render when deep bindings like :style and
  47652. // :class are used on slot nodes
  47653. function registerDeepBindings (data) {
  47654. if (isObject(data.style)) {
  47655. traverse(data.style);
  47656. }
  47657. if (isObject(data.class)) {
  47658. traverse(data.class);
  47659. }
  47660. }
  47661. /* */
  47662. function initRender (vm) {
  47663. vm._vnode = null; // the root of the child tree
  47664. vm._staticTrees = null; // v-once cached trees
  47665. var options = vm.$options;
  47666. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47667. var renderContext = parentVnode && parentVnode.context;
  47668. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47669. vm.$scopedSlots = emptyObject;
  47670. // bind the createElement fn to this instance
  47671. // so that we get proper render context inside it.
  47672. // args order: tag, data, children, normalizationType, alwaysNormalize
  47673. // internal version is used by render functions compiled from templates
  47674. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47675. // normalization is always applied for the public version, used in
  47676. // user-written render functions.
  47677. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47678. // $attrs & $listeners are exposed for easier HOC creation.
  47679. // they need to be reactive so that HOCs using them are always updated
  47680. var parentData = parentVnode && parentVnode.data;
  47681. /* istanbul ignore else */
  47682. {
  47683. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47684. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47685. }, true);
  47686. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47687. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47688. }, true);
  47689. }
  47690. }
  47691. var currentRenderingInstance = null;
  47692. function renderMixin (Vue) {
  47693. // install runtime convenience helpers
  47694. installRenderHelpers(Vue.prototype);
  47695. Vue.prototype.$nextTick = function (fn) {
  47696. return nextTick(fn, this)
  47697. };
  47698. Vue.prototype._render = function () {
  47699. var vm = this;
  47700. var ref = vm.$options;
  47701. var render = ref.render;
  47702. var _parentVnode = ref._parentVnode;
  47703. if (_parentVnode) {
  47704. vm.$scopedSlots = normalizeScopedSlots(
  47705. _parentVnode.data.scopedSlots,
  47706. vm.$slots,
  47707. vm.$scopedSlots
  47708. );
  47709. }
  47710. // set parent vnode. this allows render functions to have access
  47711. // to the data on the placeholder node.
  47712. vm.$vnode = _parentVnode;
  47713. // render self
  47714. var vnode;
  47715. try {
  47716. // There's no need to maintain a stack because all render fns are called
  47717. // separately from one another. Nested component's render fns are called
  47718. // when parent component is patched.
  47719. currentRenderingInstance = vm;
  47720. vnode = render.call(vm._renderProxy, vm.$createElement);
  47721. } catch (e) {
  47722. handleError(e, vm, "render");
  47723. // return error render result,
  47724. // or previous vnode to prevent render error causing blank component
  47725. /* istanbul ignore else */
  47726. if (vm.$options.renderError) {
  47727. try {
  47728. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47729. } catch (e) {
  47730. handleError(e, vm, "renderError");
  47731. vnode = vm._vnode;
  47732. }
  47733. } else {
  47734. vnode = vm._vnode;
  47735. }
  47736. } finally {
  47737. currentRenderingInstance = null;
  47738. }
  47739. // if the returned array contains only a single node, allow it
  47740. if (Array.isArray(vnode) && vnode.length === 1) {
  47741. vnode = vnode[0];
  47742. }
  47743. // return empty vnode in case the render function errored out
  47744. if (!(vnode instanceof VNode)) {
  47745. if (Array.isArray(vnode)) {
  47746. warn(
  47747. 'Multiple root nodes returned from render function. Render function ' +
  47748. 'should return a single root node.',
  47749. vm
  47750. );
  47751. }
  47752. vnode = createEmptyVNode();
  47753. }
  47754. // set parent
  47755. vnode.parent = _parentVnode;
  47756. return vnode
  47757. };
  47758. }
  47759. /* */
  47760. function ensureCtor (comp, base) {
  47761. if (
  47762. comp.__esModule ||
  47763. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47764. ) {
  47765. comp = comp.default;
  47766. }
  47767. return isObject(comp)
  47768. ? base.extend(comp)
  47769. : comp
  47770. }
  47771. function createAsyncPlaceholder (
  47772. factory,
  47773. data,
  47774. context,
  47775. children,
  47776. tag
  47777. ) {
  47778. var node = createEmptyVNode();
  47779. node.asyncFactory = factory;
  47780. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47781. return node
  47782. }
  47783. function resolveAsyncComponent (
  47784. factory,
  47785. baseCtor
  47786. ) {
  47787. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47788. return factory.errorComp
  47789. }
  47790. if (isDef(factory.resolved)) {
  47791. return factory.resolved
  47792. }
  47793. var owner = currentRenderingInstance;
  47794. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47795. // already pending
  47796. factory.owners.push(owner);
  47797. }
  47798. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47799. return factory.loadingComp
  47800. }
  47801. if (owner && !isDef(factory.owners)) {
  47802. var owners = factory.owners = [owner];
  47803. var sync = true;
  47804. var timerLoading = null;
  47805. var timerTimeout = null
  47806. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47807. var forceRender = function (renderCompleted) {
  47808. for (var i = 0, l = owners.length; i < l; i++) {
  47809. (owners[i]).$forceUpdate();
  47810. }
  47811. if (renderCompleted) {
  47812. owners.length = 0;
  47813. if (timerLoading !== null) {
  47814. clearTimeout(timerLoading);
  47815. timerLoading = null;
  47816. }
  47817. if (timerTimeout !== null) {
  47818. clearTimeout(timerTimeout);
  47819. timerTimeout = null;
  47820. }
  47821. }
  47822. };
  47823. var resolve = once(function (res) {
  47824. // cache resolved
  47825. factory.resolved = ensureCtor(res, baseCtor);
  47826. // invoke callbacks only if this is not a synchronous resolve
  47827. // (async resolves are shimmed as synchronous during SSR)
  47828. if (!sync) {
  47829. forceRender(true);
  47830. } else {
  47831. owners.length = 0;
  47832. }
  47833. });
  47834. var reject = once(function (reason) {
  47835. warn(
  47836. "Failed to resolve async component: " + (String(factory)) +
  47837. (reason ? ("\nReason: " + reason) : '')
  47838. );
  47839. if (isDef(factory.errorComp)) {
  47840. factory.error = true;
  47841. forceRender(true);
  47842. }
  47843. });
  47844. var res = factory(resolve, reject);
  47845. if (isObject(res)) {
  47846. if (isPromise(res)) {
  47847. // () => Promise
  47848. if (isUndef(factory.resolved)) {
  47849. res.then(resolve, reject);
  47850. }
  47851. } else if (isPromise(res.component)) {
  47852. res.component.then(resolve, reject);
  47853. if (isDef(res.error)) {
  47854. factory.errorComp = ensureCtor(res.error, baseCtor);
  47855. }
  47856. if (isDef(res.loading)) {
  47857. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47858. if (res.delay === 0) {
  47859. factory.loading = true;
  47860. } else {
  47861. timerLoading = setTimeout(function () {
  47862. timerLoading = null;
  47863. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47864. factory.loading = true;
  47865. forceRender(false);
  47866. }
  47867. }, res.delay || 200);
  47868. }
  47869. }
  47870. if (isDef(res.timeout)) {
  47871. timerTimeout = setTimeout(function () {
  47872. timerTimeout = null;
  47873. if (isUndef(factory.resolved)) {
  47874. reject(
  47875. "timeout (" + (res.timeout) + "ms)"
  47876. );
  47877. }
  47878. }, res.timeout);
  47879. }
  47880. }
  47881. }
  47882. sync = false;
  47883. // return in case resolved synchronously
  47884. return factory.loading
  47885. ? factory.loadingComp
  47886. : factory.resolved
  47887. }
  47888. }
  47889. /* */
  47890. function isAsyncPlaceholder (node) {
  47891. return node.isComment && node.asyncFactory
  47892. }
  47893. /* */
  47894. function getFirstComponentChild (children) {
  47895. if (Array.isArray(children)) {
  47896. for (var i = 0; i < children.length; i++) {
  47897. var c = children[i];
  47898. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47899. return c
  47900. }
  47901. }
  47902. }
  47903. }
  47904. /* */
  47905. /* */
  47906. function initEvents (vm) {
  47907. vm._events = Object.create(null);
  47908. vm._hasHookEvent = false;
  47909. // init parent attached events
  47910. var listeners = vm.$options._parentListeners;
  47911. if (listeners) {
  47912. updateComponentListeners(vm, listeners);
  47913. }
  47914. }
  47915. var target;
  47916. function add (event, fn) {
  47917. target.$on(event, fn);
  47918. }
  47919. function remove$1 (event, fn) {
  47920. target.$off(event, fn);
  47921. }
  47922. function createOnceHandler (event, fn) {
  47923. var _target = target;
  47924. return function onceHandler () {
  47925. var res = fn.apply(null, arguments);
  47926. if (res !== null) {
  47927. _target.$off(event, onceHandler);
  47928. }
  47929. }
  47930. }
  47931. function updateComponentListeners (
  47932. vm,
  47933. listeners,
  47934. oldListeners
  47935. ) {
  47936. target = vm;
  47937. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47938. target = undefined;
  47939. }
  47940. function eventsMixin (Vue) {
  47941. var hookRE = /^hook:/;
  47942. Vue.prototype.$on = function (event, fn) {
  47943. var vm = this;
  47944. if (Array.isArray(event)) {
  47945. for (var i = 0, l = event.length; i < l; i++) {
  47946. vm.$on(event[i], fn);
  47947. }
  47948. } else {
  47949. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47950. // optimize hook:event cost by using a boolean flag marked at registration
  47951. // instead of a hash lookup
  47952. if (hookRE.test(event)) {
  47953. vm._hasHookEvent = true;
  47954. }
  47955. }
  47956. return vm
  47957. };
  47958. Vue.prototype.$once = function (event, fn) {
  47959. var vm = this;
  47960. function on () {
  47961. vm.$off(event, on);
  47962. fn.apply(vm, arguments);
  47963. }
  47964. on.fn = fn;
  47965. vm.$on(event, on);
  47966. return vm
  47967. };
  47968. Vue.prototype.$off = function (event, fn) {
  47969. var vm = this;
  47970. // all
  47971. if (!arguments.length) {
  47972. vm._events = Object.create(null);
  47973. return vm
  47974. }
  47975. // array of events
  47976. if (Array.isArray(event)) {
  47977. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47978. vm.$off(event[i$1], fn);
  47979. }
  47980. return vm
  47981. }
  47982. // specific event
  47983. var cbs = vm._events[event];
  47984. if (!cbs) {
  47985. return vm
  47986. }
  47987. if (!fn) {
  47988. vm._events[event] = null;
  47989. return vm
  47990. }
  47991. // specific handler
  47992. var cb;
  47993. var i = cbs.length;
  47994. while (i--) {
  47995. cb = cbs[i];
  47996. if (cb === fn || cb.fn === fn) {
  47997. cbs.splice(i, 1);
  47998. break
  47999. }
  48000. }
  48001. return vm
  48002. };
  48003. Vue.prototype.$emit = function (event) {
  48004. var vm = this;
  48005. {
  48006. var lowerCaseEvent = event.toLowerCase();
  48007. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48008. tip(
  48009. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48010. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48011. "Note that HTML attributes are case-insensitive and you cannot use " +
  48012. "v-on to listen to camelCase events when using in-DOM templates. " +
  48013. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48014. );
  48015. }
  48016. }
  48017. var cbs = vm._events[event];
  48018. if (cbs) {
  48019. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48020. var args = toArray(arguments, 1);
  48021. var info = "event handler for \"" + event + "\"";
  48022. for (var i = 0, l = cbs.length; i < l; i++) {
  48023. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48024. }
  48025. }
  48026. return vm
  48027. };
  48028. }
  48029. /* */
  48030. var activeInstance = null;
  48031. var isUpdatingChildComponent = false;
  48032. function setActiveInstance(vm) {
  48033. var prevActiveInstance = activeInstance;
  48034. activeInstance = vm;
  48035. return function () {
  48036. activeInstance = prevActiveInstance;
  48037. }
  48038. }
  48039. function initLifecycle (vm) {
  48040. var options = vm.$options;
  48041. // locate first non-abstract parent
  48042. var parent = options.parent;
  48043. if (parent && !options.abstract) {
  48044. while (parent.$options.abstract && parent.$parent) {
  48045. parent = parent.$parent;
  48046. }
  48047. parent.$children.push(vm);
  48048. }
  48049. vm.$parent = parent;
  48050. vm.$root = parent ? parent.$root : vm;
  48051. vm.$children = [];
  48052. vm.$refs = {};
  48053. vm._watcher = null;
  48054. vm._inactive = null;
  48055. vm._directInactive = false;
  48056. vm._isMounted = false;
  48057. vm._isDestroyed = false;
  48058. vm._isBeingDestroyed = false;
  48059. }
  48060. function lifecycleMixin (Vue) {
  48061. Vue.prototype._update = function (vnode, hydrating) {
  48062. var vm = this;
  48063. var prevEl = vm.$el;
  48064. var prevVnode = vm._vnode;
  48065. var restoreActiveInstance = setActiveInstance(vm);
  48066. vm._vnode = vnode;
  48067. // Vue.prototype.__patch__ is injected in entry points
  48068. // based on the rendering backend used.
  48069. if (!prevVnode) {
  48070. // initial render
  48071. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48072. } else {
  48073. // updates
  48074. vm.$el = vm.__patch__(prevVnode, vnode);
  48075. }
  48076. restoreActiveInstance();
  48077. // update __vue__ reference
  48078. if (prevEl) {
  48079. prevEl.__vue__ = null;
  48080. }
  48081. if (vm.$el) {
  48082. vm.$el.__vue__ = vm;
  48083. }
  48084. // if parent is an HOC, update its $el as well
  48085. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48086. vm.$parent.$el = vm.$el;
  48087. }
  48088. // updated hook is called by the scheduler to ensure that children are
  48089. // updated in a parent's updated hook.
  48090. };
  48091. Vue.prototype.$forceUpdate = function () {
  48092. var vm = this;
  48093. if (vm._watcher) {
  48094. vm._watcher.update();
  48095. }
  48096. };
  48097. Vue.prototype.$destroy = function () {
  48098. var vm = this;
  48099. if (vm._isBeingDestroyed) {
  48100. return
  48101. }
  48102. callHook(vm, 'beforeDestroy');
  48103. vm._isBeingDestroyed = true;
  48104. // remove self from parent
  48105. var parent = vm.$parent;
  48106. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48107. remove(parent.$children, vm);
  48108. }
  48109. // teardown watchers
  48110. if (vm._watcher) {
  48111. vm._watcher.teardown();
  48112. }
  48113. var i = vm._watchers.length;
  48114. while (i--) {
  48115. vm._watchers[i].teardown();
  48116. }
  48117. // remove reference from data ob
  48118. // frozen object may not have observer.
  48119. if (vm._data.__ob__) {
  48120. vm._data.__ob__.vmCount--;
  48121. }
  48122. // call the last hook...
  48123. vm._isDestroyed = true;
  48124. // invoke destroy hooks on current rendered tree
  48125. vm.__patch__(vm._vnode, null);
  48126. // fire destroyed hook
  48127. callHook(vm, 'destroyed');
  48128. // turn off all instance listeners.
  48129. vm.$off();
  48130. // remove __vue__ reference
  48131. if (vm.$el) {
  48132. vm.$el.__vue__ = null;
  48133. }
  48134. // release circular reference (#6759)
  48135. if (vm.$vnode) {
  48136. vm.$vnode.parent = null;
  48137. }
  48138. };
  48139. }
  48140. function mountComponent (
  48141. vm,
  48142. el,
  48143. hydrating
  48144. ) {
  48145. vm.$el = el;
  48146. if (!vm.$options.render) {
  48147. vm.$options.render = createEmptyVNode;
  48148. {
  48149. /* istanbul ignore if */
  48150. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48151. vm.$options.el || el) {
  48152. warn(
  48153. 'You are using the runtime-only build of Vue where the template ' +
  48154. 'compiler is not available. Either pre-compile the templates into ' +
  48155. 'render functions, or use the compiler-included build.',
  48156. vm
  48157. );
  48158. } else {
  48159. warn(
  48160. 'Failed to mount component: template or render function not defined.',
  48161. vm
  48162. );
  48163. }
  48164. }
  48165. }
  48166. callHook(vm, 'beforeMount');
  48167. var updateComponent;
  48168. /* istanbul ignore if */
  48169. if (config.performance && mark) {
  48170. updateComponent = function () {
  48171. var name = vm._name;
  48172. var id = vm._uid;
  48173. var startTag = "vue-perf-start:" + id;
  48174. var endTag = "vue-perf-end:" + id;
  48175. mark(startTag);
  48176. var vnode = vm._render();
  48177. mark(endTag);
  48178. measure(("vue " + name + " render"), startTag, endTag);
  48179. mark(startTag);
  48180. vm._update(vnode, hydrating);
  48181. mark(endTag);
  48182. measure(("vue " + name + " patch"), startTag, endTag);
  48183. };
  48184. } else {
  48185. updateComponent = function () {
  48186. vm._update(vm._render(), hydrating);
  48187. };
  48188. }
  48189. // we set this to vm._watcher inside the watcher's constructor
  48190. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48191. // component's mounted hook), which relies on vm._watcher being already defined
  48192. new Watcher(vm, updateComponent, noop, {
  48193. before: function before () {
  48194. if (vm._isMounted && !vm._isDestroyed) {
  48195. callHook(vm, 'beforeUpdate');
  48196. }
  48197. }
  48198. }, true /* isRenderWatcher */);
  48199. hydrating = false;
  48200. // manually mounted instance, call mounted on self
  48201. // mounted is called for render-created child components in its inserted hook
  48202. if (vm.$vnode == null) {
  48203. vm._isMounted = true;
  48204. callHook(vm, 'mounted');
  48205. }
  48206. return vm
  48207. }
  48208. function updateChildComponent (
  48209. vm,
  48210. propsData,
  48211. listeners,
  48212. parentVnode,
  48213. renderChildren
  48214. ) {
  48215. {
  48216. isUpdatingChildComponent = true;
  48217. }
  48218. // determine whether component has slot children
  48219. // we need to do this before overwriting $options._renderChildren.
  48220. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48221. // dynamic slot names). Static scoped slots compiled from template has the
  48222. // "$stable" marker.
  48223. var newScopedSlots = parentVnode.data.scopedSlots;
  48224. var oldScopedSlots = vm.$scopedSlots;
  48225. var hasDynamicScopedSlot = !!(
  48226. (newScopedSlots && !newScopedSlots.$stable) ||
  48227. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48228. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48229. );
  48230. // Any static slot children from the parent may have changed during parent's
  48231. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48232. // update is necessary to ensure correctness.
  48233. var needsForceUpdate = !!(
  48234. renderChildren || // has new static slots
  48235. vm.$options._renderChildren || // has old static slots
  48236. hasDynamicScopedSlot
  48237. );
  48238. vm.$options._parentVnode = parentVnode;
  48239. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48240. if (vm._vnode) { // update child tree's parent
  48241. vm._vnode.parent = parentVnode;
  48242. }
  48243. vm.$options._renderChildren = renderChildren;
  48244. // update $attrs and $listeners hash
  48245. // these are also reactive so they may trigger child update if the child
  48246. // used them during render
  48247. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48248. vm.$listeners = listeners || emptyObject;
  48249. // update props
  48250. if (propsData && vm.$options.props) {
  48251. toggleObserving(false);
  48252. var props = vm._props;
  48253. var propKeys = vm.$options._propKeys || [];
  48254. for (var i = 0; i < propKeys.length; i++) {
  48255. var key = propKeys[i];
  48256. var propOptions = vm.$options.props; // wtf flow?
  48257. props[key] = validateProp(key, propOptions, propsData, vm);
  48258. }
  48259. toggleObserving(true);
  48260. // keep a copy of raw propsData
  48261. vm.$options.propsData = propsData;
  48262. }
  48263. // update listeners
  48264. listeners = listeners || emptyObject;
  48265. var oldListeners = vm.$options._parentListeners;
  48266. vm.$options._parentListeners = listeners;
  48267. updateComponentListeners(vm, listeners, oldListeners);
  48268. // resolve slots + force update if has children
  48269. if (needsForceUpdate) {
  48270. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48271. vm.$forceUpdate();
  48272. }
  48273. {
  48274. isUpdatingChildComponent = false;
  48275. }
  48276. }
  48277. function isInInactiveTree (vm) {
  48278. while (vm && (vm = vm.$parent)) {
  48279. if (vm._inactive) { return true }
  48280. }
  48281. return false
  48282. }
  48283. function activateChildComponent (vm, direct) {
  48284. if (direct) {
  48285. vm._directInactive = false;
  48286. if (isInInactiveTree(vm)) {
  48287. return
  48288. }
  48289. } else if (vm._directInactive) {
  48290. return
  48291. }
  48292. if (vm._inactive || vm._inactive === null) {
  48293. vm._inactive = false;
  48294. for (var i = 0; i < vm.$children.length; i++) {
  48295. activateChildComponent(vm.$children[i]);
  48296. }
  48297. callHook(vm, 'activated');
  48298. }
  48299. }
  48300. function deactivateChildComponent (vm, direct) {
  48301. if (direct) {
  48302. vm._directInactive = true;
  48303. if (isInInactiveTree(vm)) {
  48304. return
  48305. }
  48306. }
  48307. if (!vm._inactive) {
  48308. vm._inactive = true;
  48309. for (var i = 0; i < vm.$children.length; i++) {
  48310. deactivateChildComponent(vm.$children[i]);
  48311. }
  48312. callHook(vm, 'deactivated');
  48313. }
  48314. }
  48315. function callHook (vm, hook) {
  48316. // #7573 disable dep collection when invoking lifecycle hooks
  48317. pushTarget();
  48318. var handlers = vm.$options[hook];
  48319. var info = hook + " hook";
  48320. if (handlers) {
  48321. for (var i = 0, j = handlers.length; i < j; i++) {
  48322. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48323. }
  48324. }
  48325. if (vm._hasHookEvent) {
  48326. vm.$emit('hook:' + hook);
  48327. }
  48328. popTarget();
  48329. }
  48330. /* */
  48331. var MAX_UPDATE_COUNT = 100;
  48332. var queue = [];
  48333. var activatedChildren = [];
  48334. var has = {};
  48335. var circular = {};
  48336. var waiting = false;
  48337. var flushing = false;
  48338. var index = 0;
  48339. /**
  48340. * Reset the scheduler's state.
  48341. */
  48342. function resetSchedulerState () {
  48343. index = queue.length = activatedChildren.length = 0;
  48344. has = {};
  48345. {
  48346. circular = {};
  48347. }
  48348. waiting = flushing = false;
  48349. }
  48350. // Async edge case #6566 requires saving the timestamp when event listeners are
  48351. // attached. However, calling performance.now() has a perf overhead especially
  48352. // if the page has thousands of event listeners. Instead, we take a timestamp
  48353. // every time the scheduler flushes and use that for all event listeners
  48354. // attached during that flush.
  48355. var currentFlushTimestamp = 0;
  48356. // Async edge case fix requires storing an event listener's attach timestamp.
  48357. var getNow = Date.now;
  48358. // Determine what event timestamp the browser is using. Annoyingly, the
  48359. // timestamp can either be hi-res (relative to page load) or low-res
  48360. // (relative to UNIX epoch), so in order to compare time we have to use the
  48361. // same timestamp type when saving the flush timestamp.
  48362. // All IE versions use low-res event timestamps, and have problematic clock
  48363. // implementations (#9632)
  48364. if (inBrowser && !isIE) {
  48365. var performance = window.performance;
  48366. if (
  48367. performance &&
  48368. typeof performance.now === 'function' &&
  48369. getNow() > document.createEvent('Event').timeStamp
  48370. ) {
  48371. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48372. // smaller than it, it means the event is using a hi-res timestamp,
  48373. // and we need to use the hi-res version for event listener timestamps as
  48374. // well.
  48375. getNow = function () { return performance.now(); };
  48376. }
  48377. }
  48378. /**
  48379. * Flush both queues and run the watchers.
  48380. */
  48381. function flushSchedulerQueue () {
  48382. currentFlushTimestamp = getNow();
  48383. flushing = true;
  48384. var watcher, id;
  48385. // Sort queue before flush.
  48386. // This ensures that:
  48387. // 1. Components are updated from parent to child. (because parent is always
  48388. // created before the child)
  48389. // 2. A component's user watchers are run before its render watcher (because
  48390. // user watchers are created before the render watcher)
  48391. // 3. If a component is destroyed during a parent component's watcher run,
  48392. // its watchers can be skipped.
  48393. queue.sort(function (a, b) { return a.id - b.id; });
  48394. // do not cache length because more watchers might be pushed
  48395. // as we run existing watchers
  48396. for (index = 0; index < queue.length; index++) {
  48397. watcher = queue[index];
  48398. if (watcher.before) {
  48399. watcher.before();
  48400. }
  48401. id = watcher.id;
  48402. has[id] = null;
  48403. watcher.run();
  48404. // in dev build, check and stop circular updates.
  48405. if (has[id] != null) {
  48406. circular[id] = (circular[id] || 0) + 1;
  48407. if (circular[id] > MAX_UPDATE_COUNT) {
  48408. warn(
  48409. 'You may have an infinite update loop ' + (
  48410. watcher.user
  48411. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48412. : "in a component render function."
  48413. ),
  48414. watcher.vm
  48415. );
  48416. break
  48417. }
  48418. }
  48419. }
  48420. // keep copies of post queues before resetting state
  48421. var activatedQueue = activatedChildren.slice();
  48422. var updatedQueue = queue.slice();
  48423. resetSchedulerState();
  48424. // call component updated and activated hooks
  48425. callActivatedHooks(activatedQueue);
  48426. callUpdatedHooks(updatedQueue);
  48427. // devtool hook
  48428. /* istanbul ignore if */
  48429. if (devtools && config.devtools) {
  48430. devtools.emit('flush');
  48431. }
  48432. }
  48433. function callUpdatedHooks (queue) {
  48434. var i = queue.length;
  48435. while (i--) {
  48436. var watcher = queue[i];
  48437. var vm = watcher.vm;
  48438. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48439. callHook(vm, 'updated');
  48440. }
  48441. }
  48442. }
  48443. /**
  48444. * Queue a kept-alive component that was activated during patch.
  48445. * The queue will be processed after the entire tree has been patched.
  48446. */
  48447. function queueActivatedComponent (vm) {
  48448. // setting _inactive to false here so that a render function can
  48449. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48450. vm._inactive = false;
  48451. activatedChildren.push(vm);
  48452. }
  48453. function callActivatedHooks (queue) {
  48454. for (var i = 0; i < queue.length; i++) {
  48455. queue[i]._inactive = true;
  48456. activateChildComponent(queue[i], true /* true */);
  48457. }
  48458. }
  48459. /**
  48460. * Push a watcher into the watcher queue.
  48461. * Jobs with duplicate IDs will be skipped unless it's
  48462. * pushed when the queue is being flushed.
  48463. */
  48464. function queueWatcher (watcher) {
  48465. var id = watcher.id;
  48466. if (has[id] == null) {
  48467. has[id] = true;
  48468. if (!flushing) {
  48469. queue.push(watcher);
  48470. } else {
  48471. // if already flushing, splice the watcher based on its id
  48472. // if already past its id, it will be run next immediately.
  48473. var i = queue.length - 1;
  48474. while (i > index && queue[i].id > watcher.id) {
  48475. i--;
  48476. }
  48477. queue.splice(i + 1, 0, watcher);
  48478. }
  48479. // queue the flush
  48480. if (!waiting) {
  48481. waiting = true;
  48482. if (!config.async) {
  48483. flushSchedulerQueue();
  48484. return
  48485. }
  48486. nextTick(flushSchedulerQueue);
  48487. }
  48488. }
  48489. }
  48490. /* */
  48491. var uid$2 = 0;
  48492. /**
  48493. * A watcher parses an expression, collects dependencies,
  48494. * and fires callback when the expression value changes.
  48495. * This is used for both the $watch() api and directives.
  48496. */
  48497. var Watcher = function Watcher (
  48498. vm,
  48499. expOrFn,
  48500. cb,
  48501. options,
  48502. isRenderWatcher
  48503. ) {
  48504. this.vm = vm;
  48505. if (isRenderWatcher) {
  48506. vm._watcher = this;
  48507. }
  48508. vm._watchers.push(this);
  48509. // options
  48510. if (options) {
  48511. this.deep = !!options.deep;
  48512. this.user = !!options.user;
  48513. this.lazy = !!options.lazy;
  48514. this.sync = !!options.sync;
  48515. this.before = options.before;
  48516. } else {
  48517. this.deep = this.user = this.lazy = this.sync = false;
  48518. }
  48519. this.cb = cb;
  48520. this.id = ++uid$2; // uid for batching
  48521. this.active = true;
  48522. this.dirty = this.lazy; // for lazy watchers
  48523. this.deps = [];
  48524. this.newDeps = [];
  48525. this.depIds = new _Set();
  48526. this.newDepIds = new _Set();
  48527. this.expression = expOrFn.toString();
  48528. // parse expression for getter
  48529. if (typeof expOrFn === 'function') {
  48530. this.getter = expOrFn;
  48531. } else {
  48532. this.getter = parsePath(expOrFn);
  48533. if (!this.getter) {
  48534. this.getter = noop;
  48535. warn(
  48536. "Failed watching path: \"" + expOrFn + "\" " +
  48537. 'Watcher only accepts simple dot-delimited paths. ' +
  48538. 'For full control, use a function instead.',
  48539. vm
  48540. );
  48541. }
  48542. }
  48543. this.value = this.lazy
  48544. ? undefined
  48545. : this.get();
  48546. };
  48547. /**
  48548. * Evaluate the getter, and re-collect dependencies.
  48549. */
  48550. Watcher.prototype.get = function get () {
  48551. pushTarget(this);
  48552. var value;
  48553. var vm = this.vm;
  48554. try {
  48555. value = this.getter.call(vm, vm);
  48556. } catch (e) {
  48557. if (this.user) {
  48558. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48559. } else {
  48560. throw e
  48561. }
  48562. } finally {
  48563. // "touch" every property so they are all tracked as
  48564. // dependencies for deep watching
  48565. if (this.deep) {
  48566. traverse(value);
  48567. }
  48568. popTarget();
  48569. this.cleanupDeps();
  48570. }
  48571. return value
  48572. };
  48573. /**
  48574. * Add a dependency to this directive.
  48575. */
  48576. Watcher.prototype.addDep = function addDep (dep) {
  48577. var id = dep.id;
  48578. if (!this.newDepIds.has(id)) {
  48579. this.newDepIds.add(id);
  48580. this.newDeps.push(dep);
  48581. if (!this.depIds.has(id)) {
  48582. dep.addSub(this);
  48583. }
  48584. }
  48585. };
  48586. /**
  48587. * Clean up for dependency collection.
  48588. */
  48589. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48590. var i = this.deps.length;
  48591. while (i--) {
  48592. var dep = this.deps[i];
  48593. if (!this.newDepIds.has(dep.id)) {
  48594. dep.removeSub(this);
  48595. }
  48596. }
  48597. var tmp = this.depIds;
  48598. this.depIds = this.newDepIds;
  48599. this.newDepIds = tmp;
  48600. this.newDepIds.clear();
  48601. tmp = this.deps;
  48602. this.deps = this.newDeps;
  48603. this.newDeps = tmp;
  48604. this.newDeps.length = 0;
  48605. };
  48606. /**
  48607. * Subscriber interface.
  48608. * Will be called when a dependency changes.
  48609. */
  48610. Watcher.prototype.update = function update () {
  48611. /* istanbul ignore else */
  48612. if (this.lazy) {
  48613. this.dirty = true;
  48614. } else if (this.sync) {
  48615. this.run();
  48616. } else {
  48617. queueWatcher(this);
  48618. }
  48619. };
  48620. /**
  48621. * Scheduler job interface.
  48622. * Will be called by the scheduler.
  48623. */
  48624. Watcher.prototype.run = function run () {
  48625. if (this.active) {
  48626. var value = this.get();
  48627. if (
  48628. value !== this.value ||
  48629. // Deep watchers and watchers on Object/Arrays should fire even
  48630. // when the value is the same, because the value may
  48631. // have mutated.
  48632. isObject(value) ||
  48633. this.deep
  48634. ) {
  48635. // set new value
  48636. var oldValue = this.value;
  48637. this.value = value;
  48638. if (this.user) {
  48639. try {
  48640. this.cb.call(this.vm, value, oldValue);
  48641. } catch (e) {
  48642. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48643. }
  48644. } else {
  48645. this.cb.call(this.vm, value, oldValue);
  48646. }
  48647. }
  48648. }
  48649. };
  48650. /**
  48651. * Evaluate the value of the watcher.
  48652. * This only gets called for lazy watchers.
  48653. */
  48654. Watcher.prototype.evaluate = function evaluate () {
  48655. this.value = this.get();
  48656. this.dirty = false;
  48657. };
  48658. /**
  48659. * Depend on all deps collected by this watcher.
  48660. */
  48661. Watcher.prototype.depend = function depend () {
  48662. var i = this.deps.length;
  48663. while (i--) {
  48664. this.deps[i].depend();
  48665. }
  48666. };
  48667. /**
  48668. * Remove self from all dependencies' subscriber list.
  48669. */
  48670. Watcher.prototype.teardown = function teardown () {
  48671. if (this.active) {
  48672. // remove self from vm's watcher list
  48673. // this is a somewhat expensive operation so we skip it
  48674. // if the vm is being destroyed.
  48675. if (!this.vm._isBeingDestroyed) {
  48676. remove(this.vm._watchers, this);
  48677. }
  48678. var i = this.deps.length;
  48679. while (i--) {
  48680. this.deps[i].removeSub(this);
  48681. }
  48682. this.active = false;
  48683. }
  48684. };
  48685. /* */
  48686. var sharedPropertyDefinition = {
  48687. enumerable: true,
  48688. configurable: true,
  48689. get: noop,
  48690. set: noop
  48691. };
  48692. function proxy (target, sourceKey, key) {
  48693. sharedPropertyDefinition.get = function proxyGetter () {
  48694. return this[sourceKey][key]
  48695. };
  48696. sharedPropertyDefinition.set = function proxySetter (val) {
  48697. this[sourceKey][key] = val;
  48698. };
  48699. Object.defineProperty(target, key, sharedPropertyDefinition);
  48700. }
  48701. function initState (vm) {
  48702. vm._watchers = [];
  48703. var opts = vm.$options;
  48704. if (opts.props) { initProps(vm, opts.props); }
  48705. if (opts.methods) { initMethods(vm, opts.methods); }
  48706. if (opts.data) {
  48707. initData(vm);
  48708. } else {
  48709. observe(vm._data = {}, true /* asRootData */);
  48710. }
  48711. if (opts.computed) { initComputed(vm, opts.computed); }
  48712. if (opts.watch && opts.watch !== nativeWatch) {
  48713. initWatch(vm, opts.watch);
  48714. }
  48715. }
  48716. function initProps (vm, propsOptions) {
  48717. var propsData = vm.$options.propsData || {};
  48718. var props = vm._props = {};
  48719. // cache prop keys so that future props updates can iterate using Array
  48720. // instead of dynamic object key enumeration.
  48721. var keys = vm.$options._propKeys = [];
  48722. var isRoot = !vm.$parent;
  48723. // root instance props should be converted
  48724. if (!isRoot) {
  48725. toggleObserving(false);
  48726. }
  48727. var loop = function ( key ) {
  48728. keys.push(key);
  48729. var value = validateProp(key, propsOptions, propsData, vm);
  48730. /* istanbul ignore else */
  48731. {
  48732. var hyphenatedKey = hyphenate(key);
  48733. if (isReservedAttribute(hyphenatedKey) ||
  48734. config.isReservedAttr(hyphenatedKey)) {
  48735. warn(
  48736. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48737. vm
  48738. );
  48739. }
  48740. defineReactive$$1(props, key, value, function () {
  48741. if (!isRoot && !isUpdatingChildComponent) {
  48742. warn(
  48743. "Avoid mutating a prop directly since the value will be " +
  48744. "overwritten whenever the parent component re-renders. " +
  48745. "Instead, use a data or computed property based on the prop's " +
  48746. "value. Prop being mutated: \"" + key + "\"",
  48747. vm
  48748. );
  48749. }
  48750. });
  48751. }
  48752. // static props are already proxied on the component's prototype
  48753. // during Vue.extend(). We only need to proxy props defined at
  48754. // instantiation here.
  48755. if (!(key in vm)) {
  48756. proxy(vm, "_props", key);
  48757. }
  48758. };
  48759. for (var key in propsOptions) loop( key );
  48760. toggleObserving(true);
  48761. }
  48762. function initData (vm) {
  48763. var data = vm.$options.data;
  48764. data = vm._data = typeof data === 'function'
  48765. ? getData(data, vm)
  48766. : data || {};
  48767. if (!isPlainObject(data)) {
  48768. data = {};
  48769. warn(
  48770. 'data functions should return an object:\n' +
  48771. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48772. vm
  48773. );
  48774. }
  48775. // proxy data on instance
  48776. var keys = Object.keys(data);
  48777. var props = vm.$options.props;
  48778. var methods = vm.$options.methods;
  48779. var i = keys.length;
  48780. while (i--) {
  48781. var key = keys[i];
  48782. {
  48783. if (methods && hasOwn(methods, key)) {
  48784. warn(
  48785. ("Method \"" + key + "\" has already been defined as a data property."),
  48786. vm
  48787. );
  48788. }
  48789. }
  48790. if (props && hasOwn(props, key)) {
  48791. warn(
  48792. "The data property \"" + key + "\" is already declared as a prop. " +
  48793. "Use prop default value instead.",
  48794. vm
  48795. );
  48796. } else if (!isReserved(key)) {
  48797. proxy(vm, "_data", key);
  48798. }
  48799. }
  48800. // observe data
  48801. observe(data, true /* asRootData */);
  48802. }
  48803. function getData (data, vm) {
  48804. // #7573 disable dep collection when invoking data getters
  48805. pushTarget();
  48806. try {
  48807. return data.call(vm, vm)
  48808. } catch (e) {
  48809. handleError(e, vm, "data()");
  48810. return {}
  48811. } finally {
  48812. popTarget();
  48813. }
  48814. }
  48815. var computedWatcherOptions = { lazy: true };
  48816. function initComputed (vm, computed) {
  48817. // $flow-disable-line
  48818. var watchers = vm._computedWatchers = Object.create(null);
  48819. // computed properties are just getters during SSR
  48820. var isSSR = isServerRendering();
  48821. for (var key in computed) {
  48822. var userDef = computed[key];
  48823. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48824. if (getter == null) {
  48825. warn(
  48826. ("Getter is missing for computed property \"" + key + "\"."),
  48827. vm
  48828. );
  48829. }
  48830. if (!isSSR) {
  48831. // create internal watcher for the computed property.
  48832. watchers[key] = new Watcher(
  48833. vm,
  48834. getter || noop,
  48835. noop,
  48836. computedWatcherOptions
  48837. );
  48838. }
  48839. // component-defined computed properties are already defined on the
  48840. // component prototype. We only need to define computed properties defined
  48841. // at instantiation here.
  48842. if (!(key in vm)) {
  48843. defineComputed(vm, key, userDef);
  48844. } else {
  48845. if (key in vm.$data) {
  48846. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48847. } else if (vm.$options.props && key in vm.$options.props) {
  48848. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48849. }
  48850. }
  48851. }
  48852. }
  48853. function defineComputed (
  48854. target,
  48855. key,
  48856. userDef
  48857. ) {
  48858. var shouldCache = !isServerRendering();
  48859. if (typeof userDef === 'function') {
  48860. sharedPropertyDefinition.get = shouldCache
  48861. ? createComputedGetter(key)
  48862. : createGetterInvoker(userDef);
  48863. sharedPropertyDefinition.set = noop;
  48864. } else {
  48865. sharedPropertyDefinition.get = userDef.get
  48866. ? shouldCache && userDef.cache !== false
  48867. ? createComputedGetter(key)
  48868. : createGetterInvoker(userDef.get)
  48869. : noop;
  48870. sharedPropertyDefinition.set = userDef.set || noop;
  48871. }
  48872. if (sharedPropertyDefinition.set === noop) {
  48873. sharedPropertyDefinition.set = function () {
  48874. warn(
  48875. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48876. this
  48877. );
  48878. };
  48879. }
  48880. Object.defineProperty(target, key, sharedPropertyDefinition);
  48881. }
  48882. function createComputedGetter (key) {
  48883. return function computedGetter () {
  48884. var watcher = this._computedWatchers && this._computedWatchers[key];
  48885. if (watcher) {
  48886. if (watcher.dirty) {
  48887. watcher.evaluate();
  48888. }
  48889. if (Dep.target) {
  48890. watcher.depend();
  48891. }
  48892. return watcher.value
  48893. }
  48894. }
  48895. }
  48896. function createGetterInvoker(fn) {
  48897. return function computedGetter () {
  48898. return fn.call(this, this)
  48899. }
  48900. }
  48901. function initMethods (vm, methods) {
  48902. var props = vm.$options.props;
  48903. for (var key in methods) {
  48904. {
  48905. if (typeof methods[key] !== 'function') {
  48906. warn(
  48907. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48908. "Did you reference the function correctly?",
  48909. vm
  48910. );
  48911. }
  48912. if (props && hasOwn(props, key)) {
  48913. warn(
  48914. ("Method \"" + key + "\" has already been defined as a prop."),
  48915. vm
  48916. );
  48917. }
  48918. if ((key in vm) && isReserved(key)) {
  48919. warn(
  48920. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48921. "Avoid defining component methods that start with _ or $."
  48922. );
  48923. }
  48924. }
  48925. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48926. }
  48927. }
  48928. function initWatch (vm, watch) {
  48929. for (var key in watch) {
  48930. var handler = watch[key];
  48931. if (Array.isArray(handler)) {
  48932. for (var i = 0; i < handler.length; i++) {
  48933. createWatcher(vm, key, handler[i]);
  48934. }
  48935. } else {
  48936. createWatcher(vm, key, handler);
  48937. }
  48938. }
  48939. }
  48940. function createWatcher (
  48941. vm,
  48942. expOrFn,
  48943. handler,
  48944. options
  48945. ) {
  48946. if (isPlainObject(handler)) {
  48947. options = handler;
  48948. handler = handler.handler;
  48949. }
  48950. if (typeof handler === 'string') {
  48951. handler = vm[handler];
  48952. }
  48953. return vm.$watch(expOrFn, handler, options)
  48954. }
  48955. function stateMixin (Vue) {
  48956. // flow somehow has problems with directly declared definition object
  48957. // when using Object.defineProperty, so we have to procedurally build up
  48958. // the object here.
  48959. var dataDef = {};
  48960. dataDef.get = function () { return this._data };
  48961. var propsDef = {};
  48962. propsDef.get = function () { return this._props };
  48963. {
  48964. dataDef.set = function () {
  48965. warn(
  48966. 'Avoid replacing instance root $data. ' +
  48967. 'Use nested data properties instead.',
  48968. this
  48969. );
  48970. };
  48971. propsDef.set = function () {
  48972. warn("$props is readonly.", this);
  48973. };
  48974. }
  48975. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48976. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48977. Vue.prototype.$set = set;
  48978. Vue.prototype.$delete = del;
  48979. Vue.prototype.$watch = function (
  48980. expOrFn,
  48981. cb,
  48982. options
  48983. ) {
  48984. var vm = this;
  48985. if (isPlainObject(cb)) {
  48986. return createWatcher(vm, expOrFn, cb, options)
  48987. }
  48988. options = options || {};
  48989. options.user = true;
  48990. var watcher = new Watcher(vm, expOrFn, cb, options);
  48991. if (options.immediate) {
  48992. try {
  48993. cb.call(vm, watcher.value);
  48994. } catch (error) {
  48995. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  48996. }
  48997. }
  48998. return function unwatchFn () {
  48999. watcher.teardown();
  49000. }
  49001. };
  49002. }
  49003. /* */
  49004. var uid$3 = 0;
  49005. function initMixin (Vue) {
  49006. Vue.prototype._init = function (options) {
  49007. var vm = this;
  49008. // a uid
  49009. vm._uid = uid$3++;
  49010. var startTag, endTag;
  49011. /* istanbul ignore if */
  49012. if (config.performance && mark) {
  49013. startTag = "vue-perf-start:" + (vm._uid);
  49014. endTag = "vue-perf-end:" + (vm._uid);
  49015. mark(startTag);
  49016. }
  49017. // a flag to avoid this being observed
  49018. vm._isVue = true;
  49019. // merge options
  49020. if (options && options._isComponent) {
  49021. // optimize internal component instantiation
  49022. // since dynamic options merging is pretty slow, and none of the
  49023. // internal component options needs special treatment.
  49024. initInternalComponent(vm, options);
  49025. } else {
  49026. vm.$options = mergeOptions(
  49027. resolveConstructorOptions(vm.constructor),
  49028. options || {},
  49029. vm
  49030. );
  49031. }
  49032. /* istanbul ignore else */
  49033. {
  49034. initProxy(vm);
  49035. }
  49036. // expose real self
  49037. vm._self = vm;
  49038. initLifecycle(vm);
  49039. initEvents(vm);
  49040. initRender(vm);
  49041. callHook(vm, 'beforeCreate');
  49042. initInjections(vm); // resolve injections before data/props
  49043. initState(vm);
  49044. initProvide(vm); // resolve provide after data/props
  49045. callHook(vm, 'created');
  49046. /* istanbul ignore if */
  49047. if (config.performance && mark) {
  49048. vm._name = formatComponentName(vm, false);
  49049. mark(endTag);
  49050. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49051. }
  49052. if (vm.$options.el) {
  49053. vm.$mount(vm.$options.el);
  49054. }
  49055. };
  49056. }
  49057. function initInternalComponent (vm, options) {
  49058. var opts = vm.$options = Object.create(vm.constructor.options);
  49059. // doing this because it's faster than dynamic enumeration.
  49060. var parentVnode = options._parentVnode;
  49061. opts.parent = options.parent;
  49062. opts._parentVnode = parentVnode;
  49063. var vnodeComponentOptions = parentVnode.componentOptions;
  49064. opts.propsData = vnodeComponentOptions.propsData;
  49065. opts._parentListeners = vnodeComponentOptions.listeners;
  49066. opts._renderChildren = vnodeComponentOptions.children;
  49067. opts._componentTag = vnodeComponentOptions.tag;
  49068. if (options.render) {
  49069. opts.render = options.render;
  49070. opts.staticRenderFns = options.staticRenderFns;
  49071. }
  49072. }
  49073. function resolveConstructorOptions (Ctor) {
  49074. var options = Ctor.options;
  49075. if (Ctor.super) {
  49076. var superOptions = resolveConstructorOptions(Ctor.super);
  49077. var cachedSuperOptions = Ctor.superOptions;
  49078. if (superOptions !== cachedSuperOptions) {
  49079. // super option changed,
  49080. // need to resolve new options.
  49081. Ctor.superOptions = superOptions;
  49082. // check if there are any late-modified/attached options (#4976)
  49083. var modifiedOptions = resolveModifiedOptions(Ctor);
  49084. // update base extend options
  49085. if (modifiedOptions) {
  49086. extend(Ctor.extendOptions, modifiedOptions);
  49087. }
  49088. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49089. if (options.name) {
  49090. options.components[options.name] = Ctor;
  49091. }
  49092. }
  49093. }
  49094. return options
  49095. }
  49096. function resolveModifiedOptions (Ctor) {
  49097. var modified;
  49098. var latest = Ctor.options;
  49099. var sealed = Ctor.sealedOptions;
  49100. for (var key in latest) {
  49101. if (latest[key] !== sealed[key]) {
  49102. if (!modified) { modified = {}; }
  49103. modified[key] = latest[key];
  49104. }
  49105. }
  49106. return modified
  49107. }
  49108. function Vue (options) {
  49109. if (!(this instanceof Vue)
  49110. ) {
  49111. warn('Vue is a constructor and should be called with the `new` keyword');
  49112. }
  49113. this._init(options);
  49114. }
  49115. initMixin(Vue);
  49116. stateMixin(Vue);
  49117. eventsMixin(Vue);
  49118. lifecycleMixin(Vue);
  49119. renderMixin(Vue);
  49120. /* */
  49121. function initUse (Vue) {
  49122. Vue.use = function (plugin) {
  49123. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49124. if (installedPlugins.indexOf(plugin) > -1) {
  49125. return this
  49126. }
  49127. // additional parameters
  49128. var args = toArray(arguments, 1);
  49129. args.unshift(this);
  49130. if (typeof plugin.install === 'function') {
  49131. plugin.install.apply(plugin, args);
  49132. } else if (typeof plugin === 'function') {
  49133. plugin.apply(null, args);
  49134. }
  49135. installedPlugins.push(plugin);
  49136. return this
  49137. };
  49138. }
  49139. /* */
  49140. function initMixin$1 (Vue) {
  49141. Vue.mixin = function (mixin) {
  49142. this.options = mergeOptions(this.options, mixin);
  49143. return this
  49144. };
  49145. }
  49146. /* */
  49147. function initExtend (Vue) {
  49148. /**
  49149. * Each instance constructor, including Vue, has a unique
  49150. * cid. This enables us to create wrapped "child
  49151. * constructors" for prototypal inheritance and cache them.
  49152. */
  49153. Vue.cid = 0;
  49154. var cid = 1;
  49155. /**
  49156. * Class inheritance
  49157. */
  49158. Vue.extend = function (extendOptions) {
  49159. extendOptions = extendOptions || {};
  49160. var Super = this;
  49161. var SuperId = Super.cid;
  49162. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49163. if (cachedCtors[SuperId]) {
  49164. return cachedCtors[SuperId]
  49165. }
  49166. var name = extendOptions.name || Super.options.name;
  49167. if (name) {
  49168. validateComponentName(name);
  49169. }
  49170. var Sub = function VueComponent (options) {
  49171. this._init(options);
  49172. };
  49173. Sub.prototype = Object.create(Super.prototype);
  49174. Sub.prototype.constructor = Sub;
  49175. Sub.cid = cid++;
  49176. Sub.options = mergeOptions(
  49177. Super.options,
  49178. extendOptions
  49179. );
  49180. Sub['super'] = Super;
  49181. // For props and computed properties, we define the proxy getters on
  49182. // the Vue instances at extension time, on the extended prototype. This
  49183. // avoids Object.defineProperty calls for each instance created.
  49184. if (Sub.options.props) {
  49185. initProps$1(Sub);
  49186. }
  49187. if (Sub.options.computed) {
  49188. initComputed$1(Sub);
  49189. }
  49190. // allow further extension/mixin/plugin usage
  49191. Sub.extend = Super.extend;
  49192. Sub.mixin = Super.mixin;
  49193. Sub.use = Super.use;
  49194. // create asset registers, so extended classes
  49195. // can have their private assets too.
  49196. ASSET_TYPES.forEach(function (type) {
  49197. Sub[type] = Super[type];
  49198. });
  49199. // enable recursive self-lookup
  49200. if (name) {
  49201. Sub.options.components[name] = Sub;
  49202. }
  49203. // keep a reference to the super options at extension time.
  49204. // later at instantiation we can check if Super's options have
  49205. // been updated.
  49206. Sub.superOptions = Super.options;
  49207. Sub.extendOptions = extendOptions;
  49208. Sub.sealedOptions = extend({}, Sub.options);
  49209. // cache constructor
  49210. cachedCtors[SuperId] = Sub;
  49211. return Sub
  49212. };
  49213. }
  49214. function initProps$1 (Comp) {
  49215. var props = Comp.options.props;
  49216. for (var key in props) {
  49217. proxy(Comp.prototype, "_props", key);
  49218. }
  49219. }
  49220. function initComputed$1 (Comp) {
  49221. var computed = Comp.options.computed;
  49222. for (var key in computed) {
  49223. defineComputed(Comp.prototype, key, computed[key]);
  49224. }
  49225. }
  49226. /* */
  49227. function initAssetRegisters (Vue) {
  49228. /**
  49229. * Create asset registration methods.
  49230. */
  49231. ASSET_TYPES.forEach(function (type) {
  49232. Vue[type] = function (
  49233. id,
  49234. definition
  49235. ) {
  49236. if (!definition) {
  49237. return this.options[type + 's'][id]
  49238. } else {
  49239. /* istanbul ignore if */
  49240. if (type === 'component') {
  49241. validateComponentName(id);
  49242. }
  49243. if (type === 'component' && isPlainObject(definition)) {
  49244. definition.name = definition.name || id;
  49245. definition = this.options._base.extend(definition);
  49246. }
  49247. if (type === 'directive' && typeof definition === 'function') {
  49248. definition = { bind: definition, update: definition };
  49249. }
  49250. this.options[type + 's'][id] = definition;
  49251. return definition
  49252. }
  49253. };
  49254. });
  49255. }
  49256. /* */
  49257. function getComponentName (opts) {
  49258. return opts && (opts.Ctor.options.name || opts.tag)
  49259. }
  49260. function matches (pattern, name) {
  49261. if (Array.isArray(pattern)) {
  49262. return pattern.indexOf(name) > -1
  49263. } else if (typeof pattern === 'string') {
  49264. return pattern.split(',').indexOf(name) > -1
  49265. } else if (isRegExp(pattern)) {
  49266. return pattern.test(name)
  49267. }
  49268. /* istanbul ignore next */
  49269. return false
  49270. }
  49271. function pruneCache (keepAliveInstance, filter) {
  49272. var cache = keepAliveInstance.cache;
  49273. var keys = keepAliveInstance.keys;
  49274. var _vnode = keepAliveInstance._vnode;
  49275. for (var key in cache) {
  49276. var cachedNode = cache[key];
  49277. if (cachedNode) {
  49278. var name = getComponentName(cachedNode.componentOptions);
  49279. if (name && !filter(name)) {
  49280. pruneCacheEntry(cache, key, keys, _vnode);
  49281. }
  49282. }
  49283. }
  49284. }
  49285. function pruneCacheEntry (
  49286. cache,
  49287. key,
  49288. keys,
  49289. current
  49290. ) {
  49291. var cached$$1 = cache[key];
  49292. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49293. cached$$1.componentInstance.$destroy();
  49294. }
  49295. cache[key] = null;
  49296. remove(keys, key);
  49297. }
  49298. var patternTypes = [String, RegExp, Array];
  49299. var KeepAlive = {
  49300. name: 'keep-alive',
  49301. abstract: true,
  49302. props: {
  49303. include: patternTypes,
  49304. exclude: patternTypes,
  49305. max: [String, Number]
  49306. },
  49307. created: function created () {
  49308. this.cache = Object.create(null);
  49309. this.keys = [];
  49310. },
  49311. destroyed: function destroyed () {
  49312. for (var key in this.cache) {
  49313. pruneCacheEntry(this.cache, key, this.keys);
  49314. }
  49315. },
  49316. mounted: function mounted () {
  49317. var this$1 = this;
  49318. this.$watch('include', function (val) {
  49319. pruneCache(this$1, function (name) { return matches(val, name); });
  49320. });
  49321. this.$watch('exclude', function (val) {
  49322. pruneCache(this$1, function (name) { return !matches(val, name); });
  49323. });
  49324. },
  49325. render: function render () {
  49326. var slot = this.$slots.default;
  49327. var vnode = getFirstComponentChild(slot);
  49328. var componentOptions = vnode && vnode.componentOptions;
  49329. if (componentOptions) {
  49330. // check pattern
  49331. var name = getComponentName(componentOptions);
  49332. var ref = this;
  49333. var include = ref.include;
  49334. var exclude = ref.exclude;
  49335. if (
  49336. // not included
  49337. (include && (!name || !matches(include, name))) ||
  49338. // excluded
  49339. (exclude && name && matches(exclude, name))
  49340. ) {
  49341. return vnode
  49342. }
  49343. var ref$1 = this;
  49344. var cache = ref$1.cache;
  49345. var keys = ref$1.keys;
  49346. var key = vnode.key == null
  49347. // same constructor may get registered as different local components
  49348. // so cid alone is not enough (#3269)
  49349. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49350. : vnode.key;
  49351. if (cache[key]) {
  49352. vnode.componentInstance = cache[key].componentInstance;
  49353. // make current key freshest
  49354. remove(keys, key);
  49355. keys.push(key);
  49356. } else {
  49357. cache[key] = vnode;
  49358. keys.push(key);
  49359. // prune oldest entry
  49360. if (this.max && keys.length > parseInt(this.max)) {
  49361. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49362. }
  49363. }
  49364. vnode.data.keepAlive = true;
  49365. }
  49366. return vnode || (slot && slot[0])
  49367. }
  49368. };
  49369. var builtInComponents = {
  49370. KeepAlive: KeepAlive
  49371. };
  49372. /* */
  49373. function initGlobalAPI (Vue) {
  49374. // config
  49375. var configDef = {};
  49376. configDef.get = function () { return config; };
  49377. {
  49378. configDef.set = function () {
  49379. warn(
  49380. 'Do not replace the Vue.config object, set individual fields instead.'
  49381. );
  49382. };
  49383. }
  49384. Object.defineProperty(Vue, 'config', configDef);
  49385. // exposed util methods.
  49386. // NOTE: these are not considered part of the public API - avoid relying on
  49387. // them unless you are aware of the risk.
  49388. Vue.util = {
  49389. warn: warn,
  49390. extend: extend,
  49391. mergeOptions: mergeOptions,
  49392. defineReactive: defineReactive$$1
  49393. };
  49394. Vue.set = set;
  49395. Vue.delete = del;
  49396. Vue.nextTick = nextTick;
  49397. // 2.6 explicit observable API
  49398. Vue.observable = function (obj) {
  49399. observe(obj);
  49400. return obj
  49401. };
  49402. Vue.options = Object.create(null);
  49403. ASSET_TYPES.forEach(function (type) {
  49404. Vue.options[type + 's'] = Object.create(null);
  49405. });
  49406. // this is used to identify the "base" constructor to extend all plain-object
  49407. // components with in Weex's multi-instance scenarios.
  49408. Vue.options._base = Vue;
  49409. extend(Vue.options.components, builtInComponents);
  49410. initUse(Vue);
  49411. initMixin$1(Vue);
  49412. initExtend(Vue);
  49413. initAssetRegisters(Vue);
  49414. }
  49415. initGlobalAPI(Vue);
  49416. Object.defineProperty(Vue.prototype, '$isServer', {
  49417. get: isServerRendering
  49418. });
  49419. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49420. get: function get () {
  49421. /* istanbul ignore next */
  49422. return this.$vnode && this.$vnode.ssrContext
  49423. }
  49424. });
  49425. // expose FunctionalRenderContext for ssr runtime helper installation
  49426. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49427. value: FunctionalRenderContext
  49428. });
  49429. Vue.version = '2.6.11';
  49430. /* */
  49431. // these are reserved for web because they are directly compiled away
  49432. // during template compilation
  49433. var isReservedAttr = makeMap('style,class');
  49434. // attributes that should be using props for binding
  49435. var acceptValue = makeMap('input,textarea,option,select,progress');
  49436. var mustUseProp = function (tag, type, attr) {
  49437. return (
  49438. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49439. (attr === 'selected' && tag === 'option') ||
  49440. (attr === 'checked' && tag === 'input') ||
  49441. (attr === 'muted' && tag === 'video')
  49442. )
  49443. };
  49444. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49445. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49446. var convertEnumeratedValue = function (key, value) {
  49447. return isFalsyAttrValue(value) || value === 'false'
  49448. ? 'false'
  49449. // allow arbitrary string value for contenteditable
  49450. : key === 'contenteditable' && isValidContentEditableValue(value)
  49451. ? value
  49452. : 'true'
  49453. };
  49454. var isBooleanAttr = makeMap(
  49455. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49456. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49457. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49458. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49459. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49460. 'truespeed,typemustmatch,visible'
  49461. );
  49462. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49463. var isXlink = function (name) {
  49464. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49465. };
  49466. var getXlinkProp = function (name) {
  49467. return isXlink(name) ? name.slice(6, name.length) : ''
  49468. };
  49469. var isFalsyAttrValue = function (val) {
  49470. return val == null || val === false
  49471. };
  49472. /* */
  49473. function genClassForVnode (vnode) {
  49474. var data = vnode.data;
  49475. var parentNode = vnode;
  49476. var childNode = vnode;
  49477. while (isDef(childNode.componentInstance)) {
  49478. childNode = childNode.componentInstance._vnode;
  49479. if (childNode && childNode.data) {
  49480. data = mergeClassData(childNode.data, data);
  49481. }
  49482. }
  49483. while (isDef(parentNode = parentNode.parent)) {
  49484. if (parentNode && parentNode.data) {
  49485. data = mergeClassData(data, parentNode.data);
  49486. }
  49487. }
  49488. return renderClass(data.staticClass, data.class)
  49489. }
  49490. function mergeClassData (child, parent) {
  49491. return {
  49492. staticClass: concat(child.staticClass, parent.staticClass),
  49493. class: isDef(child.class)
  49494. ? [child.class, parent.class]
  49495. : parent.class
  49496. }
  49497. }
  49498. function renderClass (
  49499. staticClass,
  49500. dynamicClass
  49501. ) {
  49502. if (isDef(staticClass) || isDef(dynamicClass)) {
  49503. return concat(staticClass, stringifyClass(dynamicClass))
  49504. }
  49505. /* istanbul ignore next */
  49506. return ''
  49507. }
  49508. function concat (a, b) {
  49509. return a ? b ? (a + ' ' + b) : a : (b || '')
  49510. }
  49511. function stringifyClass (value) {
  49512. if (Array.isArray(value)) {
  49513. return stringifyArray(value)
  49514. }
  49515. if (isObject(value)) {
  49516. return stringifyObject(value)
  49517. }
  49518. if (typeof value === 'string') {
  49519. return value
  49520. }
  49521. /* istanbul ignore next */
  49522. return ''
  49523. }
  49524. function stringifyArray (value) {
  49525. var res = '';
  49526. var stringified;
  49527. for (var i = 0, l = value.length; i < l; i++) {
  49528. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49529. if (res) { res += ' '; }
  49530. res += stringified;
  49531. }
  49532. }
  49533. return res
  49534. }
  49535. function stringifyObject (value) {
  49536. var res = '';
  49537. for (var key in value) {
  49538. if (value[key]) {
  49539. if (res) { res += ' '; }
  49540. res += key;
  49541. }
  49542. }
  49543. return res
  49544. }
  49545. /* */
  49546. var namespaceMap = {
  49547. svg: 'http://www.w3.org/2000/svg',
  49548. math: 'http://www.w3.org/1998/Math/MathML'
  49549. };
  49550. var isHTMLTag = makeMap(
  49551. 'html,body,base,head,link,meta,style,title,' +
  49552. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49553. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49554. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49555. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49556. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49557. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49558. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49559. 'output,progress,select,textarea,' +
  49560. 'details,dialog,menu,menuitem,summary,' +
  49561. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49562. );
  49563. // this map is intentionally selective, only covering SVG elements that may
  49564. // contain child elements.
  49565. var isSVG = makeMap(
  49566. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49567. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49568. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49569. true
  49570. );
  49571. var isPreTag = function (tag) { return tag === 'pre'; };
  49572. var isReservedTag = function (tag) {
  49573. return isHTMLTag(tag) || isSVG(tag)
  49574. };
  49575. function getTagNamespace (tag) {
  49576. if (isSVG(tag)) {
  49577. return 'svg'
  49578. }
  49579. // basic support for MathML
  49580. // note it doesn't support other MathML elements being component roots
  49581. if (tag === 'math') {
  49582. return 'math'
  49583. }
  49584. }
  49585. var unknownElementCache = Object.create(null);
  49586. function isUnknownElement (tag) {
  49587. /* istanbul ignore if */
  49588. if (!inBrowser) {
  49589. return true
  49590. }
  49591. if (isReservedTag(tag)) {
  49592. return false
  49593. }
  49594. tag = tag.toLowerCase();
  49595. /* istanbul ignore if */
  49596. if (unknownElementCache[tag] != null) {
  49597. return unknownElementCache[tag]
  49598. }
  49599. var el = document.createElement(tag);
  49600. if (tag.indexOf('-') > -1) {
  49601. // http://stackoverflow.com/a/28210364/1070244
  49602. return (unknownElementCache[tag] = (
  49603. el.constructor === window.HTMLUnknownElement ||
  49604. el.constructor === window.HTMLElement
  49605. ))
  49606. } else {
  49607. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49608. }
  49609. }
  49610. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49611. /* */
  49612. /**
  49613. * Query an element selector if it's not an element already.
  49614. */
  49615. function query (el) {
  49616. if (typeof el === 'string') {
  49617. var selected = document.querySelector(el);
  49618. if (!selected) {
  49619. warn(
  49620. 'Cannot find element: ' + el
  49621. );
  49622. return document.createElement('div')
  49623. }
  49624. return selected
  49625. } else {
  49626. return el
  49627. }
  49628. }
  49629. /* */
  49630. function createElement$1 (tagName, vnode) {
  49631. var elm = document.createElement(tagName);
  49632. if (tagName !== 'select') {
  49633. return elm
  49634. }
  49635. // false or null will remove the attribute but undefined will not
  49636. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49637. elm.setAttribute('multiple', 'multiple');
  49638. }
  49639. return elm
  49640. }
  49641. function createElementNS (namespace, tagName) {
  49642. return document.createElementNS(namespaceMap[namespace], tagName)
  49643. }
  49644. function createTextNode (text) {
  49645. return document.createTextNode(text)
  49646. }
  49647. function createComment (text) {
  49648. return document.createComment(text)
  49649. }
  49650. function insertBefore (parentNode, newNode, referenceNode) {
  49651. parentNode.insertBefore(newNode, referenceNode);
  49652. }
  49653. function removeChild (node, child) {
  49654. node.removeChild(child);
  49655. }
  49656. function appendChild (node, child) {
  49657. node.appendChild(child);
  49658. }
  49659. function parentNode (node) {
  49660. return node.parentNode
  49661. }
  49662. function nextSibling (node) {
  49663. return node.nextSibling
  49664. }
  49665. function tagName (node) {
  49666. return node.tagName
  49667. }
  49668. function setTextContent (node, text) {
  49669. node.textContent = text;
  49670. }
  49671. function setStyleScope (node, scopeId) {
  49672. node.setAttribute(scopeId, '');
  49673. }
  49674. var nodeOps = /*#__PURE__*/Object.freeze({
  49675. createElement: createElement$1,
  49676. createElementNS: createElementNS,
  49677. createTextNode: createTextNode,
  49678. createComment: createComment,
  49679. insertBefore: insertBefore,
  49680. removeChild: removeChild,
  49681. appendChild: appendChild,
  49682. parentNode: parentNode,
  49683. nextSibling: nextSibling,
  49684. tagName: tagName,
  49685. setTextContent: setTextContent,
  49686. setStyleScope: setStyleScope
  49687. });
  49688. /* */
  49689. var ref = {
  49690. create: function create (_, vnode) {
  49691. registerRef(vnode);
  49692. },
  49693. update: function update (oldVnode, vnode) {
  49694. if (oldVnode.data.ref !== vnode.data.ref) {
  49695. registerRef(oldVnode, true);
  49696. registerRef(vnode);
  49697. }
  49698. },
  49699. destroy: function destroy (vnode) {
  49700. registerRef(vnode, true);
  49701. }
  49702. };
  49703. function registerRef (vnode, isRemoval) {
  49704. var key = vnode.data.ref;
  49705. if (!isDef(key)) { return }
  49706. var vm = vnode.context;
  49707. var ref = vnode.componentInstance || vnode.elm;
  49708. var refs = vm.$refs;
  49709. if (isRemoval) {
  49710. if (Array.isArray(refs[key])) {
  49711. remove(refs[key], ref);
  49712. } else if (refs[key] === ref) {
  49713. refs[key] = undefined;
  49714. }
  49715. } else {
  49716. if (vnode.data.refInFor) {
  49717. if (!Array.isArray(refs[key])) {
  49718. refs[key] = [ref];
  49719. } else if (refs[key].indexOf(ref) < 0) {
  49720. // $flow-disable-line
  49721. refs[key].push(ref);
  49722. }
  49723. } else {
  49724. refs[key] = ref;
  49725. }
  49726. }
  49727. }
  49728. /**
  49729. * Virtual DOM patching algorithm based on Snabbdom by
  49730. * Simon Friis Vindum (@paldepind)
  49731. * Licensed under the MIT License
  49732. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49733. *
  49734. * modified by Evan You (@yyx990803)
  49735. *
  49736. * Not type-checking this because this file is perf-critical and the cost
  49737. * of making flow understand it is not worth it.
  49738. */
  49739. var emptyNode = new VNode('', {}, []);
  49740. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49741. function sameVnode (a, b) {
  49742. return (
  49743. a.key === b.key && (
  49744. (
  49745. a.tag === b.tag &&
  49746. a.isComment === b.isComment &&
  49747. isDef(a.data) === isDef(b.data) &&
  49748. sameInputType(a, b)
  49749. ) || (
  49750. isTrue(a.isAsyncPlaceholder) &&
  49751. a.asyncFactory === b.asyncFactory &&
  49752. isUndef(b.asyncFactory.error)
  49753. )
  49754. )
  49755. )
  49756. }
  49757. function sameInputType (a, b) {
  49758. if (a.tag !== 'input') { return true }
  49759. var i;
  49760. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49761. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49762. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49763. }
  49764. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49765. var i, key;
  49766. var map = {};
  49767. for (i = beginIdx; i <= endIdx; ++i) {
  49768. key = children[i].key;
  49769. if (isDef(key)) { map[key] = i; }
  49770. }
  49771. return map
  49772. }
  49773. function createPatchFunction (backend) {
  49774. var i, j;
  49775. var cbs = {};
  49776. var modules = backend.modules;
  49777. var nodeOps = backend.nodeOps;
  49778. for (i = 0; i < hooks.length; ++i) {
  49779. cbs[hooks[i]] = [];
  49780. for (j = 0; j < modules.length; ++j) {
  49781. if (isDef(modules[j][hooks[i]])) {
  49782. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49783. }
  49784. }
  49785. }
  49786. function emptyNodeAt (elm) {
  49787. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49788. }
  49789. function createRmCb (childElm, listeners) {
  49790. function remove$$1 () {
  49791. if (--remove$$1.listeners === 0) {
  49792. removeNode(childElm);
  49793. }
  49794. }
  49795. remove$$1.listeners = listeners;
  49796. return remove$$1
  49797. }
  49798. function removeNode (el) {
  49799. var parent = nodeOps.parentNode(el);
  49800. // element may have already been removed due to v-html / v-text
  49801. if (isDef(parent)) {
  49802. nodeOps.removeChild(parent, el);
  49803. }
  49804. }
  49805. function isUnknownElement$$1 (vnode, inVPre) {
  49806. return (
  49807. !inVPre &&
  49808. !vnode.ns &&
  49809. !(
  49810. config.ignoredElements.length &&
  49811. config.ignoredElements.some(function (ignore) {
  49812. return isRegExp(ignore)
  49813. ? ignore.test(vnode.tag)
  49814. : ignore === vnode.tag
  49815. })
  49816. ) &&
  49817. config.isUnknownElement(vnode.tag)
  49818. )
  49819. }
  49820. var creatingElmInVPre = 0;
  49821. function createElm (
  49822. vnode,
  49823. insertedVnodeQueue,
  49824. parentElm,
  49825. refElm,
  49826. nested,
  49827. ownerArray,
  49828. index
  49829. ) {
  49830. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49831. // This vnode was used in a previous render!
  49832. // now it's used as a new node, overwriting its elm would cause
  49833. // potential patch errors down the road when it's used as an insertion
  49834. // reference node. Instead, we clone the node on-demand before creating
  49835. // associated DOM element for it.
  49836. vnode = ownerArray[index] = cloneVNode(vnode);
  49837. }
  49838. vnode.isRootInsert = !nested; // for transition enter check
  49839. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49840. return
  49841. }
  49842. var data = vnode.data;
  49843. var children = vnode.children;
  49844. var tag = vnode.tag;
  49845. if (isDef(tag)) {
  49846. {
  49847. if (data && data.pre) {
  49848. creatingElmInVPre++;
  49849. }
  49850. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49851. warn(
  49852. 'Unknown custom element: <' + tag + '> - did you ' +
  49853. 'register the component correctly? For recursive components, ' +
  49854. 'make sure to provide the "name" option.',
  49855. vnode.context
  49856. );
  49857. }
  49858. }
  49859. vnode.elm = vnode.ns
  49860. ? nodeOps.createElementNS(vnode.ns, tag)
  49861. : nodeOps.createElement(tag, vnode);
  49862. setScope(vnode);
  49863. /* istanbul ignore if */
  49864. {
  49865. createChildren(vnode, children, insertedVnodeQueue);
  49866. if (isDef(data)) {
  49867. invokeCreateHooks(vnode, insertedVnodeQueue);
  49868. }
  49869. insert(parentElm, vnode.elm, refElm);
  49870. }
  49871. if (data && data.pre) {
  49872. creatingElmInVPre--;
  49873. }
  49874. } else if (isTrue(vnode.isComment)) {
  49875. vnode.elm = nodeOps.createComment(vnode.text);
  49876. insert(parentElm, vnode.elm, refElm);
  49877. } else {
  49878. vnode.elm = nodeOps.createTextNode(vnode.text);
  49879. insert(parentElm, vnode.elm, refElm);
  49880. }
  49881. }
  49882. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49883. var i = vnode.data;
  49884. if (isDef(i)) {
  49885. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49886. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49887. i(vnode, false /* hydrating */);
  49888. }
  49889. // after calling the init hook, if the vnode is a child component
  49890. // it should've created a child instance and mounted it. the child
  49891. // component also has set the placeholder vnode's elm.
  49892. // in that case we can just return the element and be done.
  49893. if (isDef(vnode.componentInstance)) {
  49894. initComponent(vnode, insertedVnodeQueue);
  49895. insert(parentElm, vnode.elm, refElm);
  49896. if (isTrue(isReactivated)) {
  49897. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49898. }
  49899. return true
  49900. }
  49901. }
  49902. }
  49903. function initComponent (vnode, insertedVnodeQueue) {
  49904. if (isDef(vnode.data.pendingInsert)) {
  49905. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49906. vnode.data.pendingInsert = null;
  49907. }
  49908. vnode.elm = vnode.componentInstance.$el;
  49909. if (isPatchable(vnode)) {
  49910. invokeCreateHooks(vnode, insertedVnodeQueue);
  49911. setScope(vnode);
  49912. } else {
  49913. // empty component root.
  49914. // skip all element-related modules except for ref (#3455)
  49915. registerRef(vnode);
  49916. // make sure to invoke the insert hook
  49917. insertedVnodeQueue.push(vnode);
  49918. }
  49919. }
  49920. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49921. var i;
  49922. // hack for #4339: a reactivated component with inner transition
  49923. // does not trigger because the inner node's created hooks are not called
  49924. // again. It's not ideal to involve module-specific logic in here but
  49925. // there doesn't seem to be a better way to do it.
  49926. var innerNode = vnode;
  49927. while (innerNode.componentInstance) {
  49928. innerNode = innerNode.componentInstance._vnode;
  49929. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49930. for (i = 0; i < cbs.activate.length; ++i) {
  49931. cbs.activate[i](emptyNode, innerNode);
  49932. }
  49933. insertedVnodeQueue.push(innerNode);
  49934. break
  49935. }
  49936. }
  49937. // unlike a newly created component,
  49938. // a reactivated keep-alive component doesn't insert itself
  49939. insert(parentElm, vnode.elm, refElm);
  49940. }
  49941. function insert (parent, elm, ref$$1) {
  49942. if (isDef(parent)) {
  49943. if (isDef(ref$$1)) {
  49944. if (nodeOps.parentNode(ref$$1) === parent) {
  49945. nodeOps.insertBefore(parent, elm, ref$$1);
  49946. }
  49947. } else {
  49948. nodeOps.appendChild(parent, elm);
  49949. }
  49950. }
  49951. }
  49952. function createChildren (vnode, children, insertedVnodeQueue) {
  49953. if (Array.isArray(children)) {
  49954. {
  49955. checkDuplicateKeys(children);
  49956. }
  49957. for (var i = 0; i < children.length; ++i) {
  49958. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49959. }
  49960. } else if (isPrimitive(vnode.text)) {
  49961. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49962. }
  49963. }
  49964. function isPatchable (vnode) {
  49965. while (vnode.componentInstance) {
  49966. vnode = vnode.componentInstance._vnode;
  49967. }
  49968. return isDef(vnode.tag)
  49969. }
  49970. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49971. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49972. cbs.create[i$1](emptyNode, vnode);
  49973. }
  49974. i = vnode.data.hook; // Reuse variable
  49975. if (isDef(i)) {
  49976. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49977. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49978. }
  49979. }
  49980. // set scope id attribute for scoped CSS.
  49981. // this is implemented as a special case to avoid the overhead
  49982. // of going through the normal attribute patching process.
  49983. function setScope (vnode) {
  49984. var i;
  49985. if (isDef(i = vnode.fnScopeId)) {
  49986. nodeOps.setStyleScope(vnode.elm, i);
  49987. } else {
  49988. var ancestor = vnode;
  49989. while (ancestor) {
  49990. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  49991. nodeOps.setStyleScope(vnode.elm, i);
  49992. }
  49993. ancestor = ancestor.parent;
  49994. }
  49995. }
  49996. // for slot content they should also get the scopeId from the host instance.
  49997. if (isDef(i = activeInstance) &&
  49998. i !== vnode.context &&
  49999. i !== vnode.fnContext &&
  50000. isDef(i = i.$options._scopeId)
  50001. ) {
  50002. nodeOps.setStyleScope(vnode.elm, i);
  50003. }
  50004. }
  50005. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50006. for (; startIdx <= endIdx; ++startIdx) {
  50007. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50008. }
  50009. }
  50010. function invokeDestroyHook (vnode) {
  50011. var i, j;
  50012. var data = vnode.data;
  50013. if (isDef(data)) {
  50014. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50015. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50016. }
  50017. if (isDef(i = vnode.children)) {
  50018. for (j = 0; j < vnode.children.length; ++j) {
  50019. invokeDestroyHook(vnode.children[j]);
  50020. }
  50021. }
  50022. }
  50023. function removeVnodes (vnodes, startIdx, endIdx) {
  50024. for (; startIdx <= endIdx; ++startIdx) {
  50025. var ch = vnodes[startIdx];
  50026. if (isDef(ch)) {
  50027. if (isDef(ch.tag)) {
  50028. removeAndInvokeRemoveHook(ch);
  50029. invokeDestroyHook(ch);
  50030. } else { // Text node
  50031. removeNode(ch.elm);
  50032. }
  50033. }
  50034. }
  50035. }
  50036. function removeAndInvokeRemoveHook (vnode, rm) {
  50037. if (isDef(rm) || isDef(vnode.data)) {
  50038. var i;
  50039. var listeners = cbs.remove.length + 1;
  50040. if (isDef(rm)) {
  50041. // we have a recursively passed down rm callback
  50042. // increase the listeners count
  50043. rm.listeners += listeners;
  50044. } else {
  50045. // directly removing
  50046. rm = createRmCb(vnode.elm, listeners);
  50047. }
  50048. // recursively invoke hooks on child component root node
  50049. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50050. removeAndInvokeRemoveHook(i, rm);
  50051. }
  50052. for (i = 0; i < cbs.remove.length; ++i) {
  50053. cbs.remove[i](vnode, rm);
  50054. }
  50055. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50056. i(vnode, rm);
  50057. } else {
  50058. rm();
  50059. }
  50060. } else {
  50061. removeNode(vnode.elm);
  50062. }
  50063. }
  50064. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50065. var oldStartIdx = 0;
  50066. var newStartIdx = 0;
  50067. var oldEndIdx = oldCh.length - 1;
  50068. var oldStartVnode = oldCh[0];
  50069. var oldEndVnode = oldCh[oldEndIdx];
  50070. var newEndIdx = newCh.length - 1;
  50071. var newStartVnode = newCh[0];
  50072. var newEndVnode = newCh[newEndIdx];
  50073. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50074. // removeOnly is a special flag used only by <transition-group>
  50075. // to ensure removed elements stay in correct relative positions
  50076. // during leaving transitions
  50077. var canMove = !removeOnly;
  50078. {
  50079. checkDuplicateKeys(newCh);
  50080. }
  50081. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50082. if (isUndef(oldStartVnode)) {
  50083. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50084. } else if (isUndef(oldEndVnode)) {
  50085. oldEndVnode = oldCh[--oldEndIdx];
  50086. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50087. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50088. oldStartVnode = oldCh[++oldStartIdx];
  50089. newStartVnode = newCh[++newStartIdx];
  50090. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50091. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50092. oldEndVnode = oldCh[--oldEndIdx];
  50093. newEndVnode = newCh[--newEndIdx];
  50094. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50095. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50096. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50097. oldStartVnode = oldCh[++oldStartIdx];
  50098. newEndVnode = newCh[--newEndIdx];
  50099. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50100. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50101. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50102. oldEndVnode = oldCh[--oldEndIdx];
  50103. newStartVnode = newCh[++newStartIdx];
  50104. } else {
  50105. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50106. idxInOld = isDef(newStartVnode.key)
  50107. ? oldKeyToIdx[newStartVnode.key]
  50108. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50109. if (isUndef(idxInOld)) { // New element
  50110. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50111. } else {
  50112. vnodeToMove = oldCh[idxInOld];
  50113. if (sameVnode(vnodeToMove, newStartVnode)) {
  50114. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50115. oldCh[idxInOld] = undefined;
  50116. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50117. } else {
  50118. // same key but different element. treat as new element
  50119. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50120. }
  50121. }
  50122. newStartVnode = newCh[++newStartIdx];
  50123. }
  50124. }
  50125. if (oldStartIdx > oldEndIdx) {
  50126. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50127. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50128. } else if (newStartIdx > newEndIdx) {
  50129. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50130. }
  50131. }
  50132. function checkDuplicateKeys (children) {
  50133. var seenKeys = {};
  50134. for (var i = 0; i < children.length; i++) {
  50135. var vnode = children[i];
  50136. var key = vnode.key;
  50137. if (isDef(key)) {
  50138. if (seenKeys[key]) {
  50139. warn(
  50140. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50141. vnode.context
  50142. );
  50143. } else {
  50144. seenKeys[key] = true;
  50145. }
  50146. }
  50147. }
  50148. }
  50149. function findIdxInOld (node, oldCh, start, end) {
  50150. for (var i = start; i < end; i++) {
  50151. var c = oldCh[i];
  50152. if (isDef(c) && sameVnode(node, c)) { return i }
  50153. }
  50154. }
  50155. function patchVnode (
  50156. oldVnode,
  50157. vnode,
  50158. insertedVnodeQueue,
  50159. ownerArray,
  50160. index,
  50161. removeOnly
  50162. ) {
  50163. if (oldVnode === vnode) {
  50164. return
  50165. }
  50166. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50167. // clone reused vnode
  50168. vnode = ownerArray[index] = cloneVNode(vnode);
  50169. }
  50170. var elm = vnode.elm = oldVnode.elm;
  50171. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50172. if (isDef(vnode.asyncFactory.resolved)) {
  50173. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50174. } else {
  50175. vnode.isAsyncPlaceholder = true;
  50176. }
  50177. return
  50178. }
  50179. // reuse element for static trees.
  50180. // note we only do this if the vnode is cloned -
  50181. // if the new node is not cloned it means the render functions have been
  50182. // reset by the hot-reload-api and we need to do a proper re-render.
  50183. if (isTrue(vnode.isStatic) &&
  50184. isTrue(oldVnode.isStatic) &&
  50185. vnode.key === oldVnode.key &&
  50186. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50187. ) {
  50188. vnode.componentInstance = oldVnode.componentInstance;
  50189. return
  50190. }
  50191. var i;
  50192. var data = vnode.data;
  50193. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50194. i(oldVnode, vnode);
  50195. }
  50196. var oldCh = oldVnode.children;
  50197. var ch = vnode.children;
  50198. if (isDef(data) && isPatchable(vnode)) {
  50199. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50200. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50201. }
  50202. if (isUndef(vnode.text)) {
  50203. if (isDef(oldCh) && isDef(ch)) {
  50204. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50205. } else if (isDef(ch)) {
  50206. {
  50207. checkDuplicateKeys(ch);
  50208. }
  50209. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50210. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50211. } else if (isDef(oldCh)) {
  50212. removeVnodes(oldCh, 0, oldCh.length - 1);
  50213. } else if (isDef(oldVnode.text)) {
  50214. nodeOps.setTextContent(elm, '');
  50215. }
  50216. } else if (oldVnode.text !== vnode.text) {
  50217. nodeOps.setTextContent(elm, vnode.text);
  50218. }
  50219. if (isDef(data)) {
  50220. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50221. }
  50222. }
  50223. function invokeInsertHook (vnode, queue, initial) {
  50224. // delay insert hooks for component root nodes, invoke them after the
  50225. // element is really inserted
  50226. if (isTrue(initial) && isDef(vnode.parent)) {
  50227. vnode.parent.data.pendingInsert = queue;
  50228. } else {
  50229. for (var i = 0; i < queue.length; ++i) {
  50230. queue[i].data.hook.insert(queue[i]);
  50231. }
  50232. }
  50233. }
  50234. var hydrationBailed = false;
  50235. // list of modules that can skip create hook during hydration because they
  50236. // are already rendered on the client or has no need for initialization
  50237. // Note: style is excluded because it relies on initial clone for future
  50238. // deep updates (#7063).
  50239. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50240. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50241. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50242. var i;
  50243. var tag = vnode.tag;
  50244. var data = vnode.data;
  50245. var children = vnode.children;
  50246. inVPre = inVPre || (data && data.pre);
  50247. vnode.elm = elm;
  50248. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50249. vnode.isAsyncPlaceholder = true;
  50250. return true
  50251. }
  50252. // assert node match
  50253. {
  50254. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50255. return false
  50256. }
  50257. }
  50258. if (isDef(data)) {
  50259. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50260. if (isDef(i = vnode.componentInstance)) {
  50261. // child component. it should have hydrated its own tree.
  50262. initComponent(vnode, insertedVnodeQueue);
  50263. return true
  50264. }
  50265. }
  50266. if (isDef(tag)) {
  50267. if (isDef(children)) {
  50268. // empty element, allow client to pick up and populate children
  50269. if (!elm.hasChildNodes()) {
  50270. createChildren(vnode, children, insertedVnodeQueue);
  50271. } else {
  50272. // v-html and domProps: innerHTML
  50273. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50274. if (i !== elm.innerHTML) {
  50275. /* istanbul ignore if */
  50276. if (typeof console !== 'undefined' &&
  50277. !hydrationBailed
  50278. ) {
  50279. hydrationBailed = true;
  50280. console.warn('Parent: ', elm);
  50281. console.warn('server innerHTML: ', i);
  50282. console.warn('client innerHTML: ', elm.innerHTML);
  50283. }
  50284. return false
  50285. }
  50286. } else {
  50287. // iterate and compare children lists
  50288. var childrenMatch = true;
  50289. var childNode = elm.firstChild;
  50290. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50291. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50292. childrenMatch = false;
  50293. break
  50294. }
  50295. childNode = childNode.nextSibling;
  50296. }
  50297. // if childNode is not null, it means the actual childNodes list is
  50298. // longer than the virtual children list.
  50299. if (!childrenMatch || childNode) {
  50300. /* istanbul ignore if */
  50301. if (typeof console !== 'undefined' &&
  50302. !hydrationBailed
  50303. ) {
  50304. hydrationBailed = true;
  50305. console.warn('Parent: ', elm);
  50306. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50307. }
  50308. return false
  50309. }
  50310. }
  50311. }
  50312. }
  50313. if (isDef(data)) {
  50314. var fullInvoke = false;
  50315. for (var key in data) {
  50316. if (!isRenderedModule(key)) {
  50317. fullInvoke = true;
  50318. invokeCreateHooks(vnode, insertedVnodeQueue);
  50319. break
  50320. }
  50321. }
  50322. if (!fullInvoke && data['class']) {
  50323. // ensure collecting deps for deep class bindings for future updates
  50324. traverse(data['class']);
  50325. }
  50326. }
  50327. } else if (elm.data !== vnode.text) {
  50328. elm.data = vnode.text;
  50329. }
  50330. return true
  50331. }
  50332. function assertNodeMatch (node, vnode, inVPre) {
  50333. if (isDef(vnode.tag)) {
  50334. return vnode.tag.indexOf('vue-component') === 0 || (
  50335. !isUnknownElement$$1(vnode, inVPre) &&
  50336. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50337. )
  50338. } else {
  50339. return node.nodeType === (vnode.isComment ? 8 : 3)
  50340. }
  50341. }
  50342. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50343. if (isUndef(vnode)) {
  50344. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50345. return
  50346. }
  50347. var isInitialPatch = false;
  50348. var insertedVnodeQueue = [];
  50349. if (isUndef(oldVnode)) {
  50350. // empty mount (likely as component), create new root element
  50351. isInitialPatch = true;
  50352. createElm(vnode, insertedVnodeQueue);
  50353. } else {
  50354. var isRealElement = isDef(oldVnode.nodeType);
  50355. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50356. // patch existing root node
  50357. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50358. } else {
  50359. if (isRealElement) {
  50360. // mounting to a real element
  50361. // check if this is server-rendered content and if we can perform
  50362. // a successful hydration.
  50363. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50364. oldVnode.removeAttribute(SSR_ATTR);
  50365. hydrating = true;
  50366. }
  50367. if (isTrue(hydrating)) {
  50368. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50369. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50370. return oldVnode
  50371. } else {
  50372. warn(
  50373. 'The client-side rendered virtual DOM tree is not matching ' +
  50374. 'server-rendered content. This is likely caused by incorrect ' +
  50375. 'HTML markup, for example nesting block-level elements inside ' +
  50376. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50377. 'full client-side render.'
  50378. );
  50379. }
  50380. }
  50381. // either not server-rendered, or hydration failed.
  50382. // create an empty node and replace it
  50383. oldVnode = emptyNodeAt(oldVnode);
  50384. }
  50385. // replacing existing element
  50386. var oldElm = oldVnode.elm;
  50387. var parentElm = nodeOps.parentNode(oldElm);
  50388. // create new node
  50389. createElm(
  50390. vnode,
  50391. insertedVnodeQueue,
  50392. // extremely rare edge case: do not insert if old element is in a
  50393. // leaving transition. Only happens when combining transition +
  50394. // keep-alive + HOCs. (#4590)
  50395. oldElm._leaveCb ? null : parentElm,
  50396. nodeOps.nextSibling(oldElm)
  50397. );
  50398. // update parent placeholder node element, recursively
  50399. if (isDef(vnode.parent)) {
  50400. var ancestor = vnode.parent;
  50401. var patchable = isPatchable(vnode);
  50402. while (ancestor) {
  50403. for (var i = 0; i < cbs.destroy.length; ++i) {
  50404. cbs.destroy[i](ancestor);
  50405. }
  50406. ancestor.elm = vnode.elm;
  50407. if (patchable) {
  50408. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50409. cbs.create[i$1](emptyNode, ancestor);
  50410. }
  50411. // #6513
  50412. // invoke insert hooks that may have been merged by create hooks.
  50413. // e.g. for directives that uses the "inserted" hook.
  50414. var insert = ancestor.data.hook.insert;
  50415. if (insert.merged) {
  50416. // start at index 1 to avoid re-invoking component mounted hook
  50417. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50418. insert.fns[i$2]();
  50419. }
  50420. }
  50421. } else {
  50422. registerRef(ancestor);
  50423. }
  50424. ancestor = ancestor.parent;
  50425. }
  50426. }
  50427. // destroy old node
  50428. if (isDef(parentElm)) {
  50429. removeVnodes([oldVnode], 0, 0);
  50430. } else if (isDef(oldVnode.tag)) {
  50431. invokeDestroyHook(oldVnode);
  50432. }
  50433. }
  50434. }
  50435. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50436. return vnode.elm
  50437. }
  50438. }
  50439. /* */
  50440. var directives = {
  50441. create: updateDirectives,
  50442. update: updateDirectives,
  50443. destroy: function unbindDirectives (vnode) {
  50444. updateDirectives(vnode, emptyNode);
  50445. }
  50446. };
  50447. function updateDirectives (oldVnode, vnode) {
  50448. if (oldVnode.data.directives || vnode.data.directives) {
  50449. _update(oldVnode, vnode);
  50450. }
  50451. }
  50452. function _update (oldVnode, vnode) {
  50453. var isCreate = oldVnode === emptyNode;
  50454. var isDestroy = vnode === emptyNode;
  50455. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50456. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50457. var dirsWithInsert = [];
  50458. var dirsWithPostpatch = [];
  50459. var key, oldDir, dir;
  50460. for (key in newDirs) {
  50461. oldDir = oldDirs[key];
  50462. dir = newDirs[key];
  50463. if (!oldDir) {
  50464. // new directive, bind
  50465. callHook$1(dir, 'bind', vnode, oldVnode);
  50466. if (dir.def && dir.def.inserted) {
  50467. dirsWithInsert.push(dir);
  50468. }
  50469. } else {
  50470. // existing directive, update
  50471. dir.oldValue = oldDir.value;
  50472. dir.oldArg = oldDir.arg;
  50473. callHook$1(dir, 'update', vnode, oldVnode);
  50474. if (dir.def && dir.def.componentUpdated) {
  50475. dirsWithPostpatch.push(dir);
  50476. }
  50477. }
  50478. }
  50479. if (dirsWithInsert.length) {
  50480. var callInsert = function () {
  50481. for (var i = 0; i < dirsWithInsert.length; i++) {
  50482. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50483. }
  50484. };
  50485. if (isCreate) {
  50486. mergeVNodeHook(vnode, 'insert', callInsert);
  50487. } else {
  50488. callInsert();
  50489. }
  50490. }
  50491. if (dirsWithPostpatch.length) {
  50492. mergeVNodeHook(vnode, 'postpatch', function () {
  50493. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50494. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50495. }
  50496. });
  50497. }
  50498. if (!isCreate) {
  50499. for (key in oldDirs) {
  50500. if (!newDirs[key]) {
  50501. // no longer present, unbind
  50502. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50503. }
  50504. }
  50505. }
  50506. }
  50507. var emptyModifiers = Object.create(null);
  50508. function normalizeDirectives$1 (
  50509. dirs,
  50510. vm
  50511. ) {
  50512. var res = Object.create(null);
  50513. if (!dirs) {
  50514. // $flow-disable-line
  50515. return res
  50516. }
  50517. var i, dir;
  50518. for (i = 0; i < dirs.length; i++) {
  50519. dir = dirs[i];
  50520. if (!dir.modifiers) {
  50521. // $flow-disable-line
  50522. dir.modifiers = emptyModifiers;
  50523. }
  50524. res[getRawDirName(dir)] = dir;
  50525. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50526. }
  50527. // $flow-disable-line
  50528. return res
  50529. }
  50530. function getRawDirName (dir) {
  50531. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50532. }
  50533. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50534. var fn = dir.def && dir.def[hook];
  50535. if (fn) {
  50536. try {
  50537. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50538. } catch (e) {
  50539. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50540. }
  50541. }
  50542. }
  50543. var baseModules = [
  50544. ref,
  50545. directives
  50546. ];
  50547. /* */
  50548. function updateAttrs (oldVnode, vnode) {
  50549. var opts = vnode.componentOptions;
  50550. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50551. return
  50552. }
  50553. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50554. return
  50555. }
  50556. var key, cur, old;
  50557. var elm = vnode.elm;
  50558. var oldAttrs = oldVnode.data.attrs || {};
  50559. var attrs = vnode.data.attrs || {};
  50560. // clone observed objects, as the user probably wants to mutate it
  50561. if (isDef(attrs.__ob__)) {
  50562. attrs = vnode.data.attrs = extend({}, attrs);
  50563. }
  50564. for (key in attrs) {
  50565. cur = attrs[key];
  50566. old = oldAttrs[key];
  50567. if (old !== cur) {
  50568. setAttr(elm, key, cur);
  50569. }
  50570. }
  50571. // #4391: in IE9, setting type can reset value for input[type=radio]
  50572. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50573. /* istanbul ignore if */
  50574. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50575. setAttr(elm, 'value', attrs.value);
  50576. }
  50577. for (key in oldAttrs) {
  50578. if (isUndef(attrs[key])) {
  50579. if (isXlink(key)) {
  50580. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50581. } else if (!isEnumeratedAttr(key)) {
  50582. elm.removeAttribute(key);
  50583. }
  50584. }
  50585. }
  50586. }
  50587. function setAttr (el, key, value) {
  50588. if (el.tagName.indexOf('-') > -1) {
  50589. baseSetAttr(el, key, value);
  50590. } else if (isBooleanAttr(key)) {
  50591. // set attribute for blank value
  50592. // e.g. <option disabled>Select one</option>
  50593. if (isFalsyAttrValue(value)) {
  50594. el.removeAttribute(key);
  50595. } else {
  50596. // technically allowfullscreen is a boolean attribute for <iframe>,
  50597. // but Flash expects a value of "true" when used on <embed> tag
  50598. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50599. ? 'true'
  50600. : key;
  50601. el.setAttribute(key, value);
  50602. }
  50603. } else if (isEnumeratedAttr(key)) {
  50604. el.setAttribute(key, convertEnumeratedValue(key, value));
  50605. } else if (isXlink(key)) {
  50606. if (isFalsyAttrValue(value)) {
  50607. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50608. } else {
  50609. el.setAttributeNS(xlinkNS, key, value);
  50610. }
  50611. } else {
  50612. baseSetAttr(el, key, value);
  50613. }
  50614. }
  50615. function baseSetAttr (el, key, value) {
  50616. if (isFalsyAttrValue(value)) {
  50617. el.removeAttribute(key);
  50618. } else {
  50619. // #7138: IE10 & 11 fires input event when setting placeholder on
  50620. // <textarea>... block the first input event and remove the blocker
  50621. // immediately.
  50622. /* istanbul ignore if */
  50623. if (
  50624. isIE && !isIE9 &&
  50625. el.tagName === 'TEXTAREA' &&
  50626. key === 'placeholder' && value !== '' && !el.__ieph
  50627. ) {
  50628. var blocker = function (e) {
  50629. e.stopImmediatePropagation();
  50630. el.removeEventListener('input', blocker);
  50631. };
  50632. el.addEventListener('input', blocker);
  50633. // $flow-disable-line
  50634. el.__ieph = true; /* IE placeholder patched */
  50635. }
  50636. el.setAttribute(key, value);
  50637. }
  50638. }
  50639. var attrs = {
  50640. create: updateAttrs,
  50641. update: updateAttrs
  50642. };
  50643. /* */
  50644. function updateClass (oldVnode, vnode) {
  50645. var el = vnode.elm;
  50646. var data = vnode.data;
  50647. var oldData = oldVnode.data;
  50648. if (
  50649. isUndef(data.staticClass) &&
  50650. isUndef(data.class) && (
  50651. isUndef(oldData) || (
  50652. isUndef(oldData.staticClass) &&
  50653. isUndef(oldData.class)
  50654. )
  50655. )
  50656. ) {
  50657. return
  50658. }
  50659. var cls = genClassForVnode(vnode);
  50660. // handle transition classes
  50661. var transitionClass = el._transitionClasses;
  50662. if (isDef(transitionClass)) {
  50663. cls = concat(cls, stringifyClass(transitionClass));
  50664. }
  50665. // set the class
  50666. if (cls !== el._prevClass) {
  50667. el.setAttribute('class', cls);
  50668. el._prevClass = cls;
  50669. }
  50670. }
  50671. var klass = {
  50672. create: updateClass,
  50673. update: updateClass
  50674. };
  50675. /* */
  50676. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50677. function parseFilters (exp) {
  50678. var inSingle = false;
  50679. var inDouble = false;
  50680. var inTemplateString = false;
  50681. var inRegex = false;
  50682. var curly = 0;
  50683. var square = 0;
  50684. var paren = 0;
  50685. var lastFilterIndex = 0;
  50686. var c, prev, i, expression, filters;
  50687. for (i = 0; i < exp.length; i++) {
  50688. prev = c;
  50689. c = exp.charCodeAt(i);
  50690. if (inSingle) {
  50691. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50692. } else if (inDouble) {
  50693. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50694. } else if (inTemplateString) {
  50695. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50696. } else if (inRegex) {
  50697. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50698. } else if (
  50699. c === 0x7C && // pipe
  50700. exp.charCodeAt(i + 1) !== 0x7C &&
  50701. exp.charCodeAt(i - 1) !== 0x7C &&
  50702. !curly && !square && !paren
  50703. ) {
  50704. if (expression === undefined) {
  50705. // first filter, end of expression
  50706. lastFilterIndex = i + 1;
  50707. expression = exp.slice(0, i).trim();
  50708. } else {
  50709. pushFilter();
  50710. }
  50711. } else {
  50712. switch (c) {
  50713. case 0x22: inDouble = true; break // "
  50714. case 0x27: inSingle = true; break // '
  50715. case 0x60: inTemplateString = true; break // `
  50716. case 0x28: paren++; break // (
  50717. case 0x29: paren--; break // )
  50718. case 0x5B: square++; break // [
  50719. case 0x5D: square--; break // ]
  50720. case 0x7B: curly++; break // {
  50721. case 0x7D: curly--; break // }
  50722. }
  50723. if (c === 0x2f) { // /
  50724. var j = i - 1;
  50725. var p = (void 0);
  50726. // find first non-whitespace prev char
  50727. for (; j >= 0; j--) {
  50728. p = exp.charAt(j);
  50729. if (p !== ' ') { break }
  50730. }
  50731. if (!p || !validDivisionCharRE.test(p)) {
  50732. inRegex = true;
  50733. }
  50734. }
  50735. }
  50736. }
  50737. if (expression === undefined) {
  50738. expression = exp.slice(0, i).trim();
  50739. } else if (lastFilterIndex !== 0) {
  50740. pushFilter();
  50741. }
  50742. function pushFilter () {
  50743. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50744. lastFilterIndex = i + 1;
  50745. }
  50746. if (filters) {
  50747. for (i = 0; i < filters.length; i++) {
  50748. expression = wrapFilter(expression, filters[i]);
  50749. }
  50750. }
  50751. return expression
  50752. }
  50753. function wrapFilter (exp, filter) {
  50754. var i = filter.indexOf('(');
  50755. if (i < 0) {
  50756. // _f: resolveFilter
  50757. return ("_f(\"" + filter + "\")(" + exp + ")")
  50758. } else {
  50759. var name = filter.slice(0, i);
  50760. var args = filter.slice(i + 1);
  50761. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50762. }
  50763. }
  50764. /* */
  50765. /* eslint-disable no-unused-vars */
  50766. function baseWarn (msg, range) {
  50767. console.error(("[Vue compiler]: " + msg));
  50768. }
  50769. /* eslint-enable no-unused-vars */
  50770. function pluckModuleFunction (
  50771. modules,
  50772. key
  50773. ) {
  50774. return modules
  50775. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50776. : []
  50777. }
  50778. function addProp (el, name, value, range, dynamic) {
  50779. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50780. el.plain = false;
  50781. }
  50782. function addAttr (el, name, value, range, dynamic) {
  50783. var attrs = dynamic
  50784. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50785. : (el.attrs || (el.attrs = []));
  50786. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50787. el.plain = false;
  50788. }
  50789. // add a raw attr (use this in preTransforms)
  50790. function addRawAttr (el, name, value, range) {
  50791. el.attrsMap[name] = value;
  50792. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50793. }
  50794. function addDirective (
  50795. el,
  50796. name,
  50797. rawName,
  50798. value,
  50799. arg,
  50800. isDynamicArg,
  50801. modifiers,
  50802. range
  50803. ) {
  50804. (el.directives || (el.directives = [])).push(rangeSetItem({
  50805. name: name,
  50806. rawName: rawName,
  50807. value: value,
  50808. arg: arg,
  50809. isDynamicArg: isDynamicArg,
  50810. modifiers: modifiers
  50811. }, range));
  50812. el.plain = false;
  50813. }
  50814. function prependModifierMarker (symbol, name, dynamic) {
  50815. return dynamic
  50816. ? ("_p(" + name + ",\"" + symbol + "\")")
  50817. : symbol + name // mark the event as captured
  50818. }
  50819. function addHandler (
  50820. el,
  50821. name,
  50822. value,
  50823. modifiers,
  50824. important,
  50825. warn,
  50826. range,
  50827. dynamic
  50828. ) {
  50829. modifiers = modifiers || emptyObject;
  50830. // warn prevent and passive modifier
  50831. /* istanbul ignore if */
  50832. if (
  50833. warn &&
  50834. modifiers.prevent && modifiers.passive
  50835. ) {
  50836. warn(
  50837. 'passive and prevent can\'t be used together. ' +
  50838. 'Passive handler can\'t prevent default event.',
  50839. range
  50840. );
  50841. }
  50842. // normalize click.right and click.middle since they don't actually fire
  50843. // this is technically browser-specific, but at least for now browsers are
  50844. // the only target envs that have right/middle clicks.
  50845. if (modifiers.right) {
  50846. if (dynamic) {
  50847. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50848. } else if (name === 'click') {
  50849. name = 'contextmenu';
  50850. delete modifiers.right;
  50851. }
  50852. } else if (modifiers.middle) {
  50853. if (dynamic) {
  50854. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50855. } else if (name === 'click') {
  50856. name = 'mouseup';
  50857. }
  50858. }
  50859. // check capture modifier
  50860. if (modifiers.capture) {
  50861. delete modifiers.capture;
  50862. name = prependModifierMarker('!', name, dynamic);
  50863. }
  50864. if (modifiers.once) {
  50865. delete modifiers.once;
  50866. name = prependModifierMarker('~', name, dynamic);
  50867. }
  50868. /* istanbul ignore if */
  50869. if (modifiers.passive) {
  50870. delete modifiers.passive;
  50871. name = prependModifierMarker('&', name, dynamic);
  50872. }
  50873. var events;
  50874. if (modifiers.native) {
  50875. delete modifiers.native;
  50876. events = el.nativeEvents || (el.nativeEvents = {});
  50877. } else {
  50878. events = el.events || (el.events = {});
  50879. }
  50880. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50881. if (modifiers !== emptyObject) {
  50882. newHandler.modifiers = modifiers;
  50883. }
  50884. var handlers = events[name];
  50885. /* istanbul ignore if */
  50886. if (Array.isArray(handlers)) {
  50887. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50888. } else if (handlers) {
  50889. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50890. } else {
  50891. events[name] = newHandler;
  50892. }
  50893. el.plain = false;
  50894. }
  50895. function getRawBindingAttr (
  50896. el,
  50897. name
  50898. ) {
  50899. return el.rawAttrsMap[':' + name] ||
  50900. el.rawAttrsMap['v-bind:' + name] ||
  50901. el.rawAttrsMap[name]
  50902. }
  50903. function getBindingAttr (
  50904. el,
  50905. name,
  50906. getStatic
  50907. ) {
  50908. var dynamicValue =
  50909. getAndRemoveAttr(el, ':' + name) ||
  50910. getAndRemoveAttr(el, 'v-bind:' + name);
  50911. if (dynamicValue != null) {
  50912. return parseFilters(dynamicValue)
  50913. } else if (getStatic !== false) {
  50914. var staticValue = getAndRemoveAttr(el, name);
  50915. if (staticValue != null) {
  50916. return JSON.stringify(staticValue)
  50917. }
  50918. }
  50919. }
  50920. // note: this only removes the attr from the Array (attrsList) so that it
  50921. // doesn't get processed by processAttrs.
  50922. // By default it does NOT remove it from the map (attrsMap) because the map is
  50923. // needed during codegen.
  50924. function getAndRemoveAttr (
  50925. el,
  50926. name,
  50927. removeFromMap
  50928. ) {
  50929. var val;
  50930. if ((val = el.attrsMap[name]) != null) {
  50931. var list = el.attrsList;
  50932. for (var i = 0, l = list.length; i < l; i++) {
  50933. if (list[i].name === name) {
  50934. list.splice(i, 1);
  50935. break
  50936. }
  50937. }
  50938. }
  50939. if (removeFromMap) {
  50940. delete el.attrsMap[name];
  50941. }
  50942. return val
  50943. }
  50944. function getAndRemoveAttrByRegex (
  50945. el,
  50946. name
  50947. ) {
  50948. var list = el.attrsList;
  50949. for (var i = 0, l = list.length; i < l; i++) {
  50950. var attr = list[i];
  50951. if (name.test(attr.name)) {
  50952. list.splice(i, 1);
  50953. return attr
  50954. }
  50955. }
  50956. }
  50957. function rangeSetItem (
  50958. item,
  50959. range
  50960. ) {
  50961. if (range) {
  50962. if (range.start != null) {
  50963. item.start = range.start;
  50964. }
  50965. if (range.end != null) {
  50966. item.end = range.end;
  50967. }
  50968. }
  50969. return item
  50970. }
  50971. /* */
  50972. /**
  50973. * Cross-platform code generation for component v-model
  50974. */
  50975. function genComponentModel (
  50976. el,
  50977. value,
  50978. modifiers
  50979. ) {
  50980. var ref = modifiers || {};
  50981. var number = ref.number;
  50982. var trim = ref.trim;
  50983. var baseValueExpression = '$$v';
  50984. var valueExpression = baseValueExpression;
  50985. if (trim) {
  50986. valueExpression =
  50987. "(typeof " + baseValueExpression + " === 'string'" +
  50988. "? " + baseValueExpression + ".trim()" +
  50989. ": " + baseValueExpression + ")";
  50990. }
  50991. if (number) {
  50992. valueExpression = "_n(" + valueExpression + ")";
  50993. }
  50994. var assignment = genAssignmentCode(value, valueExpression);
  50995. el.model = {
  50996. value: ("(" + value + ")"),
  50997. expression: JSON.stringify(value),
  50998. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  50999. };
  51000. }
  51001. /**
  51002. * Cross-platform codegen helper for generating v-model value assignment code.
  51003. */
  51004. function genAssignmentCode (
  51005. value,
  51006. assignment
  51007. ) {
  51008. var res = parseModel(value);
  51009. if (res.key === null) {
  51010. return (value + "=" + assignment)
  51011. } else {
  51012. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51013. }
  51014. }
  51015. /**
  51016. * Parse a v-model expression into a base path and a final key segment.
  51017. * Handles both dot-path and possible square brackets.
  51018. *
  51019. * Possible cases:
  51020. *
  51021. * - test
  51022. * - test[key]
  51023. * - test[test1[key]]
  51024. * - test["a"][key]
  51025. * - xxx.test[a[a].test1[key]]
  51026. * - test.xxx.a["asa"][test1[key]]
  51027. *
  51028. */
  51029. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51030. function parseModel (val) {
  51031. // Fix https://github.com/vuejs/vue/pull/7730
  51032. // allow v-model="obj.val " (trailing whitespace)
  51033. val = val.trim();
  51034. len = val.length;
  51035. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51036. index$1 = val.lastIndexOf('.');
  51037. if (index$1 > -1) {
  51038. return {
  51039. exp: val.slice(0, index$1),
  51040. key: '"' + val.slice(index$1 + 1) + '"'
  51041. }
  51042. } else {
  51043. return {
  51044. exp: val,
  51045. key: null
  51046. }
  51047. }
  51048. }
  51049. str = val;
  51050. index$1 = expressionPos = expressionEndPos = 0;
  51051. while (!eof()) {
  51052. chr = next();
  51053. /* istanbul ignore if */
  51054. if (isStringStart(chr)) {
  51055. parseString(chr);
  51056. } else if (chr === 0x5B) {
  51057. parseBracket(chr);
  51058. }
  51059. }
  51060. return {
  51061. exp: val.slice(0, expressionPos),
  51062. key: val.slice(expressionPos + 1, expressionEndPos)
  51063. }
  51064. }
  51065. function next () {
  51066. return str.charCodeAt(++index$1)
  51067. }
  51068. function eof () {
  51069. return index$1 >= len
  51070. }
  51071. function isStringStart (chr) {
  51072. return chr === 0x22 || chr === 0x27
  51073. }
  51074. function parseBracket (chr) {
  51075. var inBracket = 1;
  51076. expressionPos = index$1;
  51077. while (!eof()) {
  51078. chr = next();
  51079. if (isStringStart(chr)) {
  51080. parseString(chr);
  51081. continue
  51082. }
  51083. if (chr === 0x5B) { inBracket++; }
  51084. if (chr === 0x5D) { inBracket--; }
  51085. if (inBracket === 0) {
  51086. expressionEndPos = index$1;
  51087. break
  51088. }
  51089. }
  51090. }
  51091. function parseString (chr) {
  51092. var stringQuote = chr;
  51093. while (!eof()) {
  51094. chr = next();
  51095. if (chr === stringQuote) {
  51096. break
  51097. }
  51098. }
  51099. }
  51100. /* */
  51101. var warn$1;
  51102. // in some cases, the event used has to be determined at runtime
  51103. // so we used some reserved tokens during compile.
  51104. var RANGE_TOKEN = '__r';
  51105. var CHECKBOX_RADIO_TOKEN = '__c';
  51106. function model (
  51107. el,
  51108. dir,
  51109. _warn
  51110. ) {
  51111. warn$1 = _warn;
  51112. var value = dir.value;
  51113. var modifiers = dir.modifiers;
  51114. var tag = el.tag;
  51115. var type = el.attrsMap.type;
  51116. {
  51117. // inputs with type="file" are read only and setting the input's
  51118. // value will throw an error.
  51119. if (tag === 'input' && type === 'file') {
  51120. warn$1(
  51121. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51122. "File inputs are read only. Use a v-on:change listener instead.",
  51123. el.rawAttrsMap['v-model']
  51124. );
  51125. }
  51126. }
  51127. if (el.component) {
  51128. genComponentModel(el, value, modifiers);
  51129. // component v-model doesn't need extra runtime
  51130. return false
  51131. } else if (tag === 'select') {
  51132. genSelect(el, value, modifiers);
  51133. } else if (tag === 'input' && type === 'checkbox') {
  51134. genCheckboxModel(el, value, modifiers);
  51135. } else if (tag === 'input' && type === 'radio') {
  51136. genRadioModel(el, value, modifiers);
  51137. } else if (tag === 'input' || tag === 'textarea') {
  51138. genDefaultModel(el, value, modifiers);
  51139. } else if (!config.isReservedTag(tag)) {
  51140. genComponentModel(el, value, modifiers);
  51141. // component v-model doesn't need extra runtime
  51142. return false
  51143. } else {
  51144. warn$1(
  51145. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51146. "v-model is not supported on this element type. " +
  51147. 'If you are working with contenteditable, it\'s recommended to ' +
  51148. 'wrap a library dedicated for that purpose inside a custom component.',
  51149. el.rawAttrsMap['v-model']
  51150. );
  51151. }
  51152. // ensure runtime directive metadata
  51153. return true
  51154. }
  51155. function genCheckboxModel (
  51156. el,
  51157. value,
  51158. modifiers
  51159. ) {
  51160. var number = modifiers && modifiers.number;
  51161. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51162. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51163. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51164. addProp(el, 'checked',
  51165. "Array.isArray(" + value + ")" +
  51166. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51167. trueValueBinding === 'true'
  51168. ? (":(" + value + ")")
  51169. : (":_q(" + value + "," + trueValueBinding + ")")
  51170. )
  51171. );
  51172. addHandler(el, 'change',
  51173. "var $$a=" + value + "," +
  51174. '$$el=$event.target,' +
  51175. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51176. 'if(Array.isArray($$a)){' +
  51177. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51178. '$$i=_i($$a,$$v);' +
  51179. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51180. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51181. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51182. null, true
  51183. );
  51184. }
  51185. function genRadioModel (
  51186. el,
  51187. value,
  51188. modifiers
  51189. ) {
  51190. var number = modifiers && modifiers.number;
  51191. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51192. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51193. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51194. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51195. }
  51196. function genSelect (
  51197. el,
  51198. value,
  51199. modifiers
  51200. ) {
  51201. var number = modifiers && modifiers.number;
  51202. var selectedVal = "Array.prototype.filter" +
  51203. ".call($event.target.options,function(o){return o.selected})" +
  51204. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51205. "return " + (number ? '_n(val)' : 'val') + "})";
  51206. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51207. var code = "var $$selectedVal = " + selectedVal + ";";
  51208. code = code + " " + (genAssignmentCode(value, assignment));
  51209. addHandler(el, 'change', code, null, true);
  51210. }
  51211. function genDefaultModel (
  51212. el,
  51213. value,
  51214. modifiers
  51215. ) {
  51216. var type = el.attrsMap.type;
  51217. // warn if v-bind:value conflicts with v-model
  51218. // except for inputs with v-bind:type
  51219. {
  51220. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51221. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51222. if (value$1 && !typeBinding) {
  51223. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51224. warn$1(
  51225. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51226. 'because the latter already expands to a value binding internally',
  51227. el.rawAttrsMap[binding]
  51228. );
  51229. }
  51230. }
  51231. var ref = modifiers || {};
  51232. var lazy = ref.lazy;
  51233. var number = ref.number;
  51234. var trim = ref.trim;
  51235. var needCompositionGuard = !lazy && type !== 'range';
  51236. var event = lazy
  51237. ? 'change'
  51238. : type === 'range'
  51239. ? RANGE_TOKEN
  51240. : 'input';
  51241. var valueExpression = '$event.target.value';
  51242. if (trim) {
  51243. valueExpression = "$event.target.value.trim()";
  51244. }
  51245. if (number) {
  51246. valueExpression = "_n(" + valueExpression + ")";
  51247. }
  51248. var code = genAssignmentCode(value, valueExpression);
  51249. if (needCompositionGuard) {
  51250. code = "if($event.target.composing)return;" + code;
  51251. }
  51252. addProp(el, 'value', ("(" + value + ")"));
  51253. addHandler(el, event, code, null, true);
  51254. if (trim || number) {
  51255. addHandler(el, 'blur', '$forceUpdate()');
  51256. }
  51257. }
  51258. /* */
  51259. // normalize v-model event tokens that can only be determined at runtime.
  51260. // it's important to place the event as the first in the array because
  51261. // the whole point is ensuring the v-model callback gets called before
  51262. // user-attached handlers.
  51263. function normalizeEvents (on) {
  51264. /* istanbul ignore if */
  51265. if (isDef(on[RANGE_TOKEN])) {
  51266. // IE input[type=range] only supports `change` event
  51267. var event = isIE ? 'change' : 'input';
  51268. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51269. delete on[RANGE_TOKEN];
  51270. }
  51271. // This was originally intended to fix #4521 but no longer necessary
  51272. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51273. /* istanbul ignore if */
  51274. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51275. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51276. delete on[CHECKBOX_RADIO_TOKEN];
  51277. }
  51278. }
  51279. var target$1;
  51280. function createOnceHandler$1 (event, handler, capture) {
  51281. var _target = target$1; // save current target element in closure
  51282. return function onceHandler () {
  51283. var res = handler.apply(null, arguments);
  51284. if (res !== null) {
  51285. remove$2(event, onceHandler, capture, _target);
  51286. }
  51287. }
  51288. }
  51289. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51290. // implementation and does not fire microtasks in between event propagation, so
  51291. // safe to exclude.
  51292. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51293. function add$1 (
  51294. name,
  51295. handler,
  51296. capture,
  51297. passive
  51298. ) {
  51299. // async edge case #6566: inner click event triggers patch, event handler
  51300. // attached to outer element during patch, and triggered again. This
  51301. // happens because browsers fire microtask ticks between event propagation.
  51302. // the solution is simple: we save the timestamp when a handler is attached,
  51303. // and the handler would only fire if the event passed to it was fired
  51304. // AFTER it was attached.
  51305. if (useMicrotaskFix) {
  51306. var attachedTimestamp = currentFlushTimestamp;
  51307. var original = handler;
  51308. handler = original._wrapper = function (e) {
  51309. if (
  51310. // no bubbling, should always fire.
  51311. // this is just a safety net in case event.timeStamp is unreliable in
  51312. // certain weird environments...
  51313. e.target === e.currentTarget ||
  51314. // event is fired after handler attachment
  51315. e.timeStamp >= attachedTimestamp ||
  51316. // bail for environments that have buggy event.timeStamp implementations
  51317. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51318. // #9681 QtWebEngine event.timeStamp is negative value
  51319. e.timeStamp <= 0 ||
  51320. // #9448 bail if event is fired in another document in a multi-page
  51321. // electron/nw.js app, since event.timeStamp will be using a different
  51322. // starting reference
  51323. e.target.ownerDocument !== document
  51324. ) {
  51325. return original.apply(this, arguments)
  51326. }
  51327. };
  51328. }
  51329. target$1.addEventListener(
  51330. name,
  51331. handler,
  51332. supportsPassive
  51333. ? { capture: capture, passive: passive }
  51334. : capture
  51335. );
  51336. }
  51337. function remove$2 (
  51338. name,
  51339. handler,
  51340. capture,
  51341. _target
  51342. ) {
  51343. (_target || target$1).removeEventListener(
  51344. name,
  51345. handler._wrapper || handler,
  51346. capture
  51347. );
  51348. }
  51349. function updateDOMListeners (oldVnode, vnode) {
  51350. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51351. return
  51352. }
  51353. var on = vnode.data.on || {};
  51354. var oldOn = oldVnode.data.on || {};
  51355. target$1 = vnode.elm;
  51356. normalizeEvents(on);
  51357. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51358. target$1 = undefined;
  51359. }
  51360. var events = {
  51361. create: updateDOMListeners,
  51362. update: updateDOMListeners
  51363. };
  51364. /* */
  51365. var svgContainer;
  51366. function updateDOMProps (oldVnode, vnode) {
  51367. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51368. return
  51369. }
  51370. var key, cur;
  51371. var elm = vnode.elm;
  51372. var oldProps = oldVnode.data.domProps || {};
  51373. var props = vnode.data.domProps || {};
  51374. // clone observed objects, as the user probably wants to mutate it
  51375. if (isDef(props.__ob__)) {
  51376. props = vnode.data.domProps = extend({}, props);
  51377. }
  51378. for (key in oldProps) {
  51379. if (!(key in props)) {
  51380. elm[key] = '';
  51381. }
  51382. }
  51383. for (key in props) {
  51384. cur = props[key];
  51385. // ignore children if the node has textContent or innerHTML,
  51386. // as these will throw away existing DOM nodes and cause removal errors
  51387. // on subsequent patches (#3360)
  51388. if (key === 'textContent' || key === 'innerHTML') {
  51389. if (vnode.children) { vnode.children.length = 0; }
  51390. if (cur === oldProps[key]) { continue }
  51391. // #6601 work around Chrome version <= 55 bug where single textNode
  51392. // replaced by innerHTML/textContent retains its parentNode property
  51393. if (elm.childNodes.length === 1) {
  51394. elm.removeChild(elm.childNodes[0]);
  51395. }
  51396. }
  51397. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51398. // store value as _value as well since
  51399. // non-string values will be stringified
  51400. elm._value = cur;
  51401. // avoid resetting cursor position when value is the same
  51402. var strCur = isUndef(cur) ? '' : String(cur);
  51403. if (shouldUpdateValue(elm, strCur)) {
  51404. elm.value = strCur;
  51405. }
  51406. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51407. // IE doesn't support innerHTML for SVG elements
  51408. svgContainer = svgContainer || document.createElement('div');
  51409. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51410. var svg = svgContainer.firstChild;
  51411. while (elm.firstChild) {
  51412. elm.removeChild(elm.firstChild);
  51413. }
  51414. while (svg.firstChild) {
  51415. elm.appendChild(svg.firstChild);
  51416. }
  51417. } else if (
  51418. // skip the update if old and new VDOM state is the same.
  51419. // `value` is handled separately because the DOM value may be temporarily
  51420. // out of sync with VDOM state due to focus, composition and modifiers.
  51421. // This #4521 by skipping the unnecesarry `checked` update.
  51422. cur !== oldProps[key]
  51423. ) {
  51424. // some property updates can throw
  51425. // e.g. `value` on <progress> w/ non-finite value
  51426. try {
  51427. elm[key] = cur;
  51428. } catch (e) {}
  51429. }
  51430. }
  51431. }
  51432. // check platforms/web/util/attrs.js acceptValue
  51433. function shouldUpdateValue (elm, checkVal) {
  51434. return (!elm.composing && (
  51435. elm.tagName === 'OPTION' ||
  51436. isNotInFocusAndDirty(elm, checkVal) ||
  51437. isDirtyWithModifiers(elm, checkVal)
  51438. ))
  51439. }
  51440. function isNotInFocusAndDirty (elm, checkVal) {
  51441. // return true when textbox (.number and .trim) loses focus and its value is
  51442. // not equal to the updated value
  51443. var notInFocus = true;
  51444. // #6157
  51445. // work around IE bug when accessing document.activeElement in an iframe
  51446. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51447. return notInFocus && elm.value !== checkVal
  51448. }
  51449. function isDirtyWithModifiers (elm, newVal) {
  51450. var value = elm.value;
  51451. var modifiers = elm._vModifiers; // injected by v-model runtime
  51452. if (isDef(modifiers)) {
  51453. if (modifiers.number) {
  51454. return toNumber(value) !== toNumber(newVal)
  51455. }
  51456. if (modifiers.trim) {
  51457. return value.trim() !== newVal.trim()
  51458. }
  51459. }
  51460. return value !== newVal
  51461. }
  51462. var domProps = {
  51463. create: updateDOMProps,
  51464. update: updateDOMProps
  51465. };
  51466. /* */
  51467. var parseStyleText = cached(function (cssText) {
  51468. var res = {};
  51469. var listDelimiter = /;(?![^(]*\))/g;
  51470. var propertyDelimiter = /:(.+)/;
  51471. cssText.split(listDelimiter).forEach(function (item) {
  51472. if (item) {
  51473. var tmp = item.split(propertyDelimiter);
  51474. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51475. }
  51476. });
  51477. return res
  51478. });
  51479. // merge static and dynamic style data on the same vnode
  51480. function normalizeStyleData (data) {
  51481. var style = normalizeStyleBinding(data.style);
  51482. // static style is pre-processed into an object during compilation
  51483. // and is always a fresh object, so it's safe to merge into it
  51484. return data.staticStyle
  51485. ? extend(data.staticStyle, style)
  51486. : style
  51487. }
  51488. // normalize possible array / string values into Object
  51489. function normalizeStyleBinding (bindingStyle) {
  51490. if (Array.isArray(bindingStyle)) {
  51491. return toObject(bindingStyle)
  51492. }
  51493. if (typeof bindingStyle === 'string') {
  51494. return parseStyleText(bindingStyle)
  51495. }
  51496. return bindingStyle
  51497. }
  51498. /**
  51499. * parent component style should be after child's
  51500. * so that parent component's style could override it
  51501. */
  51502. function getStyle (vnode, checkChild) {
  51503. var res = {};
  51504. var styleData;
  51505. if (checkChild) {
  51506. var childNode = vnode;
  51507. while (childNode.componentInstance) {
  51508. childNode = childNode.componentInstance._vnode;
  51509. if (
  51510. childNode && childNode.data &&
  51511. (styleData = normalizeStyleData(childNode.data))
  51512. ) {
  51513. extend(res, styleData);
  51514. }
  51515. }
  51516. }
  51517. if ((styleData = normalizeStyleData(vnode.data))) {
  51518. extend(res, styleData);
  51519. }
  51520. var parentNode = vnode;
  51521. while ((parentNode = parentNode.parent)) {
  51522. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51523. extend(res, styleData);
  51524. }
  51525. }
  51526. return res
  51527. }
  51528. /* */
  51529. var cssVarRE = /^--/;
  51530. var importantRE = /\s*!important$/;
  51531. var setProp = function (el, name, val) {
  51532. /* istanbul ignore if */
  51533. if (cssVarRE.test(name)) {
  51534. el.style.setProperty(name, val);
  51535. } else if (importantRE.test(val)) {
  51536. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51537. } else {
  51538. var normalizedName = normalize(name);
  51539. if (Array.isArray(val)) {
  51540. // Support values array created by autoprefixer, e.g.
  51541. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51542. // Set them one by one, and the browser will only set those it can recognize
  51543. for (var i = 0, len = val.length; i < len; i++) {
  51544. el.style[normalizedName] = val[i];
  51545. }
  51546. } else {
  51547. el.style[normalizedName] = val;
  51548. }
  51549. }
  51550. };
  51551. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51552. var emptyStyle;
  51553. var normalize = cached(function (prop) {
  51554. emptyStyle = emptyStyle || document.createElement('div').style;
  51555. prop = camelize(prop);
  51556. if (prop !== 'filter' && (prop in emptyStyle)) {
  51557. return prop
  51558. }
  51559. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51560. for (var i = 0; i < vendorNames.length; i++) {
  51561. var name = vendorNames[i] + capName;
  51562. if (name in emptyStyle) {
  51563. return name
  51564. }
  51565. }
  51566. });
  51567. function updateStyle (oldVnode, vnode) {
  51568. var data = vnode.data;
  51569. var oldData = oldVnode.data;
  51570. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51571. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51572. ) {
  51573. return
  51574. }
  51575. var cur, name;
  51576. var el = vnode.elm;
  51577. var oldStaticStyle = oldData.staticStyle;
  51578. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51579. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51580. var oldStyle = oldStaticStyle || oldStyleBinding;
  51581. var style = normalizeStyleBinding(vnode.data.style) || {};
  51582. // store normalized style under a different key for next diff
  51583. // make sure to clone it if it's reactive, since the user likely wants
  51584. // to mutate it.
  51585. vnode.data.normalizedStyle = isDef(style.__ob__)
  51586. ? extend({}, style)
  51587. : style;
  51588. var newStyle = getStyle(vnode, true);
  51589. for (name in oldStyle) {
  51590. if (isUndef(newStyle[name])) {
  51591. setProp(el, name, '');
  51592. }
  51593. }
  51594. for (name in newStyle) {
  51595. cur = newStyle[name];
  51596. if (cur !== oldStyle[name]) {
  51597. // ie9 setting to null has no effect, must use empty string
  51598. setProp(el, name, cur == null ? '' : cur);
  51599. }
  51600. }
  51601. }
  51602. var style = {
  51603. create: updateStyle,
  51604. update: updateStyle
  51605. };
  51606. /* */
  51607. var whitespaceRE = /\s+/;
  51608. /**
  51609. * Add class with compatibility for SVG since classList is not supported on
  51610. * SVG elements in IE
  51611. */
  51612. function addClass (el, cls) {
  51613. /* istanbul ignore if */
  51614. if (!cls || !(cls = cls.trim())) {
  51615. return
  51616. }
  51617. /* istanbul ignore else */
  51618. if (el.classList) {
  51619. if (cls.indexOf(' ') > -1) {
  51620. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51621. } else {
  51622. el.classList.add(cls);
  51623. }
  51624. } else {
  51625. var cur = " " + (el.getAttribute('class') || '') + " ";
  51626. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51627. el.setAttribute('class', (cur + cls).trim());
  51628. }
  51629. }
  51630. }
  51631. /**
  51632. * Remove class with compatibility for SVG since classList is not supported on
  51633. * SVG elements in IE
  51634. */
  51635. function removeClass (el, cls) {
  51636. /* istanbul ignore if */
  51637. if (!cls || !(cls = cls.trim())) {
  51638. return
  51639. }
  51640. /* istanbul ignore else */
  51641. if (el.classList) {
  51642. if (cls.indexOf(' ') > -1) {
  51643. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51644. } else {
  51645. el.classList.remove(cls);
  51646. }
  51647. if (!el.classList.length) {
  51648. el.removeAttribute('class');
  51649. }
  51650. } else {
  51651. var cur = " " + (el.getAttribute('class') || '') + " ";
  51652. var tar = ' ' + cls + ' ';
  51653. while (cur.indexOf(tar) >= 0) {
  51654. cur = cur.replace(tar, ' ');
  51655. }
  51656. cur = cur.trim();
  51657. if (cur) {
  51658. el.setAttribute('class', cur);
  51659. } else {
  51660. el.removeAttribute('class');
  51661. }
  51662. }
  51663. }
  51664. /* */
  51665. function resolveTransition (def$$1) {
  51666. if (!def$$1) {
  51667. return
  51668. }
  51669. /* istanbul ignore else */
  51670. if (typeof def$$1 === 'object') {
  51671. var res = {};
  51672. if (def$$1.css !== false) {
  51673. extend(res, autoCssTransition(def$$1.name || 'v'));
  51674. }
  51675. extend(res, def$$1);
  51676. return res
  51677. } else if (typeof def$$1 === 'string') {
  51678. return autoCssTransition(def$$1)
  51679. }
  51680. }
  51681. var autoCssTransition = cached(function (name) {
  51682. return {
  51683. enterClass: (name + "-enter"),
  51684. enterToClass: (name + "-enter-to"),
  51685. enterActiveClass: (name + "-enter-active"),
  51686. leaveClass: (name + "-leave"),
  51687. leaveToClass: (name + "-leave-to"),
  51688. leaveActiveClass: (name + "-leave-active")
  51689. }
  51690. });
  51691. var hasTransition = inBrowser && !isIE9;
  51692. var TRANSITION = 'transition';
  51693. var ANIMATION = 'animation';
  51694. // Transition property/event sniffing
  51695. var transitionProp = 'transition';
  51696. var transitionEndEvent = 'transitionend';
  51697. var animationProp = 'animation';
  51698. var animationEndEvent = 'animationend';
  51699. if (hasTransition) {
  51700. /* istanbul ignore if */
  51701. if (window.ontransitionend === undefined &&
  51702. window.onwebkittransitionend !== undefined
  51703. ) {
  51704. transitionProp = 'WebkitTransition';
  51705. transitionEndEvent = 'webkitTransitionEnd';
  51706. }
  51707. if (window.onanimationend === undefined &&
  51708. window.onwebkitanimationend !== undefined
  51709. ) {
  51710. animationProp = 'WebkitAnimation';
  51711. animationEndEvent = 'webkitAnimationEnd';
  51712. }
  51713. }
  51714. // binding to window is necessary to make hot reload work in IE in strict mode
  51715. var raf = inBrowser
  51716. ? window.requestAnimationFrame
  51717. ? window.requestAnimationFrame.bind(window)
  51718. : setTimeout
  51719. : /* istanbul ignore next */ function (fn) { return fn(); };
  51720. function nextFrame (fn) {
  51721. raf(function () {
  51722. raf(fn);
  51723. });
  51724. }
  51725. function addTransitionClass (el, cls) {
  51726. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51727. if (transitionClasses.indexOf(cls) < 0) {
  51728. transitionClasses.push(cls);
  51729. addClass(el, cls);
  51730. }
  51731. }
  51732. function removeTransitionClass (el, cls) {
  51733. if (el._transitionClasses) {
  51734. remove(el._transitionClasses, cls);
  51735. }
  51736. removeClass(el, cls);
  51737. }
  51738. function whenTransitionEnds (
  51739. el,
  51740. expectedType,
  51741. cb
  51742. ) {
  51743. var ref = getTransitionInfo(el, expectedType);
  51744. var type = ref.type;
  51745. var timeout = ref.timeout;
  51746. var propCount = ref.propCount;
  51747. if (!type) { return cb() }
  51748. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51749. var ended = 0;
  51750. var end = function () {
  51751. el.removeEventListener(event, onEnd);
  51752. cb();
  51753. };
  51754. var onEnd = function (e) {
  51755. if (e.target === el) {
  51756. if (++ended >= propCount) {
  51757. end();
  51758. }
  51759. }
  51760. };
  51761. setTimeout(function () {
  51762. if (ended < propCount) {
  51763. end();
  51764. }
  51765. }, timeout + 1);
  51766. el.addEventListener(event, onEnd);
  51767. }
  51768. var transformRE = /\b(transform|all)(,|$)/;
  51769. function getTransitionInfo (el, expectedType) {
  51770. var styles = window.getComputedStyle(el);
  51771. // JSDOM may return undefined for transition properties
  51772. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51773. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51774. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51775. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51776. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51777. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51778. var type;
  51779. var timeout = 0;
  51780. var propCount = 0;
  51781. /* istanbul ignore if */
  51782. if (expectedType === TRANSITION) {
  51783. if (transitionTimeout > 0) {
  51784. type = TRANSITION;
  51785. timeout = transitionTimeout;
  51786. propCount = transitionDurations.length;
  51787. }
  51788. } else if (expectedType === ANIMATION) {
  51789. if (animationTimeout > 0) {
  51790. type = ANIMATION;
  51791. timeout = animationTimeout;
  51792. propCount = animationDurations.length;
  51793. }
  51794. } else {
  51795. timeout = Math.max(transitionTimeout, animationTimeout);
  51796. type = timeout > 0
  51797. ? transitionTimeout > animationTimeout
  51798. ? TRANSITION
  51799. : ANIMATION
  51800. : null;
  51801. propCount = type
  51802. ? type === TRANSITION
  51803. ? transitionDurations.length
  51804. : animationDurations.length
  51805. : 0;
  51806. }
  51807. var hasTransform =
  51808. type === TRANSITION &&
  51809. transformRE.test(styles[transitionProp + 'Property']);
  51810. return {
  51811. type: type,
  51812. timeout: timeout,
  51813. propCount: propCount,
  51814. hasTransform: hasTransform
  51815. }
  51816. }
  51817. function getTimeout (delays, durations) {
  51818. /* istanbul ignore next */
  51819. while (delays.length < durations.length) {
  51820. delays = delays.concat(delays);
  51821. }
  51822. return Math.max.apply(null, durations.map(function (d, i) {
  51823. return toMs(d) + toMs(delays[i])
  51824. }))
  51825. }
  51826. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51827. // in a locale-dependent way, using a comma instead of a dot.
  51828. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51829. // as a floor function) causing unexpected behaviors
  51830. function toMs (s) {
  51831. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51832. }
  51833. /* */
  51834. function enter (vnode, toggleDisplay) {
  51835. var el = vnode.elm;
  51836. // call leave callback now
  51837. if (isDef(el._leaveCb)) {
  51838. el._leaveCb.cancelled = true;
  51839. el._leaveCb();
  51840. }
  51841. var data = resolveTransition(vnode.data.transition);
  51842. if (isUndef(data)) {
  51843. return
  51844. }
  51845. /* istanbul ignore if */
  51846. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51847. return
  51848. }
  51849. var css = data.css;
  51850. var type = data.type;
  51851. var enterClass = data.enterClass;
  51852. var enterToClass = data.enterToClass;
  51853. var enterActiveClass = data.enterActiveClass;
  51854. var appearClass = data.appearClass;
  51855. var appearToClass = data.appearToClass;
  51856. var appearActiveClass = data.appearActiveClass;
  51857. var beforeEnter = data.beforeEnter;
  51858. var enter = data.enter;
  51859. var afterEnter = data.afterEnter;
  51860. var enterCancelled = data.enterCancelled;
  51861. var beforeAppear = data.beforeAppear;
  51862. var appear = data.appear;
  51863. var afterAppear = data.afterAppear;
  51864. var appearCancelled = data.appearCancelled;
  51865. var duration = data.duration;
  51866. // activeInstance will always be the <transition> component managing this
  51867. // transition. One edge case to check is when the <transition> is placed
  51868. // as the root node of a child component. In that case we need to check
  51869. // <transition>'s parent for appear check.
  51870. var context = activeInstance;
  51871. var transitionNode = activeInstance.$vnode;
  51872. while (transitionNode && transitionNode.parent) {
  51873. context = transitionNode.context;
  51874. transitionNode = transitionNode.parent;
  51875. }
  51876. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51877. if (isAppear && !appear && appear !== '') {
  51878. return
  51879. }
  51880. var startClass = isAppear && appearClass
  51881. ? appearClass
  51882. : enterClass;
  51883. var activeClass = isAppear && appearActiveClass
  51884. ? appearActiveClass
  51885. : enterActiveClass;
  51886. var toClass = isAppear && appearToClass
  51887. ? appearToClass
  51888. : enterToClass;
  51889. var beforeEnterHook = isAppear
  51890. ? (beforeAppear || beforeEnter)
  51891. : beforeEnter;
  51892. var enterHook = isAppear
  51893. ? (typeof appear === 'function' ? appear : enter)
  51894. : enter;
  51895. var afterEnterHook = isAppear
  51896. ? (afterAppear || afterEnter)
  51897. : afterEnter;
  51898. var enterCancelledHook = isAppear
  51899. ? (appearCancelled || enterCancelled)
  51900. : enterCancelled;
  51901. var explicitEnterDuration = toNumber(
  51902. isObject(duration)
  51903. ? duration.enter
  51904. : duration
  51905. );
  51906. if (explicitEnterDuration != null) {
  51907. checkDuration(explicitEnterDuration, 'enter', vnode);
  51908. }
  51909. var expectsCSS = css !== false && !isIE9;
  51910. var userWantsControl = getHookArgumentsLength(enterHook);
  51911. var cb = el._enterCb = once(function () {
  51912. if (expectsCSS) {
  51913. removeTransitionClass(el, toClass);
  51914. removeTransitionClass(el, activeClass);
  51915. }
  51916. if (cb.cancelled) {
  51917. if (expectsCSS) {
  51918. removeTransitionClass(el, startClass);
  51919. }
  51920. enterCancelledHook && enterCancelledHook(el);
  51921. } else {
  51922. afterEnterHook && afterEnterHook(el);
  51923. }
  51924. el._enterCb = null;
  51925. });
  51926. if (!vnode.data.show) {
  51927. // remove pending leave element on enter by injecting an insert hook
  51928. mergeVNodeHook(vnode, 'insert', function () {
  51929. var parent = el.parentNode;
  51930. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51931. if (pendingNode &&
  51932. pendingNode.tag === vnode.tag &&
  51933. pendingNode.elm._leaveCb
  51934. ) {
  51935. pendingNode.elm._leaveCb();
  51936. }
  51937. enterHook && enterHook(el, cb);
  51938. });
  51939. }
  51940. // start enter transition
  51941. beforeEnterHook && beforeEnterHook(el);
  51942. if (expectsCSS) {
  51943. addTransitionClass(el, startClass);
  51944. addTransitionClass(el, activeClass);
  51945. nextFrame(function () {
  51946. removeTransitionClass(el, startClass);
  51947. if (!cb.cancelled) {
  51948. addTransitionClass(el, toClass);
  51949. if (!userWantsControl) {
  51950. if (isValidDuration(explicitEnterDuration)) {
  51951. setTimeout(cb, explicitEnterDuration);
  51952. } else {
  51953. whenTransitionEnds(el, type, cb);
  51954. }
  51955. }
  51956. }
  51957. });
  51958. }
  51959. if (vnode.data.show) {
  51960. toggleDisplay && toggleDisplay();
  51961. enterHook && enterHook(el, cb);
  51962. }
  51963. if (!expectsCSS && !userWantsControl) {
  51964. cb();
  51965. }
  51966. }
  51967. function leave (vnode, rm) {
  51968. var el = vnode.elm;
  51969. // call enter callback now
  51970. if (isDef(el._enterCb)) {
  51971. el._enterCb.cancelled = true;
  51972. el._enterCb();
  51973. }
  51974. var data = resolveTransition(vnode.data.transition);
  51975. if (isUndef(data) || el.nodeType !== 1) {
  51976. return rm()
  51977. }
  51978. /* istanbul ignore if */
  51979. if (isDef(el._leaveCb)) {
  51980. return
  51981. }
  51982. var css = data.css;
  51983. var type = data.type;
  51984. var leaveClass = data.leaveClass;
  51985. var leaveToClass = data.leaveToClass;
  51986. var leaveActiveClass = data.leaveActiveClass;
  51987. var beforeLeave = data.beforeLeave;
  51988. var leave = data.leave;
  51989. var afterLeave = data.afterLeave;
  51990. var leaveCancelled = data.leaveCancelled;
  51991. var delayLeave = data.delayLeave;
  51992. var duration = data.duration;
  51993. var expectsCSS = css !== false && !isIE9;
  51994. var userWantsControl = getHookArgumentsLength(leave);
  51995. var explicitLeaveDuration = toNumber(
  51996. isObject(duration)
  51997. ? duration.leave
  51998. : duration
  51999. );
  52000. if (isDef(explicitLeaveDuration)) {
  52001. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52002. }
  52003. var cb = el._leaveCb = once(function () {
  52004. if (el.parentNode && el.parentNode._pending) {
  52005. el.parentNode._pending[vnode.key] = null;
  52006. }
  52007. if (expectsCSS) {
  52008. removeTransitionClass(el, leaveToClass);
  52009. removeTransitionClass(el, leaveActiveClass);
  52010. }
  52011. if (cb.cancelled) {
  52012. if (expectsCSS) {
  52013. removeTransitionClass(el, leaveClass);
  52014. }
  52015. leaveCancelled && leaveCancelled(el);
  52016. } else {
  52017. rm();
  52018. afterLeave && afterLeave(el);
  52019. }
  52020. el._leaveCb = null;
  52021. });
  52022. if (delayLeave) {
  52023. delayLeave(performLeave);
  52024. } else {
  52025. performLeave();
  52026. }
  52027. function performLeave () {
  52028. // the delayed leave may have already been cancelled
  52029. if (cb.cancelled) {
  52030. return
  52031. }
  52032. // record leaving element
  52033. if (!vnode.data.show && el.parentNode) {
  52034. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52035. }
  52036. beforeLeave && beforeLeave(el);
  52037. if (expectsCSS) {
  52038. addTransitionClass(el, leaveClass);
  52039. addTransitionClass(el, leaveActiveClass);
  52040. nextFrame(function () {
  52041. removeTransitionClass(el, leaveClass);
  52042. if (!cb.cancelled) {
  52043. addTransitionClass(el, leaveToClass);
  52044. if (!userWantsControl) {
  52045. if (isValidDuration(explicitLeaveDuration)) {
  52046. setTimeout(cb, explicitLeaveDuration);
  52047. } else {
  52048. whenTransitionEnds(el, type, cb);
  52049. }
  52050. }
  52051. }
  52052. });
  52053. }
  52054. leave && leave(el, cb);
  52055. if (!expectsCSS && !userWantsControl) {
  52056. cb();
  52057. }
  52058. }
  52059. }
  52060. // only used in dev mode
  52061. function checkDuration (val, name, vnode) {
  52062. if (typeof val !== 'number') {
  52063. warn(
  52064. "<transition> explicit " + name + " duration is not a valid number - " +
  52065. "got " + (JSON.stringify(val)) + ".",
  52066. vnode.context
  52067. );
  52068. } else if (isNaN(val)) {
  52069. warn(
  52070. "<transition> explicit " + name + " duration is NaN - " +
  52071. 'the duration expression might be incorrect.',
  52072. vnode.context
  52073. );
  52074. }
  52075. }
  52076. function isValidDuration (val) {
  52077. return typeof val === 'number' && !isNaN(val)
  52078. }
  52079. /**
  52080. * Normalize a transition hook's argument length. The hook may be:
  52081. * - a merged hook (invoker) with the original in .fns
  52082. * - a wrapped component method (check ._length)
  52083. * - a plain function (.length)
  52084. */
  52085. function getHookArgumentsLength (fn) {
  52086. if (isUndef(fn)) {
  52087. return false
  52088. }
  52089. var invokerFns = fn.fns;
  52090. if (isDef(invokerFns)) {
  52091. // invoker
  52092. return getHookArgumentsLength(
  52093. Array.isArray(invokerFns)
  52094. ? invokerFns[0]
  52095. : invokerFns
  52096. )
  52097. } else {
  52098. return (fn._length || fn.length) > 1
  52099. }
  52100. }
  52101. function _enter (_, vnode) {
  52102. if (vnode.data.show !== true) {
  52103. enter(vnode);
  52104. }
  52105. }
  52106. var transition = inBrowser ? {
  52107. create: _enter,
  52108. activate: _enter,
  52109. remove: function remove$$1 (vnode, rm) {
  52110. /* istanbul ignore else */
  52111. if (vnode.data.show !== true) {
  52112. leave(vnode, rm);
  52113. } else {
  52114. rm();
  52115. }
  52116. }
  52117. } : {};
  52118. var platformModules = [
  52119. attrs,
  52120. klass,
  52121. events,
  52122. domProps,
  52123. style,
  52124. transition
  52125. ];
  52126. /* */
  52127. // the directive module should be applied last, after all
  52128. // built-in modules have been applied.
  52129. var modules = platformModules.concat(baseModules);
  52130. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52131. /**
  52132. * Not type checking this file because flow doesn't like attaching
  52133. * properties to Elements.
  52134. */
  52135. /* istanbul ignore if */
  52136. if (isIE9) {
  52137. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52138. document.addEventListener('selectionchange', function () {
  52139. var el = document.activeElement;
  52140. if (el && el.vmodel) {
  52141. trigger(el, 'input');
  52142. }
  52143. });
  52144. }
  52145. var directive = {
  52146. inserted: function inserted (el, binding, vnode, oldVnode) {
  52147. if (vnode.tag === 'select') {
  52148. // #6903
  52149. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52150. mergeVNodeHook(vnode, 'postpatch', function () {
  52151. directive.componentUpdated(el, binding, vnode);
  52152. });
  52153. } else {
  52154. setSelected(el, binding, vnode.context);
  52155. }
  52156. el._vOptions = [].map.call(el.options, getValue);
  52157. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52158. el._vModifiers = binding.modifiers;
  52159. if (!binding.modifiers.lazy) {
  52160. el.addEventListener('compositionstart', onCompositionStart);
  52161. el.addEventListener('compositionend', onCompositionEnd);
  52162. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52163. // switching focus before confirming composition choice
  52164. // this also fixes the issue where some browsers e.g. iOS Chrome
  52165. // fires "change" instead of "input" on autocomplete.
  52166. el.addEventListener('change', onCompositionEnd);
  52167. /* istanbul ignore if */
  52168. if (isIE9) {
  52169. el.vmodel = true;
  52170. }
  52171. }
  52172. }
  52173. },
  52174. componentUpdated: function componentUpdated (el, binding, vnode) {
  52175. if (vnode.tag === 'select') {
  52176. setSelected(el, binding, vnode.context);
  52177. // in case the options rendered by v-for have changed,
  52178. // it's possible that the value is out-of-sync with the rendered options.
  52179. // detect such cases and filter out values that no longer has a matching
  52180. // option in the DOM.
  52181. var prevOptions = el._vOptions;
  52182. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52183. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52184. // trigger change event if
  52185. // no matching option found for at least one value
  52186. var needReset = el.multiple
  52187. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52188. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52189. if (needReset) {
  52190. trigger(el, 'change');
  52191. }
  52192. }
  52193. }
  52194. }
  52195. };
  52196. function setSelected (el, binding, vm) {
  52197. actuallySetSelected(el, binding, vm);
  52198. /* istanbul ignore if */
  52199. if (isIE || isEdge) {
  52200. setTimeout(function () {
  52201. actuallySetSelected(el, binding, vm);
  52202. }, 0);
  52203. }
  52204. }
  52205. function actuallySetSelected (el, binding, vm) {
  52206. var value = binding.value;
  52207. var isMultiple = el.multiple;
  52208. if (isMultiple && !Array.isArray(value)) {
  52209. warn(
  52210. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52211. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52212. vm
  52213. );
  52214. return
  52215. }
  52216. var selected, option;
  52217. for (var i = 0, l = el.options.length; i < l; i++) {
  52218. option = el.options[i];
  52219. if (isMultiple) {
  52220. selected = looseIndexOf(value, getValue(option)) > -1;
  52221. if (option.selected !== selected) {
  52222. option.selected = selected;
  52223. }
  52224. } else {
  52225. if (looseEqual(getValue(option), value)) {
  52226. if (el.selectedIndex !== i) {
  52227. el.selectedIndex = i;
  52228. }
  52229. return
  52230. }
  52231. }
  52232. }
  52233. if (!isMultiple) {
  52234. el.selectedIndex = -1;
  52235. }
  52236. }
  52237. function hasNoMatchingOption (value, options) {
  52238. return options.every(function (o) { return !looseEqual(o, value); })
  52239. }
  52240. function getValue (option) {
  52241. return '_value' in option
  52242. ? option._value
  52243. : option.value
  52244. }
  52245. function onCompositionStart (e) {
  52246. e.target.composing = true;
  52247. }
  52248. function onCompositionEnd (e) {
  52249. // prevent triggering an input event for no reason
  52250. if (!e.target.composing) { return }
  52251. e.target.composing = false;
  52252. trigger(e.target, 'input');
  52253. }
  52254. function trigger (el, type) {
  52255. var e = document.createEvent('HTMLEvents');
  52256. e.initEvent(type, true, true);
  52257. el.dispatchEvent(e);
  52258. }
  52259. /* */
  52260. // recursively search for possible transition defined inside the component root
  52261. function locateNode (vnode) {
  52262. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52263. ? locateNode(vnode.componentInstance._vnode)
  52264. : vnode
  52265. }
  52266. var show = {
  52267. bind: function bind (el, ref, vnode) {
  52268. var value = ref.value;
  52269. vnode = locateNode(vnode);
  52270. var transition$$1 = vnode.data && vnode.data.transition;
  52271. var originalDisplay = el.__vOriginalDisplay =
  52272. el.style.display === 'none' ? '' : el.style.display;
  52273. if (value && transition$$1) {
  52274. vnode.data.show = true;
  52275. enter(vnode, function () {
  52276. el.style.display = originalDisplay;
  52277. });
  52278. } else {
  52279. el.style.display = value ? originalDisplay : 'none';
  52280. }
  52281. },
  52282. update: function update (el, ref, vnode) {
  52283. var value = ref.value;
  52284. var oldValue = ref.oldValue;
  52285. /* istanbul ignore if */
  52286. if (!value === !oldValue) { return }
  52287. vnode = locateNode(vnode);
  52288. var transition$$1 = vnode.data && vnode.data.transition;
  52289. if (transition$$1) {
  52290. vnode.data.show = true;
  52291. if (value) {
  52292. enter(vnode, function () {
  52293. el.style.display = el.__vOriginalDisplay;
  52294. });
  52295. } else {
  52296. leave(vnode, function () {
  52297. el.style.display = 'none';
  52298. });
  52299. }
  52300. } else {
  52301. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52302. }
  52303. },
  52304. unbind: function unbind (
  52305. el,
  52306. binding,
  52307. vnode,
  52308. oldVnode,
  52309. isDestroy
  52310. ) {
  52311. if (!isDestroy) {
  52312. el.style.display = el.__vOriginalDisplay;
  52313. }
  52314. }
  52315. };
  52316. var platformDirectives = {
  52317. model: directive,
  52318. show: show
  52319. };
  52320. /* */
  52321. var transitionProps = {
  52322. name: String,
  52323. appear: Boolean,
  52324. css: Boolean,
  52325. mode: String,
  52326. type: String,
  52327. enterClass: String,
  52328. leaveClass: String,
  52329. enterToClass: String,
  52330. leaveToClass: String,
  52331. enterActiveClass: String,
  52332. leaveActiveClass: String,
  52333. appearClass: String,
  52334. appearActiveClass: String,
  52335. appearToClass: String,
  52336. duration: [Number, String, Object]
  52337. };
  52338. // in case the child is also an abstract component, e.g. <keep-alive>
  52339. // we want to recursively retrieve the real component to be rendered
  52340. function getRealChild (vnode) {
  52341. var compOptions = vnode && vnode.componentOptions;
  52342. if (compOptions && compOptions.Ctor.options.abstract) {
  52343. return getRealChild(getFirstComponentChild(compOptions.children))
  52344. } else {
  52345. return vnode
  52346. }
  52347. }
  52348. function extractTransitionData (comp) {
  52349. var data = {};
  52350. var options = comp.$options;
  52351. // props
  52352. for (var key in options.propsData) {
  52353. data[key] = comp[key];
  52354. }
  52355. // events.
  52356. // extract listeners and pass them directly to the transition methods
  52357. var listeners = options._parentListeners;
  52358. for (var key$1 in listeners) {
  52359. data[camelize(key$1)] = listeners[key$1];
  52360. }
  52361. return data
  52362. }
  52363. function placeholder (h, rawChild) {
  52364. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52365. return h('keep-alive', {
  52366. props: rawChild.componentOptions.propsData
  52367. })
  52368. }
  52369. }
  52370. function hasParentTransition (vnode) {
  52371. while ((vnode = vnode.parent)) {
  52372. if (vnode.data.transition) {
  52373. return true
  52374. }
  52375. }
  52376. }
  52377. function isSameChild (child, oldChild) {
  52378. return oldChild.key === child.key && oldChild.tag === child.tag
  52379. }
  52380. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52381. var isVShowDirective = function (d) { return d.name === 'show'; };
  52382. var Transition = {
  52383. name: 'transition',
  52384. props: transitionProps,
  52385. abstract: true,
  52386. render: function render (h) {
  52387. var this$1 = this;
  52388. var children = this.$slots.default;
  52389. if (!children) {
  52390. return
  52391. }
  52392. // filter out text nodes (possible whitespaces)
  52393. children = children.filter(isNotTextNode);
  52394. /* istanbul ignore if */
  52395. if (!children.length) {
  52396. return
  52397. }
  52398. // warn multiple elements
  52399. if (children.length > 1) {
  52400. warn(
  52401. '<transition> can only be used on a single element. Use ' +
  52402. '<transition-group> for lists.',
  52403. this.$parent
  52404. );
  52405. }
  52406. var mode = this.mode;
  52407. // warn invalid mode
  52408. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52409. ) {
  52410. warn(
  52411. 'invalid <transition> mode: ' + mode,
  52412. this.$parent
  52413. );
  52414. }
  52415. var rawChild = children[0];
  52416. // if this is a component root node and the component's
  52417. // parent container node also has transition, skip.
  52418. if (hasParentTransition(this.$vnode)) {
  52419. return rawChild
  52420. }
  52421. // apply transition data to child
  52422. // use getRealChild() to ignore abstract components e.g. keep-alive
  52423. var child = getRealChild(rawChild);
  52424. /* istanbul ignore if */
  52425. if (!child) {
  52426. return rawChild
  52427. }
  52428. if (this._leaving) {
  52429. return placeholder(h, rawChild)
  52430. }
  52431. // ensure a key that is unique to the vnode type and to this transition
  52432. // component instance. This key will be used to remove pending leaving nodes
  52433. // during entering.
  52434. var id = "__transition-" + (this._uid) + "-";
  52435. child.key = child.key == null
  52436. ? child.isComment
  52437. ? id + 'comment'
  52438. : id + child.tag
  52439. : isPrimitive(child.key)
  52440. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52441. : child.key;
  52442. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52443. var oldRawChild = this._vnode;
  52444. var oldChild = getRealChild(oldRawChild);
  52445. // mark v-show
  52446. // so that the transition module can hand over the control to the directive
  52447. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52448. child.data.show = true;
  52449. }
  52450. if (
  52451. oldChild &&
  52452. oldChild.data &&
  52453. !isSameChild(child, oldChild) &&
  52454. !isAsyncPlaceholder(oldChild) &&
  52455. // #6687 component root is a comment node
  52456. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52457. ) {
  52458. // replace old child transition data with fresh one
  52459. // important for dynamic transitions!
  52460. var oldData = oldChild.data.transition = extend({}, data);
  52461. // handle transition mode
  52462. if (mode === 'out-in') {
  52463. // return placeholder node and queue update when leave finishes
  52464. this._leaving = true;
  52465. mergeVNodeHook(oldData, 'afterLeave', function () {
  52466. this$1._leaving = false;
  52467. this$1.$forceUpdate();
  52468. });
  52469. return placeholder(h, rawChild)
  52470. } else if (mode === 'in-out') {
  52471. if (isAsyncPlaceholder(child)) {
  52472. return oldRawChild
  52473. }
  52474. var delayedLeave;
  52475. var performLeave = function () { delayedLeave(); };
  52476. mergeVNodeHook(data, 'afterEnter', performLeave);
  52477. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52478. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52479. }
  52480. }
  52481. return rawChild
  52482. }
  52483. };
  52484. /* */
  52485. var props = extend({
  52486. tag: String,
  52487. moveClass: String
  52488. }, transitionProps);
  52489. delete props.mode;
  52490. var TransitionGroup = {
  52491. props: props,
  52492. beforeMount: function beforeMount () {
  52493. var this$1 = this;
  52494. var update = this._update;
  52495. this._update = function (vnode, hydrating) {
  52496. var restoreActiveInstance = setActiveInstance(this$1);
  52497. // force removing pass
  52498. this$1.__patch__(
  52499. this$1._vnode,
  52500. this$1.kept,
  52501. false, // hydrating
  52502. true // removeOnly (!important, avoids unnecessary moves)
  52503. );
  52504. this$1._vnode = this$1.kept;
  52505. restoreActiveInstance();
  52506. update.call(this$1, vnode, hydrating);
  52507. };
  52508. },
  52509. render: function render (h) {
  52510. var tag = this.tag || this.$vnode.data.tag || 'span';
  52511. var map = Object.create(null);
  52512. var prevChildren = this.prevChildren = this.children;
  52513. var rawChildren = this.$slots.default || [];
  52514. var children = this.children = [];
  52515. var transitionData = extractTransitionData(this);
  52516. for (var i = 0; i < rawChildren.length; i++) {
  52517. var c = rawChildren[i];
  52518. if (c.tag) {
  52519. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52520. children.push(c);
  52521. map[c.key] = c
  52522. ;(c.data || (c.data = {})).transition = transitionData;
  52523. } else {
  52524. var opts = c.componentOptions;
  52525. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52526. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52527. }
  52528. }
  52529. }
  52530. if (prevChildren) {
  52531. var kept = [];
  52532. var removed = [];
  52533. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52534. var c$1 = prevChildren[i$1];
  52535. c$1.data.transition = transitionData;
  52536. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52537. if (map[c$1.key]) {
  52538. kept.push(c$1);
  52539. } else {
  52540. removed.push(c$1);
  52541. }
  52542. }
  52543. this.kept = h(tag, null, kept);
  52544. this.removed = removed;
  52545. }
  52546. return h(tag, null, children)
  52547. },
  52548. updated: function updated () {
  52549. var children = this.prevChildren;
  52550. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52551. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52552. return
  52553. }
  52554. // we divide the work into three loops to avoid mixing DOM reads and writes
  52555. // in each iteration - which helps prevent layout thrashing.
  52556. children.forEach(callPendingCbs);
  52557. children.forEach(recordPosition);
  52558. children.forEach(applyTranslation);
  52559. // force reflow to put everything in position
  52560. // assign to this to avoid being removed in tree-shaking
  52561. // $flow-disable-line
  52562. this._reflow = document.body.offsetHeight;
  52563. children.forEach(function (c) {
  52564. if (c.data.moved) {
  52565. var el = c.elm;
  52566. var s = el.style;
  52567. addTransitionClass(el, moveClass);
  52568. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52569. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52570. if (e && e.target !== el) {
  52571. return
  52572. }
  52573. if (!e || /transform$/.test(e.propertyName)) {
  52574. el.removeEventListener(transitionEndEvent, cb);
  52575. el._moveCb = null;
  52576. removeTransitionClass(el, moveClass);
  52577. }
  52578. });
  52579. }
  52580. });
  52581. },
  52582. methods: {
  52583. hasMove: function hasMove (el, moveClass) {
  52584. /* istanbul ignore if */
  52585. if (!hasTransition) {
  52586. return false
  52587. }
  52588. /* istanbul ignore if */
  52589. if (this._hasMove) {
  52590. return this._hasMove
  52591. }
  52592. // Detect whether an element with the move class applied has
  52593. // CSS transitions. Since the element may be inside an entering
  52594. // transition at this very moment, we make a clone of it and remove
  52595. // all other transition classes applied to ensure only the move class
  52596. // is applied.
  52597. var clone = el.cloneNode();
  52598. if (el._transitionClasses) {
  52599. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52600. }
  52601. addClass(clone, moveClass);
  52602. clone.style.display = 'none';
  52603. this.$el.appendChild(clone);
  52604. var info = getTransitionInfo(clone);
  52605. this.$el.removeChild(clone);
  52606. return (this._hasMove = info.hasTransform)
  52607. }
  52608. }
  52609. };
  52610. function callPendingCbs (c) {
  52611. /* istanbul ignore if */
  52612. if (c.elm._moveCb) {
  52613. c.elm._moveCb();
  52614. }
  52615. /* istanbul ignore if */
  52616. if (c.elm._enterCb) {
  52617. c.elm._enterCb();
  52618. }
  52619. }
  52620. function recordPosition (c) {
  52621. c.data.newPos = c.elm.getBoundingClientRect();
  52622. }
  52623. function applyTranslation (c) {
  52624. var oldPos = c.data.pos;
  52625. var newPos = c.data.newPos;
  52626. var dx = oldPos.left - newPos.left;
  52627. var dy = oldPos.top - newPos.top;
  52628. if (dx || dy) {
  52629. c.data.moved = true;
  52630. var s = c.elm.style;
  52631. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52632. s.transitionDuration = '0s';
  52633. }
  52634. }
  52635. var platformComponents = {
  52636. Transition: Transition,
  52637. TransitionGroup: TransitionGroup
  52638. };
  52639. /* */
  52640. // install platform specific utils
  52641. Vue.config.mustUseProp = mustUseProp;
  52642. Vue.config.isReservedTag = isReservedTag;
  52643. Vue.config.isReservedAttr = isReservedAttr;
  52644. Vue.config.getTagNamespace = getTagNamespace;
  52645. Vue.config.isUnknownElement = isUnknownElement;
  52646. // install platform runtime directives & components
  52647. extend(Vue.options.directives, platformDirectives);
  52648. extend(Vue.options.components, platformComponents);
  52649. // install platform patch function
  52650. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52651. // public mount method
  52652. Vue.prototype.$mount = function (
  52653. el,
  52654. hydrating
  52655. ) {
  52656. el = el && inBrowser ? query(el) : undefined;
  52657. return mountComponent(this, el, hydrating)
  52658. };
  52659. // devtools global hook
  52660. /* istanbul ignore next */
  52661. if (inBrowser) {
  52662. setTimeout(function () {
  52663. if (config.devtools) {
  52664. if (devtools) {
  52665. devtools.emit('init', Vue);
  52666. } else {
  52667. console[console.info ? 'info' : 'log'](
  52668. 'Download the Vue Devtools extension for a better development experience:\n' +
  52669. 'https://github.com/vuejs/vue-devtools'
  52670. );
  52671. }
  52672. }
  52673. if (config.productionTip !== false &&
  52674. typeof console !== 'undefined'
  52675. ) {
  52676. console[console.info ? 'info' : 'log'](
  52677. "You are running Vue in development mode.\n" +
  52678. "Make sure to turn on production mode when deploying for production.\n" +
  52679. "See more tips at https://vuejs.org/guide/deployment.html"
  52680. );
  52681. }
  52682. }, 0);
  52683. }
  52684. /* */
  52685. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52686. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52687. var buildRegex = cached(function (delimiters) {
  52688. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52689. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52690. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52691. });
  52692. function parseText (
  52693. text,
  52694. delimiters
  52695. ) {
  52696. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52697. if (!tagRE.test(text)) {
  52698. return
  52699. }
  52700. var tokens = [];
  52701. var rawTokens = [];
  52702. var lastIndex = tagRE.lastIndex = 0;
  52703. var match, index, tokenValue;
  52704. while ((match = tagRE.exec(text))) {
  52705. index = match.index;
  52706. // push text token
  52707. if (index > lastIndex) {
  52708. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52709. tokens.push(JSON.stringify(tokenValue));
  52710. }
  52711. // tag token
  52712. var exp = parseFilters(match[1].trim());
  52713. tokens.push(("_s(" + exp + ")"));
  52714. rawTokens.push({ '@binding': exp });
  52715. lastIndex = index + match[0].length;
  52716. }
  52717. if (lastIndex < text.length) {
  52718. rawTokens.push(tokenValue = text.slice(lastIndex));
  52719. tokens.push(JSON.stringify(tokenValue));
  52720. }
  52721. return {
  52722. expression: tokens.join('+'),
  52723. tokens: rawTokens
  52724. }
  52725. }
  52726. /* */
  52727. function transformNode (el, options) {
  52728. var warn = options.warn || baseWarn;
  52729. var staticClass = getAndRemoveAttr(el, 'class');
  52730. if (staticClass) {
  52731. var res = parseText(staticClass, options.delimiters);
  52732. if (res) {
  52733. warn(
  52734. "class=\"" + staticClass + "\": " +
  52735. 'Interpolation inside attributes has been removed. ' +
  52736. 'Use v-bind or the colon shorthand instead. For example, ' +
  52737. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52738. el.rawAttrsMap['class']
  52739. );
  52740. }
  52741. }
  52742. if (staticClass) {
  52743. el.staticClass = JSON.stringify(staticClass);
  52744. }
  52745. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52746. if (classBinding) {
  52747. el.classBinding = classBinding;
  52748. }
  52749. }
  52750. function genData (el) {
  52751. var data = '';
  52752. if (el.staticClass) {
  52753. data += "staticClass:" + (el.staticClass) + ",";
  52754. }
  52755. if (el.classBinding) {
  52756. data += "class:" + (el.classBinding) + ",";
  52757. }
  52758. return data
  52759. }
  52760. var klass$1 = {
  52761. staticKeys: ['staticClass'],
  52762. transformNode: transformNode,
  52763. genData: genData
  52764. };
  52765. /* */
  52766. function transformNode$1 (el, options) {
  52767. var warn = options.warn || baseWarn;
  52768. var staticStyle = getAndRemoveAttr(el, 'style');
  52769. if (staticStyle) {
  52770. /* istanbul ignore if */
  52771. {
  52772. var res = parseText(staticStyle, options.delimiters);
  52773. if (res) {
  52774. warn(
  52775. "style=\"" + staticStyle + "\": " +
  52776. 'Interpolation inside attributes has been removed. ' +
  52777. 'Use v-bind or the colon shorthand instead. For example, ' +
  52778. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52779. el.rawAttrsMap['style']
  52780. );
  52781. }
  52782. }
  52783. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52784. }
  52785. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52786. if (styleBinding) {
  52787. el.styleBinding = styleBinding;
  52788. }
  52789. }
  52790. function genData$1 (el) {
  52791. var data = '';
  52792. if (el.staticStyle) {
  52793. data += "staticStyle:" + (el.staticStyle) + ",";
  52794. }
  52795. if (el.styleBinding) {
  52796. data += "style:(" + (el.styleBinding) + "),";
  52797. }
  52798. return data
  52799. }
  52800. var style$1 = {
  52801. staticKeys: ['staticStyle'],
  52802. transformNode: transformNode$1,
  52803. genData: genData$1
  52804. };
  52805. /* */
  52806. var decoder;
  52807. var he = {
  52808. decode: function decode (html) {
  52809. decoder = decoder || document.createElement('div');
  52810. decoder.innerHTML = html;
  52811. return decoder.textContent
  52812. }
  52813. };
  52814. /* */
  52815. var isUnaryTag = makeMap(
  52816. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52817. 'link,meta,param,source,track,wbr'
  52818. );
  52819. // Elements that you can, intentionally, leave open
  52820. // (and which close themselves)
  52821. var canBeLeftOpenTag = makeMap(
  52822. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52823. );
  52824. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52825. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52826. var isNonPhrasingTag = makeMap(
  52827. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52828. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52829. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52830. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52831. 'title,tr,track'
  52832. );
  52833. /**
  52834. * Not type-checking this file because it's mostly vendor code.
  52835. */
  52836. // Regular Expressions for parsing tags and attributes
  52837. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52838. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52839. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52840. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52841. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52842. var startTagClose = /^\s*(\/?)>/;
  52843. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52844. var doctype = /^<!DOCTYPE [^>]+>/i;
  52845. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52846. var comment = /^<!\--/;
  52847. var conditionalComment = /^<!\[/;
  52848. // Special Elements (can contain anything)
  52849. var isPlainTextElement = makeMap('script,style,textarea', true);
  52850. var reCache = {};
  52851. var decodingMap = {
  52852. '&lt;': '<',
  52853. '&gt;': '>',
  52854. '&quot;': '"',
  52855. '&amp;': '&',
  52856. '&#10;': '\n',
  52857. '&#9;': '\t',
  52858. '&#39;': "'"
  52859. };
  52860. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52861. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52862. // #5992
  52863. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52864. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52865. function decodeAttr (value, shouldDecodeNewlines) {
  52866. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52867. return value.replace(re, function (match) { return decodingMap[match]; })
  52868. }
  52869. function parseHTML (html, options) {
  52870. var stack = [];
  52871. var expectHTML = options.expectHTML;
  52872. var isUnaryTag$$1 = options.isUnaryTag || no;
  52873. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52874. var index = 0;
  52875. var last, lastTag;
  52876. while (html) {
  52877. last = html;
  52878. // Make sure we're not in a plaintext content element like script/style
  52879. if (!lastTag || !isPlainTextElement(lastTag)) {
  52880. var textEnd = html.indexOf('<');
  52881. if (textEnd === 0) {
  52882. // Comment:
  52883. if (comment.test(html)) {
  52884. var commentEnd = html.indexOf('-->');
  52885. if (commentEnd >= 0) {
  52886. if (options.shouldKeepComment) {
  52887. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52888. }
  52889. advance(commentEnd + 3);
  52890. continue
  52891. }
  52892. }
  52893. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52894. if (conditionalComment.test(html)) {
  52895. var conditionalEnd = html.indexOf(']>');
  52896. if (conditionalEnd >= 0) {
  52897. advance(conditionalEnd + 2);
  52898. continue
  52899. }
  52900. }
  52901. // Doctype:
  52902. var doctypeMatch = html.match(doctype);
  52903. if (doctypeMatch) {
  52904. advance(doctypeMatch[0].length);
  52905. continue
  52906. }
  52907. // End tag:
  52908. var endTagMatch = html.match(endTag);
  52909. if (endTagMatch) {
  52910. var curIndex = index;
  52911. advance(endTagMatch[0].length);
  52912. parseEndTag(endTagMatch[1], curIndex, index);
  52913. continue
  52914. }
  52915. // Start tag:
  52916. var startTagMatch = parseStartTag();
  52917. if (startTagMatch) {
  52918. handleStartTag(startTagMatch);
  52919. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52920. advance(1);
  52921. }
  52922. continue
  52923. }
  52924. }
  52925. var text = (void 0), rest = (void 0), next = (void 0);
  52926. if (textEnd >= 0) {
  52927. rest = html.slice(textEnd);
  52928. while (
  52929. !endTag.test(rest) &&
  52930. !startTagOpen.test(rest) &&
  52931. !comment.test(rest) &&
  52932. !conditionalComment.test(rest)
  52933. ) {
  52934. // < in plain text, be forgiving and treat it as text
  52935. next = rest.indexOf('<', 1);
  52936. if (next < 0) { break }
  52937. textEnd += next;
  52938. rest = html.slice(textEnd);
  52939. }
  52940. text = html.substring(0, textEnd);
  52941. }
  52942. if (textEnd < 0) {
  52943. text = html;
  52944. }
  52945. if (text) {
  52946. advance(text.length);
  52947. }
  52948. if (options.chars && text) {
  52949. options.chars(text, index - text.length, index);
  52950. }
  52951. } else {
  52952. var endTagLength = 0;
  52953. var stackedTag = lastTag.toLowerCase();
  52954. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52955. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52956. endTagLength = endTag.length;
  52957. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52958. text = text
  52959. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52960. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52961. }
  52962. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52963. text = text.slice(1);
  52964. }
  52965. if (options.chars) {
  52966. options.chars(text);
  52967. }
  52968. return ''
  52969. });
  52970. index += html.length - rest$1.length;
  52971. html = rest$1;
  52972. parseEndTag(stackedTag, index - endTagLength, index);
  52973. }
  52974. if (html === last) {
  52975. options.chars && options.chars(html);
  52976. if (!stack.length && options.warn) {
  52977. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52978. }
  52979. break
  52980. }
  52981. }
  52982. // Clean up any remaining tags
  52983. parseEndTag();
  52984. function advance (n) {
  52985. index += n;
  52986. html = html.substring(n);
  52987. }
  52988. function parseStartTag () {
  52989. var start = html.match(startTagOpen);
  52990. if (start) {
  52991. var match = {
  52992. tagName: start[1],
  52993. attrs: [],
  52994. start: index
  52995. };
  52996. advance(start[0].length);
  52997. var end, attr;
  52998. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  52999. attr.start = index;
  53000. advance(attr[0].length);
  53001. attr.end = index;
  53002. match.attrs.push(attr);
  53003. }
  53004. if (end) {
  53005. match.unarySlash = end[1];
  53006. advance(end[0].length);
  53007. match.end = index;
  53008. return match
  53009. }
  53010. }
  53011. }
  53012. function handleStartTag (match) {
  53013. var tagName = match.tagName;
  53014. var unarySlash = match.unarySlash;
  53015. if (expectHTML) {
  53016. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53017. parseEndTag(lastTag);
  53018. }
  53019. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53020. parseEndTag(tagName);
  53021. }
  53022. }
  53023. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53024. var l = match.attrs.length;
  53025. var attrs = new Array(l);
  53026. for (var i = 0; i < l; i++) {
  53027. var args = match.attrs[i];
  53028. var value = args[3] || args[4] || args[5] || '';
  53029. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53030. ? options.shouldDecodeNewlinesForHref
  53031. : options.shouldDecodeNewlines;
  53032. attrs[i] = {
  53033. name: args[1],
  53034. value: decodeAttr(value, shouldDecodeNewlines)
  53035. };
  53036. if (options.outputSourceRange) {
  53037. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53038. attrs[i].end = args.end;
  53039. }
  53040. }
  53041. if (!unary) {
  53042. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53043. lastTag = tagName;
  53044. }
  53045. if (options.start) {
  53046. options.start(tagName, attrs, unary, match.start, match.end);
  53047. }
  53048. }
  53049. function parseEndTag (tagName, start, end) {
  53050. var pos, lowerCasedTagName;
  53051. if (start == null) { start = index; }
  53052. if (end == null) { end = index; }
  53053. // Find the closest opened tag of the same type
  53054. if (tagName) {
  53055. lowerCasedTagName = tagName.toLowerCase();
  53056. for (pos = stack.length - 1; pos >= 0; pos--) {
  53057. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53058. break
  53059. }
  53060. }
  53061. } else {
  53062. // If no tag name is provided, clean shop
  53063. pos = 0;
  53064. }
  53065. if (pos >= 0) {
  53066. // Close all the open elements, up the stack
  53067. for (var i = stack.length - 1; i >= pos; i--) {
  53068. if (i > pos || !tagName &&
  53069. options.warn
  53070. ) {
  53071. options.warn(
  53072. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53073. { start: stack[i].start, end: stack[i].end }
  53074. );
  53075. }
  53076. if (options.end) {
  53077. options.end(stack[i].tag, start, end);
  53078. }
  53079. }
  53080. // Remove the open elements from the stack
  53081. stack.length = pos;
  53082. lastTag = pos && stack[pos - 1].tag;
  53083. } else if (lowerCasedTagName === 'br') {
  53084. if (options.start) {
  53085. options.start(tagName, [], true, start, end);
  53086. }
  53087. } else if (lowerCasedTagName === 'p') {
  53088. if (options.start) {
  53089. options.start(tagName, [], false, start, end);
  53090. }
  53091. if (options.end) {
  53092. options.end(tagName, start, end);
  53093. }
  53094. }
  53095. }
  53096. }
  53097. /* */
  53098. var onRE = /^@|^v-on:/;
  53099. var dirRE = /^v-|^@|^:|^#/;
  53100. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53101. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53102. var stripParensRE = /^\(|\)$/g;
  53103. var dynamicArgRE = /^\[.*\]$/;
  53104. var argRE = /:(.*)$/;
  53105. var bindRE = /^:|^\.|^v-bind:/;
  53106. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53107. var slotRE = /^v-slot(:|$)|^#/;
  53108. var lineBreakRE = /[\r\n]/;
  53109. var whitespaceRE$1 = /\s+/g;
  53110. var invalidAttributeRE = /[\s"'<>\/=]/;
  53111. var decodeHTMLCached = cached(he.decode);
  53112. var emptySlotScopeToken = "_empty_";
  53113. // configurable state
  53114. var warn$2;
  53115. var delimiters;
  53116. var transforms;
  53117. var preTransforms;
  53118. var postTransforms;
  53119. var platformIsPreTag;
  53120. var platformMustUseProp;
  53121. var platformGetTagNamespace;
  53122. var maybeComponent;
  53123. function createASTElement (
  53124. tag,
  53125. attrs,
  53126. parent
  53127. ) {
  53128. return {
  53129. type: 1,
  53130. tag: tag,
  53131. attrsList: attrs,
  53132. attrsMap: makeAttrsMap(attrs),
  53133. rawAttrsMap: {},
  53134. parent: parent,
  53135. children: []
  53136. }
  53137. }
  53138. /**
  53139. * Convert HTML string to AST.
  53140. */
  53141. function parse (
  53142. template,
  53143. options
  53144. ) {
  53145. warn$2 = options.warn || baseWarn;
  53146. platformIsPreTag = options.isPreTag || no;
  53147. platformMustUseProp = options.mustUseProp || no;
  53148. platformGetTagNamespace = options.getTagNamespace || no;
  53149. var isReservedTag = options.isReservedTag || no;
  53150. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53151. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53152. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53153. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53154. delimiters = options.delimiters;
  53155. var stack = [];
  53156. var preserveWhitespace = options.preserveWhitespace !== false;
  53157. var whitespaceOption = options.whitespace;
  53158. var root;
  53159. var currentParent;
  53160. var inVPre = false;
  53161. var inPre = false;
  53162. var warned = false;
  53163. function warnOnce (msg, range) {
  53164. if (!warned) {
  53165. warned = true;
  53166. warn$2(msg, range);
  53167. }
  53168. }
  53169. function closeElement (element) {
  53170. trimEndingWhitespace(element);
  53171. if (!inVPre && !element.processed) {
  53172. element = processElement(element, options);
  53173. }
  53174. // tree management
  53175. if (!stack.length && element !== root) {
  53176. // allow root elements with v-if, v-else-if and v-else
  53177. if (root.if && (element.elseif || element.else)) {
  53178. {
  53179. checkRootConstraints(element);
  53180. }
  53181. addIfCondition(root, {
  53182. exp: element.elseif,
  53183. block: element
  53184. });
  53185. } else {
  53186. warnOnce(
  53187. "Component template should contain exactly one root element. " +
  53188. "If you are using v-if on multiple elements, " +
  53189. "use v-else-if to chain them instead.",
  53190. { start: element.start }
  53191. );
  53192. }
  53193. }
  53194. if (currentParent && !element.forbidden) {
  53195. if (element.elseif || element.else) {
  53196. processIfConditions(element, currentParent);
  53197. } else {
  53198. if (element.slotScope) {
  53199. // scoped slot
  53200. // keep it in the children list so that v-else(-if) conditions can
  53201. // find it as the prev node.
  53202. var name = element.slotTarget || '"default"'
  53203. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53204. }
  53205. currentParent.children.push(element);
  53206. element.parent = currentParent;
  53207. }
  53208. }
  53209. // final children cleanup
  53210. // filter out scoped slots
  53211. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53212. // remove trailing whitespace node again
  53213. trimEndingWhitespace(element);
  53214. // check pre state
  53215. if (element.pre) {
  53216. inVPre = false;
  53217. }
  53218. if (platformIsPreTag(element.tag)) {
  53219. inPre = false;
  53220. }
  53221. // apply post-transforms
  53222. for (var i = 0; i < postTransforms.length; i++) {
  53223. postTransforms[i](element, options);
  53224. }
  53225. }
  53226. function trimEndingWhitespace (el) {
  53227. // remove trailing whitespace node
  53228. if (!inPre) {
  53229. var lastNode;
  53230. while (
  53231. (lastNode = el.children[el.children.length - 1]) &&
  53232. lastNode.type === 3 &&
  53233. lastNode.text === ' '
  53234. ) {
  53235. el.children.pop();
  53236. }
  53237. }
  53238. }
  53239. function checkRootConstraints (el) {
  53240. if (el.tag === 'slot' || el.tag === 'template') {
  53241. warnOnce(
  53242. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53243. 'contain multiple nodes.',
  53244. { start: el.start }
  53245. );
  53246. }
  53247. if (el.attrsMap.hasOwnProperty('v-for')) {
  53248. warnOnce(
  53249. 'Cannot use v-for on stateful component root element because ' +
  53250. 'it renders multiple elements.',
  53251. el.rawAttrsMap['v-for']
  53252. );
  53253. }
  53254. }
  53255. parseHTML(template, {
  53256. warn: warn$2,
  53257. expectHTML: options.expectHTML,
  53258. isUnaryTag: options.isUnaryTag,
  53259. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53260. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53261. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53262. shouldKeepComment: options.comments,
  53263. outputSourceRange: options.outputSourceRange,
  53264. start: function start (tag, attrs, unary, start$1, end) {
  53265. // check namespace.
  53266. // inherit parent ns if there is one
  53267. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53268. // handle IE svg bug
  53269. /* istanbul ignore if */
  53270. if (isIE && ns === 'svg') {
  53271. attrs = guardIESVGBug(attrs);
  53272. }
  53273. var element = createASTElement(tag, attrs, currentParent);
  53274. if (ns) {
  53275. element.ns = ns;
  53276. }
  53277. {
  53278. if (options.outputSourceRange) {
  53279. element.start = start$1;
  53280. element.end = end;
  53281. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53282. cumulated[attr.name] = attr;
  53283. return cumulated
  53284. }, {});
  53285. }
  53286. attrs.forEach(function (attr) {
  53287. if (invalidAttributeRE.test(attr.name)) {
  53288. warn$2(
  53289. "Invalid dynamic argument expression: attribute names cannot contain " +
  53290. "spaces, quotes, <, >, / or =.",
  53291. {
  53292. start: attr.start + attr.name.indexOf("["),
  53293. end: attr.start + attr.name.length
  53294. }
  53295. );
  53296. }
  53297. });
  53298. }
  53299. if (isForbiddenTag(element) && !isServerRendering()) {
  53300. element.forbidden = true;
  53301. warn$2(
  53302. 'Templates should only be responsible for mapping the state to the ' +
  53303. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53304. "<" + tag + ">" + ', as they will not be parsed.',
  53305. { start: element.start }
  53306. );
  53307. }
  53308. // apply pre-transforms
  53309. for (var i = 0; i < preTransforms.length; i++) {
  53310. element = preTransforms[i](element, options) || element;
  53311. }
  53312. if (!inVPre) {
  53313. processPre(element);
  53314. if (element.pre) {
  53315. inVPre = true;
  53316. }
  53317. }
  53318. if (platformIsPreTag(element.tag)) {
  53319. inPre = true;
  53320. }
  53321. if (inVPre) {
  53322. processRawAttrs(element);
  53323. } else if (!element.processed) {
  53324. // structural directives
  53325. processFor(element);
  53326. processIf(element);
  53327. processOnce(element);
  53328. }
  53329. if (!root) {
  53330. root = element;
  53331. {
  53332. checkRootConstraints(root);
  53333. }
  53334. }
  53335. if (!unary) {
  53336. currentParent = element;
  53337. stack.push(element);
  53338. } else {
  53339. closeElement(element);
  53340. }
  53341. },
  53342. end: function end (tag, start, end$1) {
  53343. var element = stack[stack.length - 1];
  53344. // pop stack
  53345. stack.length -= 1;
  53346. currentParent = stack[stack.length - 1];
  53347. if (options.outputSourceRange) {
  53348. element.end = end$1;
  53349. }
  53350. closeElement(element);
  53351. },
  53352. chars: function chars (text, start, end) {
  53353. if (!currentParent) {
  53354. {
  53355. if (text === template) {
  53356. warnOnce(
  53357. 'Component template requires a root element, rather than just text.',
  53358. { start: start }
  53359. );
  53360. } else if ((text = text.trim())) {
  53361. warnOnce(
  53362. ("text \"" + text + "\" outside root element will be ignored."),
  53363. { start: start }
  53364. );
  53365. }
  53366. }
  53367. return
  53368. }
  53369. // IE textarea placeholder bug
  53370. /* istanbul ignore if */
  53371. if (isIE &&
  53372. currentParent.tag === 'textarea' &&
  53373. currentParent.attrsMap.placeholder === text
  53374. ) {
  53375. return
  53376. }
  53377. var children = currentParent.children;
  53378. if (inPre || text.trim()) {
  53379. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53380. } else if (!children.length) {
  53381. // remove the whitespace-only node right after an opening tag
  53382. text = '';
  53383. } else if (whitespaceOption) {
  53384. if (whitespaceOption === 'condense') {
  53385. // in condense mode, remove the whitespace node if it contains
  53386. // line break, otherwise condense to a single space
  53387. text = lineBreakRE.test(text) ? '' : ' ';
  53388. } else {
  53389. text = ' ';
  53390. }
  53391. } else {
  53392. text = preserveWhitespace ? ' ' : '';
  53393. }
  53394. if (text) {
  53395. if (!inPre && whitespaceOption === 'condense') {
  53396. // condense consecutive whitespaces into single space
  53397. text = text.replace(whitespaceRE$1, ' ');
  53398. }
  53399. var res;
  53400. var child;
  53401. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53402. child = {
  53403. type: 2,
  53404. expression: res.expression,
  53405. tokens: res.tokens,
  53406. text: text
  53407. };
  53408. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53409. child = {
  53410. type: 3,
  53411. text: text
  53412. };
  53413. }
  53414. if (child) {
  53415. if (options.outputSourceRange) {
  53416. child.start = start;
  53417. child.end = end;
  53418. }
  53419. children.push(child);
  53420. }
  53421. }
  53422. },
  53423. comment: function comment (text, start, end) {
  53424. // adding anyting as a sibling to the root node is forbidden
  53425. // comments should still be allowed, but ignored
  53426. if (currentParent) {
  53427. var child = {
  53428. type: 3,
  53429. text: text,
  53430. isComment: true
  53431. };
  53432. if (options.outputSourceRange) {
  53433. child.start = start;
  53434. child.end = end;
  53435. }
  53436. currentParent.children.push(child);
  53437. }
  53438. }
  53439. });
  53440. return root
  53441. }
  53442. function processPre (el) {
  53443. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53444. el.pre = true;
  53445. }
  53446. }
  53447. function processRawAttrs (el) {
  53448. var list = el.attrsList;
  53449. var len = list.length;
  53450. if (len) {
  53451. var attrs = el.attrs = new Array(len);
  53452. for (var i = 0; i < len; i++) {
  53453. attrs[i] = {
  53454. name: list[i].name,
  53455. value: JSON.stringify(list[i].value)
  53456. };
  53457. if (list[i].start != null) {
  53458. attrs[i].start = list[i].start;
  53459. attrs[i].end = list[i].end;
  53460. }
  53461. }
  53462. } else if (!el.pre) {
  53463. // non root node in pre blocks with no attributes
  53464. el.plain = true;
  53465. }
  53466. }
  53467. function processElement (
  53468. element,
  53469. options
  53470. ) {
  53471. processKey(element);
  53472. // determine whether this is a plain element after
  53473. // removing structural attributes
  53474. element.plain = (
  53475. !element.key &&
  53476. !element.scopedSlots &&
  53477. !element.attrsList.length
  53478. );
  53479. processRef(element);
  53480. processSlotContent(element);
  53481. processSlotOutlet(element);
  53482. processComponent(element);
  53483. for (var i = 0; i < transforms.length; i++) {
  53484. element = transforms[i](element, options) || element;
  53485. }
  53486. processAttrs(element);
  53487. return element
  53488. }
  53489. function processKey (el) {
  53490. var exp = getBindingAttr(el, 'key');
  53491. if (exp) {
  53492. {
  53493. if (el.tag === 'template') {
  53494. warn$2(
  53495. "<template> cannot be keyed. Place the key on real elements instead.",
  53496. getRawBindingAttr(el, 'key')
  53497. );
  53498. }
  53499. if (el.for) {
  53500. var iterator = el.iterator2 || el.iterator1;
  53501. var parent = el.parent;
  53502. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53503. warn$2(
  53504. "Do not use v-for index as key on <transition-group> children, " +
  53505. "this is the same as not using keys.",
  53506. getRawBindingAttr(el, 'key'),
  53507. true /* tip */
  53508. );
  53509. }
  53510. }
  53511. }
  53512. el.key = exp;
  53513. }
  53514. }
  53515. function processRef (el) {
  53516. var ref = getBindingAttr(el, 'ref');
  53517. if (ref) {
  53518. el.ref = ref;
  53519. el.refInFor = checkInFor(el);
  53520. }
  53521. }
  53522. function processFor (el) {
  53523. var exp;
  53524. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53525. var res = parseFor(exp);
  53526. if (res) {
  53527. extend(el, res);
  53528. } else {
  53529. warn$2(
  53530. ("Invalid v-for expression: " + exp),
  53531. el.rawAttrsMap['v-for']
  53532. );
  53533. }
  53534. }
  53535. }
  53536. function parseFor (exp) {
  53537. var inMatch = exp.match(forAliasRE);
  53538. if (!inMatch) { return }
  53539. var res = {};
  53540. res.for = inMatch[2].trim();
  53541. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53542. var iteratorMatch = alias.match(forIteratorRE);
  53543. if (iteratorMatch) {
  53544. res.alias = alias.replace(forIteratorRE, '').trim();
  53545. res.iterator1 = iteratorMatch[1].trim();
  53546. if (iteratorMatch[2]) {
  53547. res.iterator2 = iteratorMatch[2].trim();
  53548. }
  53549. } else {
  53550. res.alias = alias;
  53551. }
  53552. return res
  53553. }
  53554. function processIf (el) {
  53555. var exp = getAndRemoveAttr(el, 'v-if');
  53556. if (exp) {
  53557. el.if = exp;
  53558. addIfCondition(el, {
  53559. exp: exp,
  53560. block: el
  53561. });
  53562. } else {
  53563. if (getAndRemoveAttr(el, 'v-else') != null) {
  53564. el.else = true;
  53565. }
  53566. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53567. if (elseif) {
  53568. el.elseif = elseif;
  53569. }
  53570. }
  53571. }
  53572. function processIfConditions (el, parent) {
  53573. var prev = findPrevElement(parent.children);
  53574. if (prev && prev.if) {
  53575. addIfCondition(prev, {
  53576. exp: el.elseif,
  53577. block: el
  53578. });
  53579. } else {
  53580. warn$2(
  53581. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53582. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53583. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53584. );
  53585. }
  53586. }
  53587. function findPrevElement (children) {
  53588. var i = children.length;
  53589. while (i--) {
  53590. if (children[i].type === 1) {
  53591. return children[i]
  53592. } else {
  53593. if (children[i].text !== ' ') {
  53594. warn$2(
  53595. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53596. "will be ignored.",
  53597. children[i]
  53598. );
  53599. }
  53600. children.pop();
  53601. }
  53602. }
  53603. }
  53604. function addIfCondition (el, condition) {
  53605. if (!el.ifConditions) {
  53606. el.ifConditions = [];
  53607. }
  53608. el.ifConditions.push(condition);
  53609. }
  53610. function processOnce (el) {
  53611. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53612. if (once$$1 != null) {
  53613. el.once = true;
  53614. }
  53615. }
  53616. // handle content being passed to a component as slot,
  53617. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53618. function processSlotContent (el) {
  53619. var slotScope;
  53620. if (el.tag === 'template') {
  53621. slotScope = getAndRemoveAttr(el, 'scope');
  53622. /* istanbul ignore if */
  53623. if (slotScope) {
  53624. warn$2(
  53625. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53626. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53627. "can also be used on plain elements in addition to <template> to " +
  53628. "denote scoped slots.",
  53629. el.rawAttrsMap['scope'],
  53630. true
  53631. );
  53632. }
  53633. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53634. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53635. /* istanbul ignore if */
  53636. if (el.attrsMap['v-for']) {
  53637. warn$2(
  53638. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53639. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53640. "scoped slot to make it clearer.",
  53641. el.rawAttrsMap['slot-scope'],
  53642. true
  53643. );
  53644. }
  53645. el.slotScope = slotScope;
  53646. }
  53647. // slot="xxx"
  53648. var slotTarget = getBindingAttr(el, 'slot');
  53649. if (slotTarget) {
  53650. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53651. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53652. // preserve slot as an attribute for native shadow DOM compat
  53653. // only for non-scoped slots.
  53654. if (el.tag !== 'template' && !el.slotScope) {
  53655. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53656. }
  53657. }
  53658. // 2.6 v-slot syntax
  53659. {
  53660. if (el.tag === 'template') {
  53661. // v-slot on <template>
  53662. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53663. if (slotBinding) {
  53664. {
  53665. if (el.slotTarget || el.slotScope) {
  53666. warn$2(
  53667. "Unexpected mixed usage of different slot syntaxes.",
  53668. el
  53669. );
  53670. }
  53671. if (el.parent && !maybeComponent(el.parent)) {
  53672. warn$2(
  53673. "<template v-slot> can only appear at the root level inside " +
  53674. "the receiving component",
  53675. el
  53676. );
  53677. }
  53678. }
  53679. var ref = getSlotName(slotBinding);
  53680. var name = ref.name;
  53681. var dynamic = ref.dynamic;
  53682. el.slotTarget = name;
  53683. el.slotTargetDynamic = dynamic;
  53684. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53685. }
  53686. } else {
  53687. // v-slot on component, denotes default slot
  53688. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53689. if (slotBinding$1) {
  53690. {
  53691. if (!maybeComponent(el)) {
  53692. warn$2(
  53693. "v-slot can only be used on components or <template>.",
  53694. slotBinding$1
  53695. );
  53696. }
  53697. if (el.slotScope || el.slotTarget) {
  53698. warn$2(
  53699. "Unexpected mixed usage of different slot syntaxes.",
  53700. el
  53701. );
  53702. }
  53703. if (el.scopedSlots) {
  53704. warn$2(
  53705. "To avoid scope ambiguity, the default slot should also use " +
  53706. "<template> syntax when there are other named slots.",
  53707. slotBinding$1
  53708. );
  53709. }
  53710. }
  53711. // add the component's children to its default slot
  53712. var slots = el.scopedSlots || (el.scopedSlots = {});
  53713. var ref$1 = getSlotName(slotBinding$1);
  53714. var name$1 = ref$1.name;
  53715. var dynamic$1 = ref$1.dynamic;
  53716. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53717. slotContainer.slotTarget = name$1;
  53718. slotContainer.slotTargetDynamic = dynamic$1;
  53719. slotContainer.children = el.children.filter(function (c) {
  53720. if (!c.slotScope) {
  53721. c.parent = slotContainer;
  53722. return true
  53723. }
  53724. });
  53725. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53726. // remove children as they are returned from scopedSlots now
  53727. el.children = [];
  53728. // mark el non-plain so data gets generated
  53729. el.plain = false;
  53730. }
  53731. }
  53732. }
  53733. }
  53734. function getSlotName (binding) {
  53735. var name = binding.name.replace(slotRE, '');
  53736. if (!name) {
  53737. if (binding.name[0] !== '#') {
  53738. name = 'default';
  53739. } else {
  53740. warn$2(
  53741. "v-slot shorthand syntax requires a slot name.",
  53742. binding
  53743. );
  53744. }
  53745. }
  53746. return dynamicArgRE.test(name)
  53747. // dynamic [name]
  53748. ? { name: name.slice(1, -1), dynamic: true }
  53749. // static name
  53750. : { name: ("\"" + name + "\""), dynamic: false }
  53751. }
  53752. // handle <slot/> outlets
  53753. function processSlotOutlet (el) {
  53754. if (el.tag === 'slot') {
  53755. el.slotName = getBindingAttr(el, 'name');
  53756. if (el.key) {
  53757. warn$2(
  53758. "`key` does not work on <slot> because slots are abstract outlets " +
  53759. "and can possibly expand into multiple elements. " +
  53760. "Use the key on a wrapping element instead.",
  53761. getRawBindingAttr(el, 'key')
  53762. );
  53763. }
  53764. }
  53765. }
  53766. function processComponent (el) {
  53767. var binding;
  53768. if ((binding = getBindingAttr(el, 'is'))) {
  53769. el.component = binding;
  53770. }
  53771. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53772. el.inlineTemplate = true;
  53773. }
  53774. }
  53775. function processAttrs (el) {
  53776. var list = el.attrsList;
  53777. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53778. for (i = 0, l = list.length; i < l; i++) {
  53779. name = rawName = list[i].name;
  53780. value = list[i].value;
  53781. if (dirRE.test(name)) {
  53782. // mark element as dynamic
  53783. el.hasBindings = true;
  53784. // modifiers
  53785. modifiers = parseModifiers(name.replace(dirRE, ''));
  53786. // support .foo shorthand syntax for the .prop modifier
  53787. if (modifiers) {
  53788. name = name.replace(modifierRE, '');
  53789. }
  53790. if (bindRE.test(name)) { // v-bind
  53791. name = name.replace(bindRE, '');
  53792. value = parseFilters(value);
  53793. isDynamic = dynamicArgRE.test(name);
  53794. if (isDynamic) {
  53795. name = name.slice(1, -1);
  53796. }
  53797. if (
  53798. value.trim().length === 0
  53799. ) {
  53800. warn$2(
  53801. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53802. );
  53803. }
  53804. if (modifiers) {
  53805. if (modifiers.prop && !isDynamic) {
  53806. name = camelize(name);
  53807. if (name === 'innerHtml') { name = 'innerHTML'; }
  53808. }
  53809. if (modifiers.camel && !isDynamic) {
  53810. name = camelize(name);
  53811. }
  53812. if (modifiers.sync) {
  53813. syncGen = genAssignmentCode(value, "$event");
  53814. if (!isDynamic) {
  53815. addHandler(
  53816. el,
  53817. ("update:" + (camelize(name))),
  53818. syncGen,
  53819. null,
  53820. false,
  53821. warn$2,
  53822. list[i]
  53823. );
  53824. if (hyphenate(name) !== camelize(name)) {
  53825. addHandler(
  53826. el,
  53827. ("update:" + (hyphenate(name))),
  53828. syncGen,
  53829. null,
  53830. false,
  53831. warn$2,
  53832. list[i]
  53833. );
  53834. }
  53835. } else {
  53836. // handler w/ dynamic event name
  53837. addHandler(
  53838. el,
  53839. ("\"update:\"+(" + name + ")"),
  53840. syncGen,
  53841. null,
  53842. false,
  53843. warn$2,
  53844. list[i],
  53845. true // dynamic
  53846. );
  53847. }
  53848. }
  53849. }
  53850. if ((modifiers && modifiers.prop) || (
  53851. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53852. )) {
  53853. addProp(el, name, value, list[i], isDynamic);
  53854. } else {
  53855. addAttr(el, name, value, list[i], isDynamic);
  53856. }
  53857. } else if (onRE.test(name)) { // v-on
  53858. name = name.replace(onRE, '');
  53859. isDynamic = dynamicArgRE.test(name);
  53860. if (isDynamic) {
  53861. name = name.slice(1, -1);
  53862. }
  53863. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53864. } else { // normal directives
  53865. name = name.replace(dirRE, '');
  53866. // parse arg
  53867. var argMatch = name.match(argRE);
  53868. var arg = argMatch && argMatch[1];
  53869. isDynamic = false;
  53870. if (arg) {
  53871. name = name.slice(0, -(arg.length + 1));
  53872. if (dynamicArgRE.test(arg)) {
  53873. arg = arg.slice(1, -1);
  53874. isDynamic = true;
  53875. }
  53876. }
  53877. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53878. if (name === 'model') {
  53879. checkForAliasModel(el, value);
  53880. }
  53881. }
  53882. } else {
  53883. // literal attribute
  53884. {
  53885. var res = parseText(value, delimiters);
  53886. if (res) {
  53887. warn$2(
  53888. name + "=\"" + value + "\": " +
  53889. 'Interpolation inside attributes has been removed. ' +
  53890. 'Use v-bind or the colon shorthand instead. For example, ' +
  53891. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53892. list[i]
  53893. );
  53894. }
  53895. }
  53896. addAttr(el, name, JSON.stringify(value), list[i]);
  53897. // #6887 firefox doesn't update muted state if set via attribute
  53898. // even immediately after element creation
  53899. if (!el.component &&
  53900. name === 'muted' &&
  53901. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53902. addProp(el, name, 'true', list[i]);
  53903. }
  53904. }
  53905. }
  53906. }
  53907. function checkInFor (el) {
  53908. var parent = el;
  53909. while (parent) {
  53910. if (parent.for !== undefined) {
  53911. return true
  53912. }
  53913. parent = parent.parent;
  53914. }
  53915. return false
  53916. }
  53917. function parseModifiers (name) {
  53918. var match = name.match(modifierRE);
  53919. if (match) {
  53920. var ret = {};
  53921. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53922. return ret
  53923. }
  53924. }
  53925. function makeAttrsMap (attrs) {
  53926. var map = {};
  53927. for (var i = 0, l = attrs.length; i < l; i++) {
  53928. if (
  53929. map[attrs[i].name] && !isIE && !isEdge
  53930. ) {
  53931. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53932. }
  53933. map[attrs[i].name] = attrs[i].value;
  53934. }
  53935. return map
  53936. }
  53937. // for script (e.g. type="x/template") or style, do not decode content
  53938. function isTextTag (el) {
  53939. return el.tag === 'script' || el.tag === 'style'
  53940. }
  53941. function isForbiddenTag (el) {
  53942. return (
  53943. el.tag === 'style' ||
  53944. (el.tag === 'script' && (
  53945. !el.attrsMap.type ||
  53946. el.attrsMap.type === 'text/javascript'
  53947. ))
  53948. )
  53949. }
  53950. var ieNSBug = /^xmlns:NS\d+/;
  53951. var ieNSPrefix = /^NS\d+:/;
  53952. /* istanbul ignore next */
  53953. function guardIESVGBug (attrs) {
  53954. var res = [];
  53955. for (var i = 0; i < attrs.length; i++) {
  53956. var attr = attrs[i];
  53957. if (!ieNSBug.test(attr.name)) {
  53958. attr.name = attr.name.replace(ieNSPrefix, '');
  53959. res.push(attr);
  53960. }
  53961. }
  53962. return res
  53963. }
  53964. function checkForAliasModel (el, value) {
  53965. var _el = el;
  53966. while (_el) {
  53967. if (_el.for && _el.alias === value) {
  53968. warn$2(
  53969. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53970. "You are binding v-model directly to a v-for iteration alias. " +
  53971. "This will not be able to modify the v-for source array because " +
  53972. "writing to the alias is like modifying a function local variable. " +
  53973. "Consider using an array of objects and use v-model on an object property instead.",
  53974. el.rawAttrsMap['v-model']
  53975. );
  53976. }
  53977. _el = _el.parent;
  53978. }
  53979. }
  53980. /* */
  53981. function preTransformNode (el, options) {
  53982. if (el.tag === 'input') {
  53983. var map = el.attrsMap;
  53984. if (!map['v-model']) {
  53985. return
  53986. }
  53987. var typeBinding;
  53988. if (map[':type'] || map['v-bind:type']) {
  53989. typeBinding = getBindingAttr(el, 'type');
  53990. }
  53991. if (!map.type && !typeBinding && map['v-bind']) {
  53992. typeBinding = "(" + (map['v-bind']) + ").type";
  53993. }
  53994. if (typeBinding) {
  53995. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  53996. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  53997. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  53998. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  53999. // 1. checkbox
  54000. var branch0 = cloneASTElement(el);
  54001. // process for on the main node
  54002. processFor(branch0);
  54003. addRawAttr(branch0, 'type', 'checkbox');
  54004. processElement(branch0, options);
  54005. branch0.processed = true; // prevent it from double-processed
  54006. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54007. addIfCondition(branch0, {
  54008. exp: branch0.if,
  54009. block: branch0
  54010. });
  54011. // 2. add radio else-if condition
  54012. var branch1 = cloneASTElement(el);
  54013. getAndRemoveAttr(branch1, 'v-for', true);
  54014. addRawAttr(branch1, 'type', 'radio');
  54015. processElement(branch1, options);
  54016. addIfCondition(branch0, {
  54017. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54018. block: branch1
  54019. });
  54020. // 3. other
  54021. var branch2 = cloneASTElement(el);
  54022. getAndRemoveAttr(branch2, 'v-for', true);
  54023. addRawAttr(branch2, ':type', typeBinding);
  54024. processElement(branch2, options);
  54025. addIfCondition(branch0, {
  54026. exp: ifCondition,
  54027. block: branch2
  54028. });
  54029. if (hasElse) {
  54030. branch0.else = true;
  54031. } else if (elseIfCondition) {
  54032. branch0.elseif = elseIfCondition;
  54033. }
  54034. return branch0
  54035. }
  54036. }
  54037. }
  54038. function cloneASTElement (el) {
  54039. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54040. }
  54041. var model$1 = {
  54042. preTransformNode: preTransformNode
  54043. };
  54044. var modules$1 = [
  54045. klass$1,
  54046. style$1,
  54047. model$1
  54048. ];
  54049. /* */
  54050. function text (el, dir) {
  54051. if (dir.value) {
  54052. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54053. }
  54054. }
  54055. /* */
  54056. function html (el, dir) {
  54057. if (dir.value) {
  54058. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54059. }
  54060. }
  54061. var directives$1 = {
  54062. model: model,
  54063. text: text,
  54064. html: html
  54065. };
  54066. /* */
  54067. var baseOptions = {
  54068. expectHTML: true,
  54069. modules: modules$1,
  54070. directives: directives$1,
  54071. isPreTag: isPreTag,
  54072. isUnaryTag: isUnaryTag,
  54073. mustUseProp: mustUseProp,
  54074. canBeLeftOpenTag: canBeLeftOpenTag,
  54075. isReservedTag: isReservedTag,
  54076. getTagNamespace: getTagNamespace,
  54077. staticKeys: genStaticKeys(modules$1)
  54078. };
  54079. /* */
  54080. var isStaticKey;
  54081. var isPlatformReservedTag;
  54082. var genStaticKeysCached = cached(genStaticKeys$1);
  54083. /**
  54084. * Goal of the optimizer: walk the generated template AST tree
  54085. * and detect sub-trees that are purely static, i.e. parts of
  54086. * the DOM that never needs to change.
  54087. *
  54088. * Once we detect these sub-trees, we can:
  54089. *
  54090. * 1. Hoist them into constants, so that we no longer need to
  54091. * create fresh nodes for them on each re-render;
  54092. * 2. Completely skip them in the patching process.
  54093. */
  54094. function optimize (root, options) {
  54095. if (!root) { return }
  54096. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54097. isPlatformReservedTag = options.isReservedTag || no;
  54098. // first pass: mark all non-static nodes.
  54099. markStatic$1(root);
  54100. // second pass: mark static roots.
  54101. markStaticRoots(root, false);
  54102. }
  54103. function genStaticKeys$1 (keys) {
  54104. return makeMap(
  54105. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54106. (keys ? ',' + keys : '')
  54107. )
  54108. }
  54109. function markStatic$1 (node) {
  54110. node.static = isStatic(node);
  54111. if (node.type === 1) {
  54112. // do not make component slot content static. this avoids
  54113. // 1. components not able to mutate slot nodes
  54114. // 2. static slot content fails for hot-reloading
  54115. if (
  54116. !isPlatformReservedTag(node.tag) &&
  54117. node.tag !== 'slot' &&
  54118. node.attrsMap['inline-template'] == null
  54119. ) {
  54120. return
  54121. }
  54122. for (var i = 0, l = node.children.length; i < l; i++) {
  54123. var child = node.children[i];
  54124. markStatic$1(child);
  54125. if (!child.static) {
  54126. node.static = false;
  54127. }
  54128. }
  54129. if (node.ifConditions) {
  54130. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54131. var block = node.ifConditions[i$1].block;
  54132. markStatic$1(block);
  54133. if (!block.static) {
  54134. node.static = false;
  54135. }
  54136. }
  54137. }
  54138. }
  54139. }
  54140. function markStaticRoots (node, isInFor) {
  54141. if (node.type === 1) {
  54142. if (node.static || node.once) {
  54143. node.staticInFor = isInFor;
  54144. }
  54145. // For a node to qualify as a static root, it should have children that
  54146. // are not just static text. Otherwise the cost of hoisting out will
  54147. // outweigh the benefits and it's better off to just always render it fresh.
  54148. if (node.static && node.children.length && !(
  54149. node.children.length === 1 &&
  54150. node.children[0].type === 3
  54151. )) {
  54152. node.staticRoot = true;
  54153. return
  54154. } else {
  54155. node.staticRoot = false;
  54156. }
  54157. if (node.children) {
  54158. for (var i = 0, l = node.children.length; i < l; i++) {
  54159. markStaticRoots(node.children[i], isInFor || !!node.for);
  54160. }
  54161. }
  54162. if (node.ifConditions) {
  54163. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54164. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54165. }
  54166. }
  54167. }
  54168. }
  54169. function isStatic (node) {
  54170. if (node.type === 2) { // expression
  54171. return false
  54172. }
  54173. if (node.type === 3) { // text
  54174. return true
  54175. }
  54176. return !!(node.pre || (
  54177. !node.hasBindings && // no dynamic bindings
  54178. !node.if && !node.for && // not v-if or v-for or v-else
  54179. !isBuiltInTag(node.tag) && // not a built-in
  54180. isPlatformReservedTag(node.tag) && // not a component
  54181. !isDirectChildOfTemplateFor(node) &&
  54182. Object.keys(node).every(isStaticKey)
  54183. ))
  54184. }
  54185. function isDirectChildOfTemplateFor (node) {
  54186. while (node.parent) {
  54187. node = node.parent;
  54188. if (node.tag !== 'template') {
  54189. return false
  54190. }
  54191. if (node.for) {
  54192. return true
  54193. }
  54194. }
  54195. return false
  54196. }
  54197. /* */
  54198. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54199. var fnInvokeRE = /\([^)]*?\);*$/;
  54200. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54201. // KeyboardEvent.keyCode aliases
  54202. var keyCodes = {
  54203. esc: 27,
  54204. tab: 9,
  54205. enter: 13,
  54206. space: 32,
  54207. up: 38,
  54208. left: 37,
  54209. right: 39,
  54210. down: 40,
  54211. 'delete': [8, 46]
  54212. };
  54213. // KeyboardEvent.key aliases
  54214. var keyNames = {
  54215. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54216. esc: ['Esc', 'Escape'],
  54217. tab: 'Tab',
  54218. enter: 'Enter',
  54219. // #9112: IE11 uses `Spacebar` for Space key name.
  54220. space: [' ', 'Spacebar'],
  54221. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54222. up: ['Up', 'ArrowUp'],
  54223. left: ['Left', 'ArrowLeft'],
  54224. right: ['Right', 'ArrowRight'],
  54225. down: ['Down', 'ArrowDown'],
  54226. // #9112: IE11 uses `Del` for Delete key name.
  54227. 'delete': ['Backspace', 'Delete', 'Del']
  54228. };
  54229. // #4868: modifiers that prevent the execution of the listener
  54230. // need to explicitly return null so that we can determine whether to remove
  54231. // the listener for .once
  54232. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54233. var modifierCode = {
  54234. stop: '$event.stopPropagation();',
  54235. prevent: '$event.preventDefault();',
  54236. self: genGuard("$event.target !== $event.currentTarget"),
  54237. ctrl: genGuard("!$event.ctrlKey"),
  54238. shift: genGuard("!$event.shiftKey"),
  54239. alt: genGuard("!$event.altKey"),
  54240. meta: genGuard("!$event.metaKey"),
  54241. left: genGuard("'button' in $event && $event.button !== 0"),
  54242. middle: genGuard("'button' in $event && $event.button !== 1"),
  54243. right: genGuard("'button' in $event && $event.button !== 2")
  54244. };
  54245. function genHandlers (
  54246. events,
  54247. isNative
  54248. ) {
  54249. var prefix = isNative ? 'nativeOn:' : 'on:';
  54250. var staticHandlers = "";
  54251. var dynamicHandlers = "";
  54252. for (var name in events) {
  54253. var handlerCode = genHandler(events[name]);
  54254. if (events[name] && events[name].dynamic) {
  54255. dynamicHandlers += name + "," + handlerCode + ",";
  54256. } else {
  54257. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54258. }
  54259. }
  54260. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54261. if (dynamicHandlers) {
  54262. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54263. } else {
  54264. return prefix + staticHandlers
  54265. }
  54266. }
  54267. function genHandler (handler) {
  54268. if (!handler) {
  54269. return 'function(){}'
  54270. }
  54271. if (Array.isArray(handler)) {
  54272. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54273. }
  54274. var isMethodPath = simplePathRE.test(handler.value);
  54275. var isFunctionExpression = fnExpRE.test(handler.value);
  54276. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54277. if (!handler.modifiers) {
  54278. if (isMethodPath || isFunctionExpression) {
  54279. return handler.value
  54280. }
  54281. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54282. } else {
  54283. var code = '';
  54284. var genModifierCode = '';
  54285. var keys = [];
  54286. for (var key in handler.modifiers) {
  54287. if (modifierCode[key]) {
  54288. genModifierCode += modifierCode[key];
  54289. // left/right
  54290. if (keyCodes[key]) {
  54291. keys.push(key);
  54292. }
  54293. } else if (key === 'exact') {
  54294. var modifiers = (handler.modifiers);
  54295. genModifierCode += genGuard(
  54296. ['ctrl', 'shift', 'alt', 'meta']
  54297. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54298. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54299. .join('||')
  54300. );
  54301. } else {
  54302. keys.push(key);
  54303. }
  54304. }
  54305. if (keys.length) {
  54306. code += genKeyFilter(keys);
  54307. }
  54308. // Make sure modifiers like prevent and stop get executed after key filtering
  54309. if (genModifierCode) {
  54310. code += genModifierCode;
  54311. }
  54312. var handlerCode = isMethodPath
  54313. ? ("return " + (handler.value) + "($event)")
  54314. : isFunctionExpression
  54315. ? ("return (" + (handler.value) + ")($event)")
  54316. : isFunctionInvocation
  54317. ? ("return " + (handler.value))
  54318. : handler.value;
  54319. return ("function($event){" + code + handlerCode + "}")
  54320. }
  54321. }
  54322. function genKeyFilter (keys) {
  54323. return (
  54324. // make sure the key filters only apply to KeyboardEvents
  54325. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54326. // key events that do not have keyCode property...
  54327. "if(!$event.type.indexOf('key')&&" +
  54328. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54329. )
  54330. }
  54331. function genFilterCode (key) {
  54332. var keyVal = parseInt(key, 10);
  54333. if (keyVal) {
  54334. return ("$event.keyCode!==" + keyVal)
  54335. }
  54336. var keyCode = keyCodes[key];
  54337. var keyName = keyNames[key];
  54338. return (
  54339. "_k($event.keyCode," +
  54340. (JSON.stringify(key)) + "," +
  54341. (JSON.stringify(keyCode)) + "," +
  54342. "$event.key," +
  54343. "" + (JSON.stringify(keyName)) +
  54344. ")"
  54345. )
  54346. }
  54347. /* */
  54348. function on (el, dir) {
  54349. if (dir.modifiers) {
  54350. warn("v-on without argument does not support modifiers.");
  54351. }
  54352. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54353. }
  54354. /* */
  54355. function bind$1 (el, dir) {
  54356. el.wrapData = function (code) {
  54357. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54358. };
  54359. }
  54360. /* */
  54361. var baseDirectives = {
  54362. on: on,
  54363. bind: bind$1,
  54364. cloak: noop
  54365. };
  54366. /* */
  54367. var CodegenState = function CodegenState (options) {
  54368. this.options = options;
  54369. this.warn = options.warn || baseWarn;
  54370. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54371. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54372. this.directives = extend(extend({}, baseDirectives), options.directives);
  54373. var isReservedTag = options.isReservedTag || no;
  54374. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54375. this.onceId = 0;
  54376. this.staticRenderFns = [];
  54377. this.pre = false;
  54378. };
  54379. function generate (
  54380. ast,
  54381. options
  54382. ) {
  54383. var state = new CodegenState(options);
  54384. var code = ast ? genElement(ast, state) : '_c("div")';
  54385. return {
  54386. render: ("with(this){return " + code + "}"),
  54387. staticRenderFns: state.staticRenderFns
  54388. }
  54389. }
  54390. function genElement (el, state) {
  54391. if (el.parent) {
  54392. el.pre = el.pre || el.parent.pre;
  54393. }
  54394. if (el.staticRoot && !el.staticProcessed) {
  54395. return genStatic(el, state)
  54396. } else if (el.once && !el.onceProcessed) {
  54397. return genOnce(el, state)
  54398. } else if (el.for && !el.forProcessed) {
  54399. return genFor(el, state)
  54400. } else if (el.if && !el.ifProcessed) {
  54401. return genIf(el, state)
  54402. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54403. return genChildren(el, state) || 'void 0'
  54404. } else if (el.tag === 'slot') {
  54405. return genSlot(el, state)
  54406. } else {
  54407. // component or element
  54408. var code;
  54409. if (el.component) {
  54410. code = genComponent(el.component, el, state);
  54411. } else {
  54412. var data;
  54413. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54414. data = genData$2(el, state);
  54415. }
  54416. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54417. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54418. }
  54419. // module transforms
  54420. for (var i = 0; i < state.transforms.length; i++) {
  54421. code = state.transforms[i](el, code);
  54422. }
  54423. return code
  54424. }
  54425. }
  54426. // hoist static sub-trees out
  54427. function genStatic (el, state) {
  54428. el.staticProcessed = true;
  54429. // Some elements (templates) need to behave differently inside of a v-pre
  54430. // node. All pre nodes are static roots, so we can use this as a location to
  54431. // wrap a state change and reset it upon exiting the pre node.
  54432. var originalPreState = state.pre;
  54433. if (el.pre) {
  54434. state.pre = el.pre;
  54435. }
  54436. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54437. state.pre = originalPreState;
  54438. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54439. }
  54440. // v-once
  54441. function genOnce (el, state) {
  54442. el.onceProcessed = true;
  54443. if (el.if && !el.ifProcessed) {
  54444. return genIf(el, state)
  54445. } else if (el.staticInFor) {
  54446. var key = '';
  54447. var parent = el.parent;
  54448. while (parent) {
  54449. if (parent.for) {
  54450. key = parent.key;
  54451. break
  54452. }
  54453. parent = parent.parent;
  54454. }
  54455. if (!key) {
  54456. state.warn(
  54457. "v-once can only be used inside v-for that is keyed. ",
  54458. el.rawAttrsMap['v-once']
  54459. );
  54460. return genElement(el, state)
  54461. }
  54462. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54463. } else {
  54464. return genStatic(el, state)
  54465. }
  54466. }
  54467. function genIf (
  54468. el,
  54469. state,
  54470. altGen,
  54471. altEmpty
  54472. ) {
  54473. el.ifProcessed = true; // avoid recursion
  54474. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54475. }
  54476. function genIfConditions (
  54477. conditions,
  54478. state,
  54479. altGen,
  54480. altEmpty
  54481. ) {
  54482. if (!conditions.length) {
  54483. return altEmpty || '_e()'
  54484. }
  54485. var condition = conditions.shift();
  54486. if (condition.exp) {
  54487. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54488. } else {
  54489. return ("" + (genTernaryExp(condition.block)))
  54490. }
  54491. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54492. function genTernaryExp (el) {
  54493. return altGen
  54494. ? altGen(el, state)
  54495. : el.once
  54496. ? genOnce(el, state)
  54497. : genElement(el, state)
  54498. }
  54499. }
  54500. function genFor (
  54501. el,
  54502. state,
  54503. altGen,
  54504. altHelper
  54505. ) {
  54506. var exp = el.for;
  54507. var alias = el.alias;
  54508. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54509. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54510. if (state.maybeComponent(el) &&
  54511. el.tag !== 'slot' &&
  54512. el.tag !== 'template' &&
  54513. !el.key
  54514. ) {
  54515. state.warn(
  54516. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54517. "v-for should have explicit keys. " +
  54518. "See https://vuejs.org/guide/list.html#key for more info.",
  54519. el.rawAttrsMap['v-for'],
  54520. true /* tip */
  54521. );
  54522. }
  54523. el.forProcessed = true; // avoid recursion
  54524. return (altHelper || '_l') + "((" + exp + ")," +
  54525. "function(" + alias + iterator1 + iterator2 + "){" +
  54526. "return " + ((altGen || genElement)(el, state)) +
  54527. '})'
  54528. }
  54529. function genData$2 (el, state) {
  54530. var data = '{';
  54531. // directives first.
  54532. // directives may mutate the el's other properties before they are generated.
  54533. var dirs = genDirectives(el, state);
  54534. if (dirs) { data += dirs + ','; }
  54535. // key
  54536. if (el.key) {
  54537. data += "key:" + (el.key) + ",";
  54538. }
  54539. // ref
  54540. if (el.ref) {
  54541. data += "ref:" + (el.ref) + ",";
  54542. }
  54543. if (el.refInFor) {
  54544. data += "refInFor:true,";
  54545. }
  54546. // pre
  54547. if (el.pre) {
  54548. data += "pre:true,";
  54549. }
  54550. // record original tag name for components using "is" attribute
  54551. if (el.component) {
  54552. data += "tag:\"" + (el.tag) + "\",";
  54553. }
  54554. // module data generation functions
  54555. for (var i = 0; i < state.dataGenFns.length; i++) {
  54556. data += state.dataGenFns[i](el);
  54557. }
  54558. // attributes
  54559. if (el.attrs) {
  54560. data += "attrs:" + (genProps(el.attrs)) + ",";
  54561. }
  54562. // DOM props
  54563. if (el.props) {
  54564. data += "domProps:" + (genProps(el.props)) + ",";
  54565. }
  54566. // event handlers
  54567. if (el.events) {
  54568. data += (genHandlers(el.events, false)) + ",";
  54569. }
  54570. if (el.nativeEvents) {
  54571. data += (genHandlers(el.nativeEvents, true)) + ",";
  54572. }
  54573. // slot target
  54574. // only for non-scoped slots
  54575. if (el.slotTarget && !el.slotScope) {
  54576. data += "slot:" + (el.slotTarget) + ",";
  54577. }
  54578. // scoped slots
  54579. if (el.scopedSlots) {
  54580. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54581. }
  54582. // component v-model
  54583. if (el.model) {
  54584. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54585. }
  54586. // inline-template
  54587. if (el.inlineTemplate) {
  54588. var inlineTemplate = genInlineTemplate(el, state);
  54589. if (inlineTemplate) {
  54590. data += inlineTemplate + ",";
  54591. }
  54592. }
  54593. data = data.replace(/,$/, '') + '}';
  54594. // v-bind dynamic argument wrap
  54595. // v-bind with dynamic arguments must be applied using the same v-bind object
  54596. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54597. if (el.dynamicAttrs) {
  54598. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54599. }
  54600. // v-bind data wrap
  54601. if (el.wrapData) {
  54602. data = el.wrapData(data);
  54603. }
  54604. // v-on data wrap
  54605. if (el.wrapListeners) {
  54606. data = el.wrapListeners(data);
  54607. }
  54608. return data
  54609. }
  54610. function genDirectives (el, state) {
  54611. var dirs = el.directives;
  54612. if (!dirs) { return }
  54613. var res = 'directives:[';
  54614. var hasRuntime = false;
  54615. var i, l, dir, needRuntime;
  54616. for (i = 0, l = dirs.length; i < l; i++) {
  54617. dir = dirs[i];
  54618. needRuntime = true;
  54619. var gen = state.directives[dir.name];
  54620. if (gen) {
  54621. // compile-time directive that manipulates AST.
  54622. // returns true if it also needs a runtime counterpart.
  54623. needRuntime = !!gen(el, dir, state.warn);
  54624. }
  54625. if (needRuntime) {
  54626. hasRuntime = true;
  54627. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  54628. }
  54629. }
  54630. if (hasRuntime) {
  54631. return res.slice(0, -1) + ']'
  54632. }
  54633. }
  54634. function genInlineTemplate (el, state) {
  54635. var ast = el.children[0];
  54636. if (el.children.length !== 1 || ast.type !== 1) {
  54637. state.warn(
  54638. 'Inline-template components must have exactly one child element.',
  54639. { start: el.start }
  54640. );
  54641. }
  54642. if (ast && ast.type === 1) {
  54643. var inlineRenderFns = generate(ast, state.options);
  54644. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54645. }
  54646. }
  54647. function genScopedSlots (
  54648. el,
  54649. slots,
  54650. state
  54651. ) {
  54652. // by default scoped slots are considered "stable", this allows child
  54653. // components with only scoped slots to skip forced updates from parent.
  54654. // but in some cases we have to bail-out of this optimization
  54655. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54656. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54657. var slot = slots[key];
  54658. return (
  54659. slot.slotTargetDynamic ||
  54660. slot.if ||
  54661. slot.for ||
  54662. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54663. )
  54664. });
  54665. // #9534: if a component with scoped slots is inside a conditional branch,
  54666. // it's possible for the same component to be reused but with different
  54667. // compiled slot content. To avoid that, we generate a unique key based on
  54668. // the generated code of all the slot contents.
  54669. var needsKey = !!el.if;
  54670. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54671. // disconnected due to the intermediate scope variable)
  54672. // #9438, #9506
  54673. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54674. // and skip force updating ones that do not actually use scope variables.
  54675. if (!needsForceUpdate) {
  54676. var parent = el.parent;
  54677. while (parent) {
  54678. if (
  54679. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54680. parent.for
  54681. ) {
  54682. needsForceUpdate = true;
  54683. break
  54684. }
  54685. if (parent.if) {
  54686. needsKey = true;
  54687. }
  54688. parent = parent.parent;
  54689. }
  54690. }
  54691. var generatedSlots = Object.keys(slots)
  54692. .map(function (key) { return genScopedSlot(slots[key], state); })
  54693. .join(',');
  54694. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54695. }
  54696. function hash(str) {
  54697. var hash = 5381;
  54698. var i = str.length;
  54699. while(i) {
  54700. hash = (hash * 33) ^ str.charCodeAt(--i);
  54701. }
  54702. return hash >>> 0
  54703. }
  54704. function containsSlotChild (el) {
  54705. if (el.type === 1) {
  54706. if (el.tag === 'slot') {
  54707. return true
  54708. }
  54709. return el.children.some(containsSlotChild)
  54710. }
  54711. return false
  54712. }
  54713. function genScopedSlot (
  54714. el,
  54715. state
  54716. ) {
  54717. var isLegacySyntax = el.attrsMap['slot-scope'];
  54718. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54719. return genIf(el, state, genScopedSlot, "null")
  54720. }
  54721. if (el.for && !el.forProcessed) {
  54722. return genFor(el, state, genScopedSlot)
  54723. }
  54724. var slotScope = el.slotScope === emptySlotScopeToken
  54725. ? ""
  54726. : String(el.slotScope);
  54727. var fn = "function(" + slotScope + "){" +
  54728. "return " + (el.tag === 'template'
  54729. ? el.if && isLegacySyntax
  54730. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54731. : genChildren(el, state) || 'undefined'
  54732. : genElement(el, state)) + "}";
  54733. // reverse proxy v-slot without scope on this.$slots
  54734. var reverseProxy = slotScope ? "" : ",proxy:true";
  54735. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54736. }
  54737. function genChildren (
  54738. el,
  54739. state,
  54740. checkSkip,
  54741. altGenElement,
  54742. altGenNode
  54743. ) {
  54744. var children = el.children;
  54745. if (children.length) {
  54746. var el$1 = children[0];
  54747. // optimize single v-for
  54748. if (children.length === 1 &&
  54749. el$1.for &&
  54750. el$1.tag !== 'template' &&
  54751. el$1.tag !== 'slot'
  54752. ) {
  54753. var normalizationType = checkSkip
  54754. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54755. : "";
  54756. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54757. }
  54758. var normalizationType$1 = checkSkip
  54759. ? getNormalizationType(children, state.maybeComponent)
  54760. : 0;
  54761. var gen = altGenNode || genNode;
  54762. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54763. }
  54764. }
  54765. // determine the normalization needed for the children array.
  54766. // 0: no normalization needed
  54767. // 1: simple normalization needed (possible 1-level deep nested array)
  54768. // 2: full normalization needed
  54769. function getNormalizationType (
  54770. children,
  54771. maybeComponent
  54772. ) {
  54773. var res = 0;
  54774. for (var i = 0; i < children.length; i++) {
  54775. var el = children[i];
  54776. if (el.type !== 1) {
  54777. continue
  54778. }
  54779. if (needsNormalization(el) ||
  54780. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54781. res = 2;
  54782. break
  54783. }
  54784. if (maybeComponent(el) ||
  54785. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54786. res = 1;
  54787. }
  54788. }
  54789. return res
  54790. }
  54791. function needsNormalization (el) {
  54792. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54793. }
  54794. function genNode (node, state) {
  54795. if (node.type === 1) {
  54796. return genElement(node, state)
  54797. } else if (node.type === 3 && node.isComment) {
  54798. return genComment(node)
  54799. } else {
  54800. return genText(node)
  54801. }
  54802. }
  54803. function genText (text) {
  54804. return ("_v(" + (text.type === 2
  54805. ? text.expression // no need for () because already wrapped in _s()
  54806. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54807. }
  54808. function genComment (comment) {
  54809. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54810. }
  54811. function genSlot (el, state) {
  54812. var slotName = el.slotName || '"default"';
  54813. var children = genChildren(el, state);
  54814. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54815. var attrs = el.attrs || el.dynamicAttrs
  54816. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54817. // slot props are camelized
  54818. name: camelize(attr.name),
  54819. value: attr.value,
  54820. dynamic: attr.dynamic
  54821. }); }))
  54822. : null;
  54823. var bind$$1 = el.attrsMap['v-bind'];
  54824. if ((attrs || bind$$1) && !children) {
  54825. res += ",null";
  54826. }
  54827. if (attrs) {
  54828. res += "," + attrs;
  54829. }
  54830. if (bind$$1) {
  54831. res += (attrs ? '' : ',null') + "," + bind$$1;
  54832. }
  54833. return res + ')'
  54834. }
  54835. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54836. function genComponent (
  54837. componentName,
  54838. el,
  54839. state
  54840. ) {
  54841. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54842. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54843. }
  54844. function genProps (props) {
  54845. var staticProps = "";
  54846. var dynamicProps = "";
  54847. for (var i = 0; i < props.length; i++) {
  54848. var prop = props[i];
  54849. var value = transformSpecialNewlines(prop.value);
  54850. if (prop.dynamic) {
  54851. dynamicProps += (prop.name) + "," + value + ",";
  54852. } else {
  54853. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54854. }
  54855. }
  54856. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54857. if (dynamicProps) {
  54858. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54859. } else {
  54860. return staticProps
  54861. }
  54862. }
  54863. // #3895, #4268
  54864. function transformSpecialNewlines (text) {
  54865. return text
  54866. .replace(/\u2028/g, '\\u2028')
  54867. .replace(/\u2029/g, '\\u2029')
  54868. }
  54869. /* */
  54870. // these keywords should not appear inside expressions, but operators like
  54871. // typeof, instanceof and in are allowed
  54872. var prohibitedKeywordRE = new RegExp('\\b' + (
  54873. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54874. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54875. 'extends,finally,continue,debugger,function,arguments'
  54876. ).split(',').join('\\b|\\b') + '\\b');
  54877. // these unary operators should not be used as property/method names
  54878. var unaryOperatorsRE = new RegExp('\\b' + (
  54879. 'delete,typeof,void'
  54880. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54881. // strip strings in expressions
  54882. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54883. // detect problematic expressions in a template
  54884. function detectErrors (ast, warn) {
  54885. if (ast) {
  54886. checkNode(ast, warn);
  54887. }
  54888. }
  54889. function checkNode (node, warn) {
  54890. if (node.type === 1) {
  54891. for (var name in node.attrsMap) {
  54892. if (dirRE.test(name)) {
  54893. var value = node.attrsMap[name];
  54894. if (value) {
  54895. var range = node.rawAttrsMap[name];
  54896. if (name === 'v-for') {
  54897. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54898. } else if (name === 'v-slot' || name[0] === '#') {
  54899. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54900. } else if (onRE.test(name)) {
  54901. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54902. } else {
  54903. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54904. }
  54905. }
  54906. }
  54907. }
  54908. if (node.children) {
  54909. for (var i = 0; i < node.children.length; i++) {
  54910. checkNode(node.children[i], warn);
  54911. }
  54912. }
  54913. } else if (node.type === 2) {
  54914. checkExpression(node.expression, node.text, warn, node);
  54915. }
  54916. }
  54917. function checkEvent (exp, text, warn, range) {
  54918. var stripped = exp.replace(stripStringRE, '');
  54919. var keywordMatch = stripped.match(unaryOperatorsRE);
  54920. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54921. warn(
  54922. "avoid using JavaScript unary operator as property name: " +
  54923. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54924. range
  54925. );
  54926. }
  54927. checkExpression(exp, text, warn, range);
  54928. }
  54929. function checkFor (node, text, warn, range) {
  54930. checkExpression(node.for || '', text, warn, range);
  54931. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54932. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54933. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54934. }
  54935. function checkIdentifier (
  54936. ident,
  54937. type,
  54938. text,
  54939. warn,
  54940. range
  54941. ) {
  54942. if (typeof ident === 'string') {
  54943. try {
  54944. new Function(("var " + ident + "=_"));
  54945. } catch (e) {
  54946. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54947. }
  54948. }
  54949. }
  54950. function checkExpression (exp, text, warn, range) {
  54951. try {
  54952. new Function(("return " + exp));
  54953. } catch (e) {
  54954. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54955. if (keywordMatch) {
  54956. warn(
  54957. "avoid using JavaScript keyword as property name: " +
  54958. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54959. range
  54960. );
  54961. } else {
  54962. warn(
  54963. "invalid expression: " + (e.message) + " in\n\n" +
  54964. " " + exp + "\n\n" +
  54965. " Raw expression: " + (text.trim()) + "\n",
  54966. range
  54967. );
  54968. }
  54969. }
  54970. }
  54971. function checkFunctionParameterExpression (exp, text, warn, range) {
  54972. try {
  54973. new Function(exp, '');
  54974. } catch (e) {
  54975. warn(
  54976. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54977. " " + exp + "\n\n" +
  54978. " Raw expression: " + (text.trim()) + "\n",
  54979. range
  54980. );
  54981. }
  54982. }
  54983. /* */
  54984. var range = 2;
  54985. function generateCodeFrame (
  54986. source,
  54987. start,
  54988. end
  54989. ) {
  54990. if ( start === void 0 ) start = 0;
  54991. if ( end === void 0 ) end = source.length;
  54992. var lines = source.split(/\r?\n/);
  54993. var count = 0;
  54994. var res = [];
  54995. for (var i = 0; i < lines.length; i++) {
  54996. count += lines[i].length + 1;
  54997. if (count >= start) {
  54998. for (var j = i - range; j <= i + range || end > count; j++) {
  54999. if (j < 0 || j >= lines.length) { continue }
  55000. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55001. var lineLength = lines[j].length;
  55002. if (j === i) {
  55003. // push underline
  55004. var pad = start - (count - lineLength) + 1;
  55005. var length = end > count ? lineLength - pad : end - start;
  55006. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55007. } else if (j > i) {
  55008. if (end > count) {
  55009. var length$1 = Math.min(end - count, lineLength);
  55010. res.push(" | " + repeat$1("^", length$1));
  55011. }
  55012. count += lineLength + 1;
  55013. }
  55014. }
  55015. break
  55016. }
  55017. }
  55018. return res.join('\n')
  55019. }
  55020. function repeat$1 (str, n) {
  55021. var result = '';
  55022. if (n > 0) {
  55023. while (true) { // eslint-disable-line
  55024. if (n & 1) { result += str; }
  55025. n >>>= 1;
  55026. if (n <= 0) { break }
  55027. str += str;
  55028. }
  55029. }
  55030. return result
  55031. }
  55032. /* */
  55033. function createFunction (code, errors) {
  55034. try {
  55035. return new Function(code)
  55036. } catch (err) {
  55037. errors.push({ err: err, code: code });
  55038. return noop
  55039. }
  55040. }
  55041. function createCompileToFunctionFn (compile) {
  55042. var cache = Object.create(null);
  55043. return function compileToFunctions (
  55044. template,
  55045. options,
  55046. vm
  55047. ) {
  55048. options = extend({}, options);
  55049. var warn$$1 = options.warn || warn;
  55050. delete options.warn;
  55051. /* istanbul ignore if */
  55052. {
  55053. // detect possible CSP restriction
  55054. try {
  55055. new Function('return 1');
  55056. } catch (e) {
  55057. if (e.toString().match(/unsafe-eval|CSP/)) {
  55058. warn$$1(
  55059. 'It seems you are using the standalone build of Vue.js in an ' +
  55060. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55061. 'The template compiler cannot work in this environment. Consider ' +
  55062. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55063. 'templates into render functions.'
  55064. );
  55065. }
  55066. }
  55067. }
  55068. // check cache
  55069. var key = options.delimiters
  55070. ? String(options.delimiters) + template
  55071. : template;
  55072. if (cache[key]) {
  55073. return cache[key]
  55074. }
  55075. // compile
  55076. var compiled = compile(template, options);
  55077. // check compilation errors/tips
  55078. {
  55079. if (compiled.errors && compiled.errors.length) {
  55080. if (options.outputSourceRange) {
  55081. compiled.errors.forEach(function (e) {
  55082. warn$$1(
  55083. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55084. generateCodeFrame(template, e.start, e.end),
  55085. vm
  55086. );
  55087. });
  55088. } else {
  55089. warn$$1(
  55090. "Error compiling template:\n\n" + template + "\n\n" +
  55091. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55092. vm
  55093. );
  55094. }
  55095. }
  55096. if (compiled.tips && compiled.tips.length) {
  55097. if (options.outputSourceRange) {
  55098. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55099. } else {
  55100. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55101. }
  55102. }
  55103. }
  55104. // turn code into functions
  55105. var res = {};
  55106. var fnGenErrors = [];
  55107. res.render = createFunction(compiled.render, fnGenErrors);
  55108. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55109. return createFunction(code, fnGenErrors)
  55110. });
  55111. // check function generation errors.
  55112. // this should only happen if there is a bug in the compiler itself.
  55113. // mostly for codegen development use
  55114. /* istanbul ignore if */
  55115. {
  55116. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55117. warn$$1(
  55118. "Failed to generate render function:\n\n" +
  55119. fnGenErrors.map(function (ref) {
  55120. var err = ref.err;
  55121. var code = ref.code;
  55122. return ((err.toString()) + " in\n\n" + code + "\n");
  55123. }).join('\n'),
  55124. vm
  55125. );
  55126. }
  55127. }
  55128. return (cache[key] = res)
  55129. }
  55130. }
  55131. /* */
  55132. function createCompilerCreator (baseCompile) {
  55133. return function createCompiler (baseOptions) {
  55134. function compile (
  55135. template,
  55136. options
  55137. ) {
  55138. var finalOptions = Object.create(baseOptions);
  55139. var errors = [];
  55140. var tips = [];
  55141. var warn = function (msg, range, tip) {
  55142. (tip ? tips : errors).push(msg);
  55143. };
  55144. if (options) {
  55145. if (options.outputSourceRange) {
  55146. // $flow-disable-line
  55147. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55148. warn = function (msg, range, tip) {
  55149. var data = { msg: msg };
  55150. if (range) {
  55151. if (range.start != null) {
  55152. data.start = range.start + leadingSpaceLength;
  55153. }
  55154. if (range.end != null) {
  55155. data.end = range.end + leadingSpaceLength;
  55156. }
  55157. }
  55158. (tip ? tips : errors).push(data);
  55159. };
  55160. }
  55161. // merge custom modules
  55162. if (options.modules) {
  55163. finalOptions.modules =
  55164. (baseOptions.modules || []).concat(options.modules);
  55165. }
  55166. // merge custom directives
  55167. if (options.directives) {
  55168. finalOptions.directives = extend(
  55169. Object.create(baseOptions.directives || null),
  55170. options.directives
  55171. );
  55172. }
  55173. // copy other options
  55174. for (var key in options) {
  55175. if (key !== 'modules' && key !== 'directives') {
  55176. finalOptions[key] = options[key];
  55177. }
  55178. }
  55179. }
  55180. finalOptions.warn = warn;
  55181. var compiled = baseCompile(template.trim(), finalOptions);
  55182. {
  55183. detectErrors(compiled.ast, warn);
  55184. }
  55185. compiled.errors = errors;
  55186. compiled.tips = tips;
  55187. return compiled
  55188. }
  55189. return {
  55190. compile: compile,
  55191. compileToFunctions: createCompileToFunctionFn(compile)
  55192. }
  55193. }
  55194. }
  55195. /* */
  55196. // `createCompilerCreator` allows creating compilers that use alternative
  55197. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55198. // Here we just export a default compiler using the default parts.
  55199. var createCompiler = createCompilerCreator(function baseCompile (
  55200. template,
  55201. options
  55202. ) {
  55203. var ast = parse(template.trim(), options);
  55204. if (options.optimize !== false) {
  55205. optimize(ast, options);
  55206. }
  55207. var code = generate(ast, options);
  55208. return {
  55209. ast: ast,
  55210. render: code.render,
  55211. staticRenderFns: code.staticRenderFns
  55212. }
  55213. });
  55214. /* */
  55215. var ref$1 = createCompiler(baseOptions);
  55216. var compile = ref$1.compile;
  55217. var compileToFunctions = ref$1.compileToFunctions;
  55218. /* */
  55219. // check whether current browser encodes a char inside attribute values
  55220. var div;
  55221. function getShouldDecode (href) {
  55222. div = div || document.createElement('div');
  55223. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55224. return div.innerHTML.indexOf('&#10;') > 0
  55225. }
  55226. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55227. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55228. // #6828: chrome encodes content in a[href]
  55229. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55230. /* */
  55231. var idToTemplate = cached(function (id) {
  55232. var el = query(id);
  55233. return el && el.innerHTML
  55234. });
  55235. var mount = Vue.prototype.$mount;
  55236. Vue.prototype.$mount = function (
  55237. el,
  55238. hydrating
  55239. ) {
  55240. el = el && query(el);
  55241. /* istanbul ignore if */
  55242. if (el === document.body || el === document.documentElement) {
  55243. warn(
  55244. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55245. );
  55246. return this
  55247. }
  55248. var options = this.$options;
  55249. // resolve template/el and convert to render function
  55250. if (!options.render) {
  55251. var template = options.template;
  55252. if (template) {
  55253. if (typeof template === 'string') {
  55254. if (template.charAt(0) === '#') {
  55255. template = idToTemplate(template);
  55256. /* istanbul ignore if */
  55257. if (!template) {
  55258. warn(
  55259. ("Template element not found or is empty: " + (options.template)),
  55260. this
  55261. );
  55262. }
  55263. }
  55264. } else if (template.nodeType) {
  55265. template = template.innerHTML;
  55266. } else {
  55267. {
  55268. warn('invalid template option:' + template, this);
  55269. }
  55270. return this
  55271. }
  55272. } else if (el) {
  55273. template = getOuterHTML(el);
  55274. }
  55275. if (template) {
  55276. /* istanbul ignore if */
  55277. if (config.performance && mark) {
  55278. mark('compile');
  55279. }
  55280. var ref = compileToFunctions(template, {
  55281. outputSourceRange: "development" !== 'production',
  55282. shouldDecodeNewlines: shouldDecodeNewlines,
  55283. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55284. delimiters: options.delimiters,
  55285. comments: options.comments
  55286. }, this);
  55287. var render = ref.render;
  55288. var staticRenderFns = ref.staticRenderFns;
  55289. options.render = render;
  55290. options.staticRenderFns = staticRenderFns;
  55291. /* istanbul ignore if */
  55292. if (config.performance && mark) {
  55293. mark('compile end');
  55294. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55295. }
  55296. }
  55297. }
  55298. return mount.call(this, el, hydrating)
  55299. };
  55300. /**
  55301. * Get outerHTML of elements, taking care
  55302. * of SVG elements in IE as well.
  55303. */
  55304. function getOuterHTML (el) {
  55305. if (el.outerHTML) {
  55306. return el.outerHTML
  55307. } else {
  55308. var container = document.createElement('div');
  55309. container.appendChild(el.cloneNode(true));
  55310. return container.innerHTML
  55311. }
  55312. }
  55313. Vue.compile = compileToFunctions;
  55314. module.exports = Vue;
  55315. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../../timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate))
  55316. /***/ }),
  55317. /***/ "./node_modules/vue/dist/vue.common.js":
  55318. /*!*********************************************!*\
  55319. !*** ./node_modules/vue/dist/vue.common.js ***!
  55320. \*********************************************/
  55321. /*! no static exports found */
  55322. /***/ (function(module, exports, __webpack_require__) {
  55323. if (false) {} else {
  55324. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55325. }
  55326. /***/ }),
  55327. /***/ "./node_modules/webpack/buildin/global.js":
  55328. /*!***********************************!*\
  55329. !*** (webpack)/buildin/global.js ***!
  55330. \***********************************/
  55331. /*! no static exports found */
  55332. /***/ (function(module, exports) {
  55333. var g;
  55334. // This works in non-strict mode
  55335. g = (function() {
  55336. return this;
  55337. })();
  55338. try {
  55339. // This works if eval is allowed (see CSP)
  55340. g = g || new Function("return this")();
  55341. } catch (e) {
  55342. // This works if the window reference is available
  55343. if (typeof window === "object") g = window;
  55344. }
  55345. // g can still be undefined, but nothing to do about it...
  55346. // We return undefined, instead of nothing here, so it's
  55347. // easier to handle this case. if(!global) { ...}
  55348. module.exports = g;
  55349. /***/ }),
  55350. /***/ "./node_modules/webpack/buildin/module.js":
  55351. /*!***********************************!*\
  55352. !*** (webpack)/buildin/module.js ***!
  55353. \***********************************/
  55354. /*! no static exports found */
  55355. /***/ (function(module, exports) {
  55356. module.exports = function(module) {
  55357. if (!module.webpackPolyfill) {
  55358. module.deprecate = function() {};
  55359. module.paths = [];
  55360. // module.parent = undefined by default
  55361. if (!module.children) module.children = [];
  55362. Object.defineProperty(module, "loaded", {
  55363. enumerable: true,
  55364. get: function() {
  55365. return module.l;
  55366. }
  55367. });
  55368. Object.defineProperty(module, "id", {
  55369. enumerable: true,
  55370. get: function() {
  55371. return module.i;
  55372. }
  55373. });
  55374. module.webpackPolyfill = 1;
  55375. }
  55376. return module;
  55377. };
  55378. /***/ }),
  55379. /***/ "./resources/js/app.js":
  55380. /*!*****************************!*\
  55381. !*** ./resources/js/app.js ***!
  55382. \*****************************/
  55383. /*! no static exports found */
  55384. /***/ (function(module, exports, __webpack_require__) {
  55385. /**
  55386. * First we will load all of this project's JavaScript dependencies which
  55387. * includes Vue and other libraries. It is a great starting point when
  55388. * building robust, powerful web applications using Vue and Laravel.
  55389. */
  55390. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55391. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55392. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55393. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55394. /**
  55395. * The following block of code may be used to automatically register your
  55396. * Vue components. It will recursively scan this directory for the Vue
  55397. * components and automatically register them with their "basename".
  55398. *
  55399. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55400. */
  55401. // const files = require.context('./', true, /\.vue$/i)
  55402. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55403. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55404. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55405. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55406. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55407. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55408. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55409. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55410. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55411. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55412. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55413. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55414. /**
  55415. * Next, we will create a fresh Vue application instance and attach it to
  55416. * the page. Then, you may begin adding components to this application
  55417. * or customize the JavaScript scaffolding to fit your unique needs.
  55418. */
  55419. var app = new Vue({
  55420. el: '#app'
  55421. });
  55422. $(function () {
  55423. $('[data-toggle="tooltip"]').tooltip();
  55424. });
  55425. var clipboard = new Clipboard('.btn-clip');
  55426. clipboard.on('success', function (e) {
  55427. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55428. position: "right",
  55429. className: 'success'
  55430. });
  55431. e.clearSelection();
  55432. });
  55433. /***/ }),
  55434. /***/ "./resources/js/bootstrap.js":
  55435. /*!***********************************!*\
  55436. !*** ./resources/js/bootstrap.js ***!
  55437. \***********************************/
  55438. /*! no exports provided */
  55439. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55440. "use strict";
  55441. __webpack_require__.r(__webpack_exports__);
  55442. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55443. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55444. /**
  55445. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55446. * for JavaScript based Bootstrap features such as modals and tabs. This
  55447. * code may be modified to fit the specific needs of your application.
  55448. */
  55449. try {
  55450. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55451. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55452. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55453. } catch (e) {}
  55454. /**
  55455. * We'll load the axios HTTP library which allows us to easily issue requests
  55456. * to our Laravel back-end. This library automatically handles sending the
  55457. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55458. */
  55459. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55460. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55461. /**
  55462. * Echo exposes an expressive API for subscribing to channels and listening
  55463. * for events that are broadcast by Laravel. Echo and event broadcasting
  55464. * allows your team to easily build robust real-time web applications.
  55465. */
  55466. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55467. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55468. broadcaster: 'pusher',
  55469. key: "upccrt",
  55470. authEndpoint: '/broadcasting/auth',
  55471. wsHost: window.location.hostname,
  55472. wsPort: 6001,
  55473. disableStats: true
  55474. });
  55475. /***/ }),
  55476. /***/ "./resources/js/components/ExampleComponent.vue":
  55477. /*!******************************************************!*\
  55478. !*** ./resources/js/components/ExampleComponent.vue ***!
  55479. \******************************************************/
  55480. /*! exports provided: default */
  55481. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55482. "use strict";
  55483. __webpack_require__.r(__webpack_exports__);
  55484. /* harmony import */ var _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  55485. /* harmony import */ var _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=script&lang=js& */ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  55486. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  55487. /* normalize component */
  55488. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55489. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55490. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55491. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55492. false,
  55493. null,
  55494. null,
  55495. null
  55496. )
  55497. /* hot reload */
  55498. if (false) { var api; }
  55499. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55500. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55501. /***/ }),
  55502. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55503. /*!*******************************************************************************!*\
  55504. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55505. \*******************************************************************************/
  55506. /*! exports provided: default */
  55507. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55508. "use strict";
  55509. __webpack_require__.r(__webpack_exports__);
  55510. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./ExampleComponent.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  55511. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55512. /***/ }),
  55513. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55514. /*!*************************************************************************************!*\
  55515. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55516. \*************************************************************************************/
  55517. /*! exports provided: render, staticRenderFns */
  55518. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55519. "use strict";
  55520. __webpack_require__.r(__webpack_exports__);
  55521. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  55522. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55523. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55524. /***/ }),
  55525. /***/ "./resources/js/components/assetinfo.vue":
  55526. /*!***********************************************!*\
  55527. !*** ./resources/js/components/assetinfo.vue ***!
  55528. \***********************************************/
  55529. /*! exports provided: default */
  55530. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55531. "use strict";
  55532. __webpack_require__.r(__webpack_exports__);
  55533. /* harmony import */ var _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assetinfo.vue?vue&type=template&id=4fe1d2e3& */ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&");
  55534. /* harmony import */ var _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assetinfo.vue?vue&type=script&lang=js& */ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&");
  55535. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  55536. /* normalize component */
  55537. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55538. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55539. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55540. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55541. false,
  55542. null,
  55543. null,
  55544. null
  55545. )
  55546. /* hot reload */
  55547. if (false) { var api; }
  55548. component.options.__file = "resources/js/components/assetinfo.vue"
  55549. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55550. /***/ }),
  55551. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55552. /*!************************************************************************!*\
  55553. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55554. \************************************************************************/
  55555. /*! exports provided: default */
  55556. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55557. "use strict";
  55558. __webpack_require__.r(__webpack_exports__);
  55559. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./assetinfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&");
  55560. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55561. /***/ }),
  55562. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55563. /*!******************************************************************************!*\
  55564. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55565. \******************************************************************************/
  55566. /*! exports provided: render, staticRenderFns */
  55567. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55568. "use strict";
  55569. __webpack_require__.r(__webpack_exports__);
  55570. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./assetinfo.vue?vue&type=template&id=4fe1d2e3& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&");
  55571. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55572. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55573. /***/ }),
  55574. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55575. /*!******************************************************************!*\
  55576. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55577. \******************************************************************/
  55578. /*! exports provided: default */
  55579. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55580. "use strict";
  55581. __webpack_require__.r(__webpack_exports__);
  55582. /* harmony import */ var _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& */ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&");
  55583. /* harmony import */ var _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./autocomplete-custom-dropdown.vue?vue&type=script&lang=js& */ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&");
  55584. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  55585. /* normalize component */
  55586. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55587. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55588. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55589. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55590. false,
  55591. null,
  55592. null,
  55593. null
  55594. )
  55595. /* hot reload */
  55596. if (false) { var api; }
  55597. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55598. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55599. /***/ }),
  55600. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55601. /*!*******************************************************************************************!*\
  55602. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55603. \*******************************************************************************************/
  55604. /*! exports provided: default */
  55605. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55606. "use strict";
  55607. __webpack_require__.r(__webpack_exports__);
  55608. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./autocomplete-custom-dropdown.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&");
  55609. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55610. /***/ }),
  55611. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55612. /*!*************************************************************************************************!*\
  55613. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55614. \*************************************************************************************************/
  55615. /*! exports provided: render, staticRenderFns */
  55616. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55617. "use strict";
  55618. __webpack_require__.r(__webpack_exports__);
  55619. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&");
  55620. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55621. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55622. /***/ }),
  55623. /***/ "./resources/js/components/credential-form-modal.vue":
  55624. /*!***********************************************************!*\
  55625. !*** ./resources/js/components/credential-form-modal.vue ***!
  55626. \***********************************************************/
  55627. /*! exports provided: default */
  55628. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55629. "use strict";
  55630. __webpack_require__.r(__webpack_exports__);
  55631. /* harmony import */ var _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential-form-modal.vue?vue&type=template&id=5ba19d42& */ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&");
  55632. /* harmony import */ var _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential-form-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&");
  55633. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  55634. /* normalize component */
  55635. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55636. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55637. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55638. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55639. false,
  55640. null,
  55641. null,
  55642. null
  55643. )
  55644. /* hot reload */
  55645. if (false) { var api; }
  55646. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55647. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55648. /***/ }),
  55649. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55650. /*!************************************************************************************!*\
  55651. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55652. \************************************************************************************/
  55653. /*! exports provided: default */
  55654. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55655. "use strict";
  55656. __webpack_require__.r(__webpack_exports__);
  55657. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-form-modal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&");
  55658. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55659. /***/ }),
  55660. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55661. /*!******************************************************************************************!*\
  55662. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55663. \******************************************************************************************/
  55664. /*! exports provided: render, staticRenderFns */
  55665. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55666. "use strict";
  55667. __webpack_require__.r(__webpack_exports__);
  55668. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-form-modal.vue?vue&type=template&id=5ba19d42& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&");
  55669. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55670. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55671. /***/ }),
  55672. /***/ "./resources/js/components/credential-list.vue":
  55673. /*!*****************************************************!*\
  55674. !*** ./resources/js/components/credential-list.vue ***!
  55675. \*****************************************************/
  55676. /*! exports provided: default */
  55677. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55678. "use strict";
  55679. __webpack_require__.r(__webpack_exports__);
  55680. /* harmony import */ var _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential-list.vue?vue&type=template&id=06d8fa4e& */ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&");
  55681. /* harmony import */ var _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential-list.vue?vue&type=script&lang=js& */ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&");
  55682. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  55683. /* normalize component */
  55684. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55685. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55686. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55687. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55688. false,
  55689. null,
  55690. null,
  55691. null
  55692. )
  55693. /* hot reload */
  55694. if (false) { var api; }
  55695. component.options.__file = "resources/js/components/credential-list.vue"
  55696. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55697. /***/ }),
  55698. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55699. /*!******************************************************************************!*\
  55700. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55701. \******************************************************************************/
  55702. /*! exports provided: default */
  55703. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55704. "use strict";
  55705. __webpack_require__.r(__webpack_exports__);
  55706. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-list.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&");
  55707. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55708. /***/ }),
  55709. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55710. /*!************************************************************************************!*\
  55711. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55712. \************************************************************************************/
  55713. /*! exports provided: render, staticRenderFns */
  55714. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55715. "use strict";
  55716. __webpack_require__.r(__webpack_exports__);
  55717. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-list.vue?vue&type=template&id=06d8fa4e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&");
  55718. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55719. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55720. /***/ }),
  55721. /***/ "./resources/js/components/credential.vue":
  55722. /*!************************************************!*\
  55723. !*** ./resources/js/components/credential.vue ***!
  55724. \************************************************/
  55725. /*! exports provided: default */
  55726. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55727. "use strict";
  55728. __webpack_require__.r(__webpack_exports__);
  55729. /* harmony import */ var _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential.vue?vue&type=template&id=0f5cc562& */ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&");
  55730. /* harmony import */ var _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential.vue?vue&type=script&lang=js& */ "./resources/js/components/credential.vue?vue&type=script&lang=js&");
  55731. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  55732. /* normalize component */
  55733. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55734. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55735. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55736. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55737. false,
  55738. null,
  55739. null,
  55740. null
  55741. )
  55742. /* hot reload */
  55743. if (false) { var api; }
  55744. component.options.__file = "resources/js/components/credential.vue"
  55745. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55746. /***/ }),
  55747. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55748. /*!*************************************************************************!*\
  55749. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55750. \*************************************************************************/
  55751. /*! exports provided: default */
  55752. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55753. "use strict";
  55754. __webpack_require__.r(__webpack_exports__);
  55755. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./credential.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&");
  55756. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55757. /***/ }),
  55758. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55759. /*!*******************************************************************************!*\
  55760. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55761. \*******************************************************************************/
  55762. /*! exports provided: render, staticRenderFns */
  55763. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55764. "use strict";
  55765. __webpack_require__.r(__webpack_exports__);
  55766. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./credential.vue?vue&type=template&id=0f5cc562& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&");
  55767. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55768. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55769. /***/ }),
  55770. /***/ "./resources/js/components/errorlist.vue":
  55771. /*!***********************************************!*\
  55772. !*** ./resources/js/components/errorlist.vue ***!
  55773. \***********************************************/
  55774. /*! exports provided: default */
  55775. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55776. "use strict";
  55777. __webpack_require__.r(__webpack_exports__);
  55778. /* harmony import */ var _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./errorlist.vue?vue&type=template&id=1546f5eb& */ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&");
  55779. /* harmony import */ var _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errorlist.vue?vue&type=script&lang=js& */ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&");
  55780. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  55781. /* normalize component */
  55782. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55783. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55784. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55785. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55786. false,
  55787. null,
  55788. null,
  55789. null
  55790. )
  55791. /* hot reload */
  55792. if (false) { var api; }
  55793. component.options.__file = "resources/js/components/errorlist.vue"
  55794. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55795. /***/ }),
  55796. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55797. /*!************************************************************************!*\
  55798. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55799. \************************************************************************/
  55800. /*! exports provided: default */
  55801. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55802. "use strict";
  55803. __webpack_require__.r(__webpack_exports__);
  55804. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./errorlist.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&");
  55805. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55806. /***/ }),
  55807. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55808. /*!******************************************************************************!*\
  55809. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55810. \******************************************************************************/
  55811. /*! exports provided: render, staticRenderFns */
  55812. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55813. "use strict";
  55814. __webpack_require__.r(__webpack_exports__);
  55815. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./errorlist.vue?vue&type=template&id=1546f5eb& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&");
  55816. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55817. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55818. /***/ }),
  55819. /***/ "./resources/js/components/modal.vue":
  55820. /*!*******************************************!*\
  55821. !*** ./resources/js/components/modal.vue ***!
  55822. \*******************************************/
  55823. /*! exports provided: default */
  55824. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55825. "use strict";
  55826. __webpack_require__.r(__webpack_exports__);
  55827. /* harmony import */ var _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modal.vue?vue&type=template&id=478d961c& */ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&");
  55828. /* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  55829. var script = {}
  55830. /* normalize component */
  55831. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55832. script,
  55833. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55834. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55835. false,
  55836. null,
  55837. null,
  55838. null
  55839. )
  55840. /* hot reload */
  55841. if (false) { var api; }
  55842. component.options.__file = "resources/js/components/modal.vue"
  55843. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55844. /***/ }),
  55845. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55846. /*!**************************************************************************!*\
  55847. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55848. \**************************************************************************/
  55849. /*! exports provided: render, staticRenderFns */
  55850. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55851. "use strict";
  55852. __webpack_require__.r(__webpack_exports__);
  55853. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./modal.vue?vue&type=template&id=478d961c& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modal.vue?vue&type=template&id=478d961c&");
  55854. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55855. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55856. /***/ }),
  55857. /***/ "./resources/js/components/notes.vue":
  55858. /*!*******************************************!*\
  55859. !*** ./resources/js/components/notes.vue ***!
  55860. \*******************************************/
  55861. /*! exports provided: default */
  55862. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55863. "use strict";
  55864. __webpack_require__.r(__webpack_exports__);
  55865. /* harmony import */ var _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./notes.vue?vue&type=template&id=73d141f4& */ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&");
  55866. /* harmony import */ var _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./notes.vue?vue&type=script&lang=js& */ "./resources/js/components/notes.vue?vue&type=script&lang=js&");
  55867. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  55868. /* normalize component */
  55869. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55870. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55871. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55872. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55873. false,
  55874. null,
  55875. null,
  55876. null
  55877. )
  55878. /* hot reload */
  55879. if (false) { var api; }
  55880. component.options.__file = "resources/js/components/notes.vue"
  55881. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55882. /***/ }),
  55883. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  55884. /*!********************************************************************!*\
  55885. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  55886. \********************************************************************/
  55887. /*! exports provided: default */
  55888. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55889. "use strict";
  55890. __webpack_require__.r(__webpack_exports__);
  55891. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./notes.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&");
  55892. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55893. /***/ }),
  55894. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  55895. /*!**************************************************************************!*\
  55896. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  55897. \**************************************************************************/
  55898. /*! exports provided: render, staticRenderFns */
  55899. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55900. "use strict";
  55901. __webpack_require__.r(__webpack_exports__);
  55902. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./notes.vue?vue&type=template&id=73d141f4& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=template&id=73d141f4&");
  55903. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55904. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55905. /***/ }),
  55906. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  55907. /*!*******************************************************!*\
  55908. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  55909. \*******************************************************/
  55910. /*! exports provided: default */
  55911. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55912. "use strict";
  55913. __webpack_require__.r(__webpack_exports__);
  55914. /* harmony import */ var _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& */ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&");
  55915. /* harmony import */ var _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./woinfo-edit-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&");
  55916. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  55917. /* normalize component */
  55918. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55919. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55920. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55921. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55922. false,
  55923. null,
  55924. null,
  55925. null
  55926. )
  55927. /* hot reload */
  55928. if (false) { var api; }
  55929. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  55930. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55931. /***/ }),
  55932. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  55933. /*!********************************************************************************!*\
  55934. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  55935. \********************************************************************************/
  55936. /*! exports provided: default */
  55937. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55938. "use strict";
  55939. __webpack_require__.r(__webpack_exports__);
  55940. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./woinfo-edit-modal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&");
  55941. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55942. /***/ }),
  55943. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  55944. /*!**************************************************************************************!*\
  55945. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  55946. \**************************************************************************************/
  55947. /*! exports provided: render, staticRenderFns */
  55948. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55949. "use strict";
  55950. __webpack_require__.r(__webpack_exports__);
  55951. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&");
  55952. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55953. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55954. /***/ }),
  55955. /***/ "./resources/js/components/woinfo.vue":
  55956. /*!********************************************!*\
  55957. !*** ./resources/js/components/woinfo.vue ***!
  55958. \********************************************/
  55959. /*! exports provided: default */
  55960. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55961. "use strict";
  55962. __webpack_require__.r(__webpack_exports__);
  55963. /* harmony import */ var _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woinfo.vue?vue&type=template&id=33ce32de& */ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&");
  55964. /* harmony import */ var _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./woinfo.vue?vue&type=script&lang=js& */ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&");
  55965. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  55966. /* normalize component */
  55967. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55968. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55969. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  55970. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55971. false,
  55972. null,
  55973. null,
  55974. null
  55975. )
  55976. /* hot reload */
  55977. if (false) { var api; }
  55978. component.options.__file = "resources/js/components/woinfo.vue"
  55979. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55980. /***/ }),
  55981. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  55982. /*!*********************************************************************!*\
  55983. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  55984. \*********************************************************************/
  55985. /*! exports provided: default */
  55986. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55987. "use strict";
  55988. __webpack_require__.r(__webpack_exports__);
  55989. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./woinfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&");
  55990. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55991. /***/ }),
  55992. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  55993. /*!***************************************************************************!*\
  55994. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  55995. \***************************************************************************/
  55996. /*! exports provided: render, staticRenderFns */
  55997. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55998. "use strict";
  55999. __webpack_require__.r(__webpack_exports__);
  56000. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./woinfo.vue?vue&type=template&id=33ce32de& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&");
  56001. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  56002. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  56003. /***/ }),
  56004. /***/ "./resources/js/mixins/dateMixin.js":
  56005. /*!******************************************!*\
  56006. !*** ./resources/js/mixins/dateMixin.js ***!
  56007. \******************************************/
  56008. /*! exports provided: default */
  56009. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56010. "use strict";
  56011. __webpack_require__.r(__webpack_exports__);
  56012. /* harmony default export */ __webpack_exports__["default"] = ({
  56013. methods: {
  56014. treatAsUTC: function treatAsUTC(date) {
  56015. var result = new Date(date);
  56016. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56017. return result;
  56018. },
  56019. daysSinceToday: function daysSinceToday(date) {
  56020. var currentDate = new Date();
  56021. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56022. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56023. },
  56024. getHRDate: function getHRDate(dateString) {
  56025. var date = new Date(dateString);
  56026. return date.toLocaleString('default', {
  56027. month: 'short',
  56028. day: 'numeric',
  56029. year: 'numeric',
  56030. hour: 'numeric',
  56031. minute: 'numeric'
  56032. });
  56033. },
  56034. isZero: function isZero(dateString) {
  56035. return dateString === '0000-00-00 00:00:00';
  56036. }
  56037. }
  56038. });
  56039. /***/ }),
  56040. /***/ "./resources/js/notify.min.js":
  56041. /*!************************************!*\
  56042. !*** ./resources/js/notify.min.js ***!
  56043. \************************************/
  56044. /*! no static exports found */
  56045. /***/ (function(module, exports, __webpack_require__) {
  56046. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  56047. (function (e) {
  56048. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56049. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56050. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56051. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56052. })(function (e) {
  56053. function A(t, n, i) {
  56054. typeof i == "string" && (i = {
  56055. className: i
  56056. }), this.options = E(w, e.isPlainObject(i) ? i : {}), this.loadHTML(), this.wrapper = e(h.html), this.options.clickToHide && this.wrapper.addClass(r + "-hidable"), this.wrapper.data(r, this), this.arrow = this.wrapper.find("." + r + "-arrow"), this.container = this.wrapper.find("." + r + "-container"), this.container.append(this.userContainer), t && t.length && (this.elementType = t.attr("type"), this.originalElement = t, this.elem = N(t), this.elem.data(r, this), this.elem.before(this.wrapper)), this.container.hide(), this.run(n);
  56057. }
  56058. var t = [].indexOf || function (e) {
  56059. for (var t = 0, n = this.length; t < n; t++) {
  56060. if (t in this && this[t] === e) return t;
  56061. }
  56062. return -1;
  56063. },
  56064. n = "notify",
  56065. r = n + "js",
  56066. i = n + "!blank",
  56067. s = {
  56068. t: "top",
  56069. m: "middle",
  56070. b: "bottom",
  56071. l: "left",
  56072. c: "center",
  56073. r: "right"
  56074. },
  56075. o = ["l", "c", "r"],
  56076. u = ["t", "m", "b"],
  56077. a = ["t", "b", "l", "r"],
  56078. f = {
  56079. t: "b",
  56080. m: null,
  56081. b: "t",
  56082. l: "r",
  56083. c: null,
  56084. r: "l"
  56085. },
  56086. l = function l(t) {
  56087. var n;
  56088. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56089. var r;
  56090. r = t.toLowerCase().charAt(0);
  56091. if (s[r]) return n.push(r);
  56092. }), n;
  56093. },
  56094. c = {},
  56095. h = {
  56096. name: "core",
  56097. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56098. css: "." + r + "-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n." + r + "-corner ." + r + "-wrapper,\n." + r + "-corner ." + r + "-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n." + r + "-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n." + r + "-container {\n display: none;\n z-index: 1;\n position: absolute;\n}\n\n." + r + "-hidable {\n cursor: pointer;\n}\n\n[data-notify-text],[data-notify-html] {\n position: relative;\n}\n\n." + r + "-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"
  56099. },
  56100. p = {
  56101. "border-radius": ["-webkit-", "-moz-"]
  56102. },
  56103. d = function d(e) {
  56104. return c[e];
  56105. },
  56106. v = function v(e) {
  56107. if (!e) throw "Missing Style name";
  56108. c[e] && delete c[e];
  56109. },
  56110. m = function m(t, i) {
  56111. if (!t) throw "Missing Style name";
  56112. if (!i) throw "Missing Style definition";
  56113. if (!i.html) throw "Missing Style HTML";
  56114. var s = c[t];
  56115. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56116. var o = "";
  56117. i.classes && e.each(i.classes, function (t, n) {
  56118. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56119. return p[t] && e.each(p[t], function (e, r) {
  56120. return o += " " + r + t + ": " + n + ";\n";
  56121. }), o += " " + t + ": " + n + ";\n";
  56122. }), o += "}\n";
  56123. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56124. var u = {},
  56125. a = e(i.html);
  56126. y("html", a, u), y("text", a, u), i.fields = u;
  56127. },
  56128. g = function g(t) {
  56129. var n, r, i;
  56130. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56131. try {
  56132. r.html(t);
  56133. } catch (s) {
  56134. r[0].styleSheet.cssText = t;
  56135. }
  56136. return r;
  56137. },
  56138. y = function y(t, n, r) {
  56139. var s;
  56140. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56141. var n;
  56142. n = e(this).attr(s), n || (n = i), r[n] = t;
  56143. });
  56144. },
  56145. b = function b(e, t) {
  56146. return e.is(t) ? e : e.find(t);
  56147. },
  56148. w = {
  56149. clickToHide: !0,
  56150. autoHide: !0,
  56151. autoHideDelay: 5e3,
  56152. arrowShow: !0,
  56153. arrowSize: 5,
  56154. breakNewLines: !0,
  56155. elementPosition: "bottom",
  56156. globalPosition: "top right",
  56157. style: "bootstrap",
  56158. className: "error",
  56159. showAnimation: "slideDown",
  56160. showDuration: 400,
  56161. hideAnimation: "slideUp",
  56162. hideDuration: 200,
  56163. gap: 5
  56164. },
  56165. E = function E(t, n) {
  56166. var r;
  56167. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56168. },
  56169. S = function S(t) {
  56170. return e.extend(w, t);
  56171. },
  56172. x = function x(t) {
  56173. return e("<" + t + "></" + t + ">");
  56174. },
  56175. T = {},
  56176. N = function N(t) {
  56177. var n;
  56178. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56179. return e(r).attr("name") === t.attr("name");
  56180. }), t = n.first()), t;
  56181. },
  56182. C = function C(e, t, n) {
  56183. var r, i;
  56184. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56185. if (isNaN(n)) return;
  56186. return r = s[f[t.charAt(0)]], i = t, e[r] !== undefined && (t = s[r.charAt(0)], n = -n), e[t] === undefined ? e[t] = n : e[t] += n, null;
  56187. },
  56188. k = function k(e, t, n) {
  56189. if (e === "l" || e === "t") return 0;
  56190. if (e === "c" || e === "m") return n / 2 - t / 2;
  56191. if (e === "r" || e === "b") return n - t;
  56192. throw "Invalid alignment";
  56193. },
  56194. L = function L(e) {
  56195. return L.e = L.e || x("div"), L.e.text(e).html();
  56196. };
  56197. A.prototype.loadHTML = function () {
  56198. var t;
  56199. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56200. }, A.prototype.show = function (e, t) {
  56201. var n, r, i, s, o;
  56202. r = function (n) {
  56203. return function () {
  56204. !e && !n.elem && n.destroy();
  56205. if (t) return t();
  56206. };
  56207. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56208. if (o && e) s = "show";else if (o && !e) s = "hide";else if (!o && e) s = this.options.showAnimation, n.push(this.options.showDuration);else {
  56209. if (!!o || !!e) return r();
  56210. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56211. }
  56212. return n.push(r), i[s].apply(i, n);
  56213. }, A.prototype.setGlobalPosition = function () {
  56214. var t = this.getPosition(),
  56215. n = t[0],
  56216. i = t[1],
  56217. o = s[n],
  56218. u = s[i],
  56219. a = n + "|" + i,
  56220. f = T[a];
  56221. if (!f || !document.body.contains(f[0])) {
  56222. f = T[a] = x("div");
  56223. var l = {};
  56224. l[o] = 0, u === "middle" ? l.top = "45%" : u === "center" ? l.left = "45%" : l[u] = 0, f.css(l).addClass(r + "-corner"), e("body").append(f);
  56225. }
  56226. return f.prepend(this.wrapper);
  56227. }, A.prototype.setElementPosition = function () {
  56228. var n, r, i, l, c, h, p, d, v, m, g, y, b, w, E, S, x, T, N, L, A, O, M, _, D, P, H, B, j;
  56229. H = this.getPosition(), _ = H[0], O = H[1], M = H[2], g = this.elem.position(), d = this.elem.outerHeight(), y = this.elem.outerWidth(), v = this.elem.innerHeight(), m = this.elem.innerWidth(), j = this.wrapper.position(), c = this.container.height(), h = this.container.width(), T = s[_], L = f[_], A = s[L], p = {}, p[A] = _ === "b" ? d : _ === "r" ? y : 0, C(p, "top", g.top - j.top), C(p, "left", g.left - j.left), B = ["top", "left"];
  56230. for (w = 0, S = B.length; w < S; w++) {
  56231. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56232. }
  56233. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56234. if (!this.options.arrowShow) this.arrow.hide();else {
  56235. i = this.options.arrowSize, r = e.extend({}, p), n = this.userContainer.css("border-color") || this.userContainer.css("border-top-color") || this.userContainer.css("background-color") || "white";
  56236. for (E = 0, x = a.length; E < x; E++) {
  56237. D = a[E], P = s[D];
  56238. if (D === L) continue;
  56239. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56240. }
  56241. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56242. }
  56243. t.call(u, _) >= 0 ? (C(p, "left", k(O, h, y)), r && C(r, "left", k(O, i, m))) : t.call(o, _) >= 0 && (C(p, "top", k(O, c, d)), r && C(r, "top", k(O, i, v))), this.container.is(":visible") && (p.display = "block"), this.container.removeAttr("style").css(p);
  56244. if (r) return this.arrow.removeAttr("style").css(r);
  56245. }, A.prototype.getPosition = function () {
  56246. var e, n, r, i, s, f, c, h;
  56247. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56248. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56249. if (e.length === 1 || (r = e[0], t.call(u, r) >= 0) && (i = e[1], t.call(o, i) < 0) || (s = e[0], t.call(o, s) >= 0) && (f = e[1], t.call(u, f) < 0)) e[1] = (c = e[0], t.call(o, c) >= 0) ? "m" : "l";
  56250. return e.length === 2 && (e[2] = e[1]), e;
  56251. }, A.prototype.getStyle = function (e) {
  56252. var t;
  56253. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56254. if (!t) throw "Missing style: " + e;
  56255. return t;
  56256. }, A.prototype.updateClasses = function () {
  56257. var t, n;
  56258. return t = ["base"], e.isArray(this.options.className) ? t = t.concat(this.options.className) : this.options.className && t.push(this.options.className), n = this.getStyle(), t = e.map(t, function (e) {
  56259. return r + "-" + n.name + "-" + e;
  56260. }).join(" "), this.userContainer.attr("class", t);
  56261. }, A.prototype.run = function (t, n) {
  56262. var r, s, o, u, a;
  56263. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56264. if (this.container && !t) {
  56265. this.show(!1);
  56266. return;
  56267. }
  56268. if (!this.container && !t) return;
  56269. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56270. for (o in s) {
  56271. r = s[o], u = this.userFields[o];
  56272. if (!u) continue;
  56273. u === "text" && (r = L(r), this.options.breakNewLines && (r = r.replace(/\n/g, "<br/>"))), a = o === i ? "" : "=" + o, b(this.userContainer, "[data-notify-" + u + a + "]").html(r);
  56274. }
  56275. this.updateClasses(), this.elem ? this.setElementPosition() : this.setGlobalPosition(), this.show(!0), this.options.autoHide && (clearTimeout(this.autohideTimer), this.autohideTimer = setTimeout(this.show.bind(this, !1), this.options.autoHideDelay));
  56276. }, A.prototype.destroy = function () {
  56277. this.wrapper.data(r, null), this.wrapper.remove();
  56278. }, e[n] = function (t, r, i) {
  56279. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56280. }, e.fn[n] = function (t, n) {
  56281. return e(this).each(function () {
  56282. var i = N(e(this)).data(r);
  56283. i && i.destroy();
  56284. var s = new A(e(this), t, n);
  56285. }), this;
  56286. }, e.extend(e[n], {
  56287. defaults: S,
  56288. addStyle: m,
  56289. removeStyle: v,
  56290. pluginOptions: w,
  56291. getStyle: d,
  56292. insertCSS: g
  56293. }), m("bootstrap", {
  56294. html: "<div>\n<span data-notify-text></span>\n</div>",
  56295. classes: {
  56296. base: {
  56297. "font-weight": "bold",
  56298. padding: "8px 15px 8px 14px",
  56299. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56300. "background-color": "#fcf8e3",
  56301. border: "1px solid #fbeed5",
  56302. "border-radius": "4px",
  56303. "white-space": "nowrap",
  56304. "padding-left": "25px",
  56305. "background-repeat": "no-repeat",
  56306. "background-position": "3px 7px"
  56307. },
  56308. error: {
  56309. color: "#B94A48",
  56310. "background-color": "#F2DEDE",
  56311. "border-color": "#EED3D7",
  56312. "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAtRJREFUeNqkVc1u00AQHq+dOD+0poIQfkIjalW0SEGqRMuRnHos3DjwAH0ArlyQeANOOSMeAA5VjyBxKBQhgSpVUKKQNGloFdw4cWw2jtfMOna6JOUArDTazXi/b3dm55socPqQhFka++aHBsI8GsopRJERNFlY88FCEk9Yiwf8RhgRyaHFQpPHCDmZG5oX2ui2yilkcTT1AcDsbYC1NMAyOi7zTX2Agx7A9luAl88BauiiQ/cJaZQfIpAlngDcvZZMrl8vFPK5+XktrWlx3/ehZ5r9+t6e+WVnp1pxnNIjgBe4/6dAysQc8dsmHwPcW9C0h3fW1hans1ltwJhy0GxK7XZbUlMp5Ww2eyan6+ft/f2FAqXGK4CvQk5HueFz7D6GOZtIrK+srupdx1GRBBqNBtzc2AiMr7nPplRdKhb1q6q6zjFhrklEFOUutoQ50xcX86ZlqaZpQrfbBdu2R6/G19zX6XSgh6RX5ubyHCM8nqSID6ICrGiZjGYYxojEsiw4PDwMSL5VKsC8Yf4VRYFzMzMaxwjlJSlCyAQ9l0CW44PBADzXhe7xMdi9HtTrdYjFYkDQL0cn4Xdq2/EAE+InCnvADTf2eah4Sx9vExQjkqXT6aAERICMewd/UAp/IeYANM2joxt+q5VI+ieq2i0Wg3l6DNzHwTERPgo1ko7XBXj3vdlsT2F+UuhIhYkp7u7CarkcrFOCtR3H5JiwbAIeImjT/YQKKBtGjRFCU5IUgFRe7fF4cCNVIPMYo3VKqxwjyNAXNepuopyqnld602qVsfRpEkkz+GFL1wPj6ySXBpJtWVa5xlhpcyhBNwpZHmtX8AGgfIExo0ZpzkWVTBGiXCSEaHh62/PoR0p/vHaczxXGnj4bSo+G78lELU80h1uogBwWLf5YlsPmgDEd4M236xjm+8nm4IuE/9u+/PH2JXZfbwz4zw1WbO+SQPpXfwG/BBgAhCNZiSb/pOQAAAAASUVORK5CYII=)"
  56313. },
  56314. success: {
  56315. color: "#468847",
  56316. "background-color": "#DFF0D8",
  56317. "border-color": "#D6E9C6",
  56318. "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAutJREFUeNq0lctPE0Ecx38zu/RFS1EryqtgJFA08YCiMZIAQQ4eRG8eDGdPJiYeTIwHTfwPiAcvXIwXLwoXPaDxkWgQ6islKlJLSQWLUraPLTv7Gme32zoF9KSTfLO7v53vZ3d/M7/fIth+IO6INt2jjoA7bjHCJoAlzCRw59YwHYjBnfMPqAKWQYKjGkfCJqAF0xwZjipQtA3MxeSG87VhOOYegVrUCy7UZM9S6TLIdAamySTclZdYhFhRHloGYg7mgZv1Zzztvgud7V1tbQ2twYA34LJmF4p5dXF1KTufnE+SxeJtuCZNsLDCQU0+RyKTF27Unw101l8e6hns3u0PBalORVVVkcaEKBJDgV3+cGM4tKKmI+ohlIGnygKX00rSBfszz/n2uXv81wd6+rt1orsZCHRdr1Imk2F2Kob3hutSxW8thsd8AXNaln9D7CTfA6O+0UgkMuwVvEFFUbbAcrkcTA8+AtOk8E6KiQiDmMFSDqZItAzEVQviRkdDdaFgPp8HSZKAEAL5Qh7Sq2lIJBJwv2scUqkUnKoZgNhcDKhKg5aH+1IkcouCAdFGAQsuWZYhOjwFHQ96oagWgRoUov1T9kRBEODAwxM2QtEUl+Wp+Ln9VRo6BcMw4ErHRYjH4/B26AlQoQQTRdHWwcd9AH57+UAXddvDD37DmrBBV34WfqiXPl61g+vr6xA9zsGeM9gOdsNXkgpEtTwVvwOklXLKm6+/p5ezwk4B+j6droBs2CsGa/gNs6RIxazl4Tc25mpTgw/apPR1LYlNRFAzgsOxkyXYLIM1V8NMwyAkJSctD1eGVKiq5wWjSPdjmeTkiKvVW4f2YPHWl3GAVq6ymcyCTgovM3FzyRiDe2TaKcEKsLpJvNHjZgPNqEtyi6mZIm4SRFyLMUsONSSdkPeFtY1n0mczoY3BHTLhwPRy9/lzcziCw9ACI+yql0VLzcGAZbYSM5CCSZg1/9oc/nn7+i8N9p/8An4JMADxhH+xHfuiKwAAAABJRU5ErkJggg==)"
  56319. },
  56320. info: {
  56321. color: "#3A87AD",
  56322. "background-color": "#D9EDF7",
  56323. "border-color": "#BCE8F1",
  56324. "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QYFAhkSsdes/QAAA8dJREFUOMvVlGtMW2UYx//POaWHXg6lLaW0ypAtw1UCgbniNOLcVOLmAjHZolOYlxmTGXVZdAnRfXQm+7SoU4mXaOaiZsEpC9FkiQs6Z6bdCnNYruM6KNBw6YWewzl9z+sHImEWv+vz7XmT95f/+3/+7wP814v+efDOV3/SoX3lHAA+6ODeUFfMfjOWMADgdk+eEKz0pF7aQdMAcOKLLjrcVMVX3xdWN29/GhYP7SvnP0cWfS8caSkfHZsPE9Fgnt02JNutQ0QYHB2dDz9/pKX8QjjuO9xUxd/66HdxTeCHZ3rojQObGQBcuNjfplkD3b19Y/6MrimSaKgSMmpGU5WevmE/swa6Oy73tQHA0Rdr2Mmv/6A1n9w9suQ7097Z9lM4FlTgTDrzZTu4StXVfpiI48rVcUDM5cmEksrFnHxfpTtU/3BFQzCQF/2bYVoNbH7zmItbSoMj40JSzmMyX5qDvriA7QdrIIpA+3cdsMpu0nXI8cV0MtKXCPZev+gCEM1S2NHPvWfP/hL+7FSr3+0p5RBEyhEN5JCKYr8XnASMT0xBNyzQGQeI8fjsGD39RMPk7se2bd5ZtTyoFYXftF6y37gx7NeUtJJOTFlAHDZLDuILU3j3+H5oOrD3yWbIztugaAzgnBKJuBLpGfQrS8wO4FZgV+c1IxaLgWVU0tMLEETCos4xMzEIv9cJXQcyagIwigDGwJgOAtHAwAhisQUjy0ORGERiELgG4iakkzo4MYAxcM5hAMi1WWG1yYCJIcMUaBkVRLdGeSU2995TLWzcUAzONJ7J6FBVBYIggMzmFbvdBV44Corg8vjhzC+EJEl8U1kJtgYrhCzgc/vvTwXKSib1paRFVRVORDAJAsw5FuTaJEhWM2SHB3mOAlhkNxwuLzeJsGwqWzf5TFNdKgtY5qHp6ZFf67Y/sAVadCaVY5YACDDb3Oi4NIjLnWMw2QthCBIsVhsUTU9tvXsjeq9+X1d75/KEs4LNOfcdf/+HthMnvwxOD0wmHaXr7ZItn2wuH2SnBzbZAbPJwpPx+VQuzcm7dgRCB57a1uBzUDRL4bfnI0RE0eaXd9W89mpjqHZnUI5Hh2l2dkZZUhOqpi2qSmpOmZ64Tuu9qlz/SEXo6MEHa3wOip46F1n7633eekV8ds8Wxjn37Wl63VVa+ej5oeEZ/82ZBETJjpJ1Rbij2D3Z/1trXUvLsblCK0XfOx0SX2kMsn9dX+d+7Kf6h8o4AIykuffjT8L20LU+w4AZd5VvEPY+XpWqLV327HR7DzXuDnD8r+ovkBehJ8i+y8YAAAAASUVORK5CYII=)"
  56325. },
  56326. warn: {
  56327. color: "#C09853",
  56328. "background-color": "#FCF8E3",
  56329. "border-color": "#FBEED5",
  56330. "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABJlBMVEXr6eb/2oD/wi7/xjr/0mP/ykf/tQD/vBj/3o7/uQ//vyL/twebhgD/4pzX1K3z8e349vK6tHCilCWbiQymn0jGworr6dXQza3HxcKkn1vWvV/5uRfk4dXZ1bD18+/52YebiAmyr5S9mhCzrWq5t6ufjRH54aLs0oS+qD751XqPhAybhwXsujG3sm+Zk0PTwG6Shg+PhhObhwOPgQL4zV2nlyrf27uLfgCPhRHu7OmLgAafkyiWkD3l49ibiAfTs0C+lgCniwD4sgDJxqOilzDWowWFfAH08uebig6qpFHBvH/aw26FfQTQzsvy8OyEfz20r3jAvaKbhgG9q0nc2LbZxXanoUu/u5WSggCtp1anpJKdmFz/zlX/1nGJiYmuq5Dx7+sAAADoPUZSAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfdBgUBGhh4aah5AAAAlklEQVQY02NgoBIIE8EUcwn1FkIXM1Tj5dDUQhPU502Mi7XXQxGz5uVIjGOJUUUW81HnYEyMi2HVcUOICQZzMMYmxrEyMylJwgUt5BljWRLjmJm4pI1hYp5SQLGYxDgmLnZOVxuooClIDKgXKMbN5ggV1ACLJcaBxNgcoiGCBiZwdWxOETBDrTyEFey0jYJ4eHjMGWgEAIpRFRCUt08qAAAAAElFTkSuQmCC)"
  56331. }
  56332. }
  56333. }), e(function () {
  56334. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56335. e(this).trigger("notify-hide");
  56336. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56337. var n = e(this).data(r);
  56338. n && n.show(!1);
  56339. });
  56340. });
  56341. });
  56342. /***/ }),
  56343. /***/ "./resources/sass/app.scss":
  56344. /*!*********************************!*\
  56345. !*** ./resources/sass/app.scss ***!
  56346. \*********************************/
  56347. /*! no static exports found */
  56348. /***/ (function(module, exports) {
  56349. // removed by extract-text-webpack-plugin
  56350. /***/ }),
  56351. /***/ 0:
  56352. /*!*************************************************************!*\
  56353. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56354. \*************************************************************/
  56355. /*! no static exports found */
  56356. /***/ (function(module, exports, __webpack_require__) {
  56357. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56358. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56359. /***/ })
  56360. /******/ });