app.js 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  1574. /*!***************************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  1576. \***************************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  1604. /*!********************************************************************************************************************************************************************!*\
  1605. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  1606. \********************************************************************************************************************************************************************/
  1607. /*! exports provided: default */
  1608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1609. "use strict";
  1610. __webpack_require__.r(__webpack_exports__);
  1611. //
  1612. //
  1613. //
  1614. //
  1615. //
  1616. //
  1617. //
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. props: ['asset', 'pcextraStart'],
  1669. data: function data() {
  1670. return {
  1671. data: JSON.parse(this.asset),
  1672. pcextra: JSON.parse(this.pcextraStart)
  1673. };
  1674. },
  1675. mounted: function mounted() {
  1676. var _this = this;
  1677. Echo.channel('assets').listen('AssetUpdated', function (e) {
  1678. _this.data = JSON.parse(e.data);
  1679. _this.pcextra = JSON.parse(e.pcextra);
  1680. });
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. this.data.pcextra = this.pcextra;
  1685. axios.put('/api/assets/' + this.data.pcid, this.data).then(function (response) {})["catch"](function (error) {});
  1686. $('#asseteditModal').modal('hide');
  1687. }
  1688. }
  1689. });
  1690. /***/ }),
  1691. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  1692. /*!***************************************************************************************************************************************************************************************!*\
  1693. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  1694. \***************************************************************************************************************************************************************************************/
  1695. /*! exports provided: default */
  1696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1697. "use strict";
  1698. __webpack_require__.r(__webpack_exports__);
  1699. //
  1700. //
  1701. //
  1702. //
  1703. //
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. /* harmony default export */ __webpack_exports__["default"] = ({
  1721. props: {
  1722. value: null,
  1723. // An object with the following format
  1724. // {
  1725. // key: value,
  1726. // key: value,
  1727. // }
  1728. options: {
  1729. type: Object,
  1730. required: true
  1731. },
  1732. allowCustom: {
  1733. type: Boolean,
  1734. "default": false
  1735. }
  1736. },
  1737. data: function data() {
  1738. return {
  1739. searchText: '',
  1740. selectedOption: null,
  1741. open: false,
  1742. // allows for checking whether button was clicked or text was typed.
  1743. // If button was clicked, we show all options without having to clear
  1744. // out any searchText that was autofilled when page loaded.
  1745. isSearching: false
  1746. };
  1747. },
  1748. computed: {
  1749. matches: function matches() {
  1750. var _this = this;
  1751. // If button was clicked, show all options, if typing, filter
  1752. // options based on searchText
  1753. return Object.entries(this.options).filter(function (option) {
  1754. var optionText = option[1].toUpperCase();
  1755. if (_this.isSearching) {
  1756. return optionText.match(_this.searchText.toUpperCase());
  1757. } else {
  1758. return optionText.match('');
  1759. }
  1760. });
  1761. }
  1762. },
  1763. methods: {
  1764. // if button is clicked, show all options
  1765. setOpen: function setOpen(isOpen) {
  1766. this.open = isOpen;
  1767. this.isSearching = false;
  1768. },
  1769. // if typing in the box, start filtering options
  1770. searchChanged: function searchChanged() {
  1771. if (!this.open) {
  1772. this.open = true;
  1773. }
  1774. if (!this.isSearching) {
  1775. this.isSearching = true;
  1776. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1777. if (this.allowCustom) {
  1778. this.$emit('input', {
  1779. 'id': 'custom',
  1780. 'name': this.searchText
  1781. });
  1782. }
  1783. },
  1784. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1785. // a suggestion is selected
  1786. suggestionSelected: function suggestionSelected(suggestion) {
  1787. this.open = false;
  1788. this.searchText = suggestion[1];
  1789. this.$emit('input', {
  1790. 'id': suggestion[0],
  1791. 'name': suggestion[1]
  1792. });
  1793. },
  1794. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1795. if (this.allowCustom) {
  1796. this.searchText = this.value.name;
  1797. } else {
  1798. if (newValue.id > -1) {
  1799. // Find the matching text for the supplied option value
  1800. for (var id in this.options) {
  1801. if (this.options.hasOwnProperty(id)) {
  1802. if (this.options[id] === this.options[newValue.id]) {
  1803. this.searchText = this.options[id];
  1804. }
  1805. }
  1806. }
  1807. }
  1808. }
  1809. }
  1810. },
  1811. mounted: function mounted() {
  1812. this.updateComponentWithValue(this.value);
  1813. },
  1814. watch: {
  1815. value: function value(newValue) {
  1816. this.updateComponentWithValue(newValue);
  1817. }
  1818. }
  1819. });
  1820. /***/ }),
  1821. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  1822. /*!********************************************************************************************************************************************************************************!*\
  1823. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  1824. \********************************************************************************************************************************************************************************/
  1825. /*! exports provided: default */
  1826. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1827. "use strict";
  1828. __webpack_require__.r(__webpack_exports__);
  1829. //
  1830. //
  1831. //
  1832. //
  1833. //
  1834. //
  1835. //
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. //
  1844. //
  1845. //
  1846. //
  1847. //
  1848. //
  1849. //
  1850. //
  1851. //
  1852. //
  1853. //
  1854. //
  1855. /* harmony default export */ __webpack_exports__["default"] = ({
  1856. props: ['populateWith', 'modalId', 'descriptions'],
  1857. data: function data() {
  1858. return {
  1859. data: JSON.parse(JSON.stringify(this.populateWith)),
  1860. creddesc: {},
  1861. id: this.modalId,
  1862. errors: []
  1863. };
  1864. },
  1865. mounted: function mounted() {
  1866. // Definitely needs to be refactored into something that runs once
  1867. // per page instead of once per credential. Only putting this here now
  1868. // to test something else.
  1869. this.creddesc = {
  1870. 'id': this.data.credtype,
  1871. 'name': this.data.creddesc
  1872. };
  1873. },
  1874. methods: {
  1875. rndStr: function rndStr(len) {
  1876. var text = "";
  1877. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1878. for (var i = 0; i < len; i++) {
  1879. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1880. }
  1881. return text;
  1882. },
  1883. getRandomPassword: function getRandomPassword(id) {
  1884. this.data.credpass = this.rndStr(16);
  1885. },
  1886. updateCredential: function updateCredential() {
  1887. console.log(this.creddesc);
  1888. if (this.creddesc.id === "custom") {
  1889. this.data.credtype = 1;
  1890. this.data.creddesc = this.creddesc.name;
  1891. } else {
  1892. this.data.credtype = this.creddesc.id;
  1893. this.data.creddesc = this.creddesc.name;
  1894. }
  1895. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {})["catch"](function (error) {
  1896. console.error(error);
  1897. });
  1898. $('#credential' + this.data.credid + 'editModal').modal('hide');
  1899. }
  1900. }
  1901. });
  1902. /***/ }),
  1903. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  1904. /*!*********************************************************************************************************************************************************************!*\
  1905. !*** ./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& ***!
  1906. \*********************************************************************************************************************************************************************/
  1907. /*! exports provided: default */
  1908. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1909. "use strict";
  1910. __webpack_require__.r(__webpack_exports__);
  1911. //
  1912. //
  1913. //
  1914. //
  1915. //
  1916. //
  1917. //
  1918. //
  1919. //
  1920. //
  1921. //
  1922. //
  1923. //
  1924. //
  1925. //
  1926. //
  1927. //
  1928. //
  1929. //
  1930. //
  1931. //
  1932. //
  1933. //
  1934. //
  1935. //
  1936. //
  1937. //
  1938. //
  1939. //
  1940. //
  1941. //
  1942. /* harmony default export */ __webpack_exports__["default"] = ({
  1943. props: ['credential', 'descriptions'],
  1944. data: function data() {
  1945. return {
  1946. data: JSON.parse(this.credential)
  1947. };
  1948. },
  1949. computed: {
  1950. creddescList: function creddescList() {
  1951. var list = {};
  1952. JSON.parse(this.descriptions).map(function (val) {
  1953. list[val.creddescid] = val.credtitle;
  1954. });
  1955. return list;
  1956. }
  1957. },
  1958. mounted: function mounted() {
  1959. var _this = this;
  1960. Echo.channel('credentials').listen('CredentialUpdated', function (e) {
  1961. // This part could potentially use a refactor.
  1962. // Probably needs a credential list component to listen for this
  1963. // even and update the corresponding credential. Currently every
  1964. // credential on the page receives this event and checks whether it was intended
  1965. // for its credential or not. I would imagine this could cause a problem
  1966. // on the group page, which will potentially have a lot more credentials from
  1967. // various assets. Better solution may be to have a credentials list component
  1968. // That listens for credential update events and updates the appropriate credential.
  1969. // There would still be multiples of those on the group credentials page, but an
  1970. // order of magnitude less of those than of individual credentials.
  1971. // It also may not be a big deal performance wise to do it like this, not sure.
  1972. var eData = JSON.parse(e.data);
  1973. if (_this.data.credid === eData.credid) {
  1974. _this.data = eData;
  1975. }
  1976. });
  1977. }
  1978. });
  1979. /***/ }),
  1980. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  1981. /*!********************************************************************************************************************************************************************!*\
  1982. !*** ./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& ***!
  1983. \********************************************************************************************************************************************************************/
  1984. /*! exports provided: default */
  1985. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1986. "use strict";
  1987. __webpack_require__.r(__webpack_exports__);
  1988. //
  1989. //
  1990. //
  1991. //
  1992. //
  1993. /* harmony default export */ __webpack_exports__["default"] = ({
  1994. props: ['errors'],
  1995. data: function data() {
  1996. return {
  1997. errorList: this.errors
  1998. };
  1999. },
  2000. watch: {
  2001. errors: function errors(newErrors) {
  2002. this.errorList = newErrors;
  2003. }
  2004. }
  2005. });
  2006. /***/ }),
  2007. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2008. /*!****************************************************************************************************************************************************************!*\
  2009. !*** ./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& ***!
  2010. \****************************************************************************************************************************************************************/
  2011. /*! exports provided: default */
  2012. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2013. "use strict";
  2014. __webpack_require__.r(__webpack_exports__);
  2015. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  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. //
  2051. //
  2052. //
  2053. //
  2054. //
  2055. /* harmony default export */ __webpack_exports__["default"] = ({
  2056. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2057. props: ['initialnotes', 'authusername'],
  2058. data: function data() {
  2059. return {
  2060. notes: this.initialnotes
  2061. };
  2062. }
  2063. });
  2064. /***/ }),
  2065. /***/ "./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&":
  2066. /*!****************************************************************************************************************************************************************************!*\
  2067. !*** ./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& ***!
  2068. \****************************************************************************************************************************************************************************/
  2069. /*! exports provided: default */
  2070. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2071. "use strict";
  2072. __webpack_require__.r(__webpack_exports__);
  2073. //
  2074. //
  2075. //
  2076. //
  2077. //
  2078. //
  2079. //
  2080. //
  2081. //
  2082. //
  2083. //
  2084. //
  2085. //
  2086. //
  2087. //
  2088. //
  2089. //
  2090. //
  2091. //
  2092. //
  2093. //
  2094. //
  2095. //
  2096. //
  2097. //
  2098. //
  2099. //
  2100. //
  2101. //
  2102. //
  2103. //
  2104. //
  2105. //
  2106. /* harmony default export */ __webpack_exports__["default"] = ({
  2107. props: ['populateWith', 'storeList', 'modalId'],
  2108. data: function data() {
  2109. return {
  2110. // Copies object from prop, so it doesn't mutate the object
  2111. // from the parent component. Parent component will be updated via
  2112. // Websocket if updateWorkOrder is successful.
  2113. data: JSON.parse(JSON.stringify(this.populateWith)),
  2114. id: this.modalId,
  2115. store: {},
  2116. errors: []
  2117. };
  2118. },
  2119. mounted: function mounted() {
  2120. this.store = {
  2121. 'id': this.data.storeid,
  2122. 'name': this.storeList[this.data.storeid]
  2123. };
  2124. },
  2125. methods: {
  2126. updateWorkOrder: function updateWorkOrder() {
  2127. var _this = this;
  2128. this.data.storeid = this.store.id;
  2129. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2130. $('#workordereditModal').modal('hide');
  2131. })["catch"](function (error) {
  2132. _this.errors = JSON.parse(error.response.request.response).errors;
  2133. });
  2134. }
  2135. }
  2136. });
  2137. /***/ }),
  2138. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2139. /*!*****************************************************************************************************************************************************************!*\
  2140. !*** ./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& ***!
  2141. \*****************************************************************************************************************************************************************/
  2142. /*! exports provided: default */
  2143. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2144. "use strict";
  2145. __webpack_require__.r(__webpack_exports__);
  2146. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. //
  2156. //
  2157. //
  2158. //
  2159. //
  2160. //
  2161. //
  2162. //
  2163. //
  2164. //
  2165. //
  2166. //
  2167. /* harmony default export */ __webpack_exports__["default"] = ({
  2168. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2169. props: ['workOrder', 'stores'],
  2170. data: function data() {
  2171. return {
  2172. data: JSON.parse(this.workOrder)
  2173. };
  2174. },
  2175. computed: {
  2176. storeList: function storeList() {
  2177. var list = {};
  2178. JSON.parse(this.stores).map(function (val) {
  2179. list[val.storeid] = val.storesname;
  2180. });
  2181. return list;
  2182. }
  2183. },
  2184. mounted: function mounted() {
  2185. var _this = this;
  2186. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  2187. _this.data = JSON.parse(e.data);
  2188. });
  2189. }
  2190. });
  2191. /***/ }),
  2192. /***/ "./node_modules/base64-js/index.js":
  2193. /*!*****************************************!*\
  2194. !*** ./node_modules/base64-js/index.js ***!
  2195. \*****************************************/
  2196. /*! no static exports found */
  2197. /***/ (function(module, exports, __webpack_require__) {
  2198. "use strict";
  2199. exports.byteLength = byteLength
  2200. exports.toByteArray = toByteArray
  2201. exports.fromByteArray = fromByteArray
  2202. var lookup = []
  2203. var revLookup = []
  2204. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2205. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2206. for (var i = 0, len = code.length; i < len; ++i) {
  2207. lookup[i] = code[i]
  2208. revLookup[code.charCodeAt(i)] = i
  2209. }
  2210. // Support decoding URL-safe base64 strings, as Node.js does.
  2211. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2212. revLookup['-'.charCodeAt(0)] = 62
  2213. revLookup['_'.charCodeAt(0)] = 63
  2214. function getLens (b64) {
  2215. var len = b64.length
  2216. if (len % 4 > 0) {
  2217. throw new Error('Invalid string. Length must be a multiple of 4')
  2218. }
  2219. // Trim off extra bytes after placeholder bytes are found
  2220. // See: https://github.com/beatgammit/base64-js/issues/42
  2221. var validLen = b64.indexOf('=')
  2222. if (validLen === -1) validLen = len
  2223. var placeHoldersLen = validLen === len
  2224. ? 0
  2225. : 4 - (validLen % 4)
  2226. return [validLen, placeHoldersLen]
  2227. }
  2228. // base64 is 4/3 + up to two characters of the original data
  2229. function byteLength (b64) {
  2230. var lens = getLens(b64)
  2231. var validLen = lens[0]
  2232. var placeHoldersLen = lens[1]
  2233. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2234. }
  2235. function _byteLength (b64, validLen, placeHoldersLen) {
  2236. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2237. }
  2238. function toByteArray (b64) {
  2239. var tmp
  2240. var lens = getLens(b64)
  2241. var validLen = lens[0]
  2242. var placeHoldersLen = lens[1]
  2243. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2244. var curByte = 0
  2245. // if there are placeholders, only get up to the last complete 4 chars
  2246. var len = placeHoldersLen > 0
  2247. ? validLen - 4
  2248. : validLen
  2249. var i
  2250. for (i = 0; i < len; i += 4) {
  2251. tmp =
  2252. (revLookup[b64.charCodeAt(i)] << 18) |
  2253. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2254. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2255. revLookup[b64.charCodeAt(i + 3)]
  2256. arr[curByte++] = (tmp >> 16) & 0xFF
  2257. arr[curByte++] = (tmp >> 8) & 0xFF
  2258. arr[curByte++] = tmp & 0xFF
  2259. }
  2260. if (placeHoldersLen === 2) {
  2261. tmp =
  2262. (revLookup[b64.charCodeAt(i)] << 2) |
  2263. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2264. arr[curByte++] = tmp & 0xFF
  2265. }
  2266. if (placeHoldersLen === 1) {
  2267. tmp =
  2268. (revLookup[b64.charCodeAt(i)] << 10) |
  2269. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2270. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2271. arr[curByte++] = (tmp >> 8) & 0xFF
  2272. arr[curByte++] = tmp & 0xFF
  2273. }
  2274. return arr
  2275. }
  2276. function tripletToBase64 (num) {
  2277. return lookup[num >> 18 & 0x3F] +
  2278. lookup[num >> 12 & 0x3F] +
  2279. lookup[num >> 6 & 0x3F] +
  2280. lookup[num & 0x3F]
  2281. }
  2282. function encodeChunk (uint8, start, end) {
  2283. var tmp
  2284. var output = []
  2285. for (var i = start; i < end; i += 3) {
  2286. tmp =
  2287. ((uint8[i] << 16) & 0xFF0000) +
  2288. ((uint8[i + 1] << 8) & 0xFF00) +
  2289. (uint8[i + 2] & 0xFF)
  2290. output.push(tripletToBase64(tmp))
  2291. }
  2292. return output.join('')
  2293. }
  2294. function fromByteArray (uint8) {
  2295. var tmp
  2296. var len = uint8.length
  2297. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2298. var parts = []
  2299. var maxChunkLength = 16383 // must be multiple of 3
  2300. // go through the array every three bytes, we'll deal with trailing stuff later
  2301. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2302. parts.push(encodeChunk(
  2303. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2304. ))
  2305. }
  2306. // pad the end with zeros, but make sure to not forget the extra bytes
  2307. if (extraBytes === 1) {
  2308. tmp = uint8[len - 1]
  2309. parts.push(
  2310. lookup[tmp >> 2] +
  2311. lookup[(tmp << 4) & 0x3F] +
  2312. '=='
  2313. )
  2314. } else if (extraBytes === 2) {
  2315. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2316. parts.push(
  2317. lookup[tmp >> 10] +
  2318. lookup[(tmp >> 4) & 0x3F] +
  2319. lookup[(tmp << 2) & 0x3F] +
  2320. '='
  2321. )
  2322. }
  2323. return parts.join('')
  2324. }
  2325. /***/ }),
  2326. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2327. /*!*****************************************************!*\
  2328. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2329. \*****************************************************/
  2330. /*! no static exports found */
  2331. /***/ (function(module, exports, __webpack_require__) {
  2332. /*!
  2333. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2334. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2335. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2336. */
  2337. (function (global, factory) {
  2338. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2339. undefined;
  2340. }(this, (function (exports, $, Popper) { 'use strict';
  2341. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2342. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2343. function _defineProperties(target, props) {
  2344. for (var i = 0; i < props.length; i++) {
  2345. var descriptor = props[i];
  2346. descriptor.enumerable = descriptor.enumerable || false;
  2347. descriptor.configurable = true;
  2348. if ("value" in descriptor) descriptor.writable = true;
  2349. Object.defineProperty(target, descriptor.key, descriptor);
  2350. }
  2351. }
  2352. function _createClass(Constructor, protoProps, staticProps) {
  2353. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2354. if (staticProps) _defineProperties(Constructor, staticProps);
  2355. return Constructor;
  2356. }
  2357. function _defineProperty(obj, key, value) {
  2358. if (key in obj) {
  2359. Object.defineProperty(obj, key, {
  2360. value: value,
  2361. enumerable: true,
  2362. configurable: true,
  2363. writable: true
  2364. });
  2365. } else {
  2366. obj[key] = value;
  2367. }
  2368. return obj;
  2369. }
  2370. function ownKeys(object, enumerableOnly) {
  2371. var keys = Object.keys(object);
  2372. if (Object.getOwnPropertySymbols) {
  2373. var symbols = Object.getOwnPropertySymbols(object);
  2374. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2375. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2376. });
  2377. keys.push.apply(keys, symbols);
  2378. }
  2379. return keys;
  2380. }
  2381. function _objectSpread2(target) {
  2382. for (var i = 1; i < arguments.length; i++) {
  2383. var source = arguments[i] != null ? arguments[i] : {};
  2384. if (i % 2) {
  2385. ownKeys(Object(source), true).forEach(function (key) {
  2386. _defineProperty(target, key, source[key]);
  2387. });
  2388. } else if (Object.getOwnPropertyDescriptors) {
  2389. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2390. } else {
  2391. ownKeys(Object(source)).forEach(function (key) {
  2392. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2393. });
  2394. }
  2395. }
  2396. return target;
  2397. }
  2398. function _inheritsLoose(subClass, superClass) {
  2399. subClass.prototype = Object.create(superClass.prototype);
  2400. subClass.prototype.constructor = subClass;
  2401. subClass.__proto__ = superClass;
  2402. }
  2403. /**
  2404. * --------------------------------------------------------------------------
  2405. * Bootstrap (v4.4.1): util.js
  2406. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2407. * --------------------------------------------------------------------------
  2408. */
  2409. /**
  2410. * ------------------------------------------------------------------------
  2411. * Private TransitionEnd Helpers
  2412. * ------------------------------------------------------------------------
  2413. */
  2414. var TRANSITION_END = 'transitionend';
  2415. var MAX_UID = 1000000;
  2416. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2417. function toType(obj) {
  2418. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2419. }
  2420. function getSpecialTransitionEndEvent() {
  2421. return {
  2422. bindType: TRANSITION_END,
  2423. delegateType: TRANSITION_END,
  2424. handle: function handle(event) {
  2425. if ($(event.target).is(this)) {
  2426. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2427. }
  2428. return undefined; // eslint-disable-line no-undefined
  2429. }
  2430. };
  2431. }
  2432. function transitionEndEmulator(duration) {
  2433. var _this = this;
  2434. var called = false;
  2435. $(this).one(Util.TRANSITION_END, function () {
  2436. called = true;
  2437. });
  2438. setTimeout(function () {
  2439. if (!called) {
  2440. Util.triggerTransitionEnd(_this);
  2441. }
  2442. }, duration);
  2443. return this;
  2444. }
  2445. function setTransitionEndSupport() {
  2446. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2447. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2448. }
  2449. /**
  2450. * --------------------------------------------------------------------------
  2451. * Public Util Api
  2452. * --------------------------------------------------------------------------
  2453. */
  2454. var Util = {
  2455. TRANSITION_END: 'bsTransitionEnd',
  2456. getUID: function getUID(prefix) {
  2457. do {
  2458. // eslint-disable-next-line no-bitwise
  2459. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2460. } while (document.getElementById(prefix));
  2461. return prefix;
  2462. },
  2463. getSelectorFromElement: function getSelectorFromElement(element) {
  2464. var selector = element.getAttribute('data-target');
  2465. if (!selector || selector === '#') {
  2466. var hrefAttr = element.getAttribute('href');
  2467. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2468. }
  2469. try {
  2470. return document.querySelector(selector) ? selector : null;
  2471. } catch (err) {
  2472. return null;
  2473. }
  2474. },
  2475. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2476. if (!element) {
  2477. return 0;
  2478. } // Get transition-duration of the element
  2479. var transitionDuration = $(element).css('transition-duration');
  2480. var transitionDelay = $(element).css('transition-delay');
  2481. var floatTransitionDuration = parseFloat(transitionDuration);
  2482. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2483. if (!floatTransitionDuration && !floatTransitionDelay) {
  2484. return 0;
  2485. } // If multiple durations are defined, take the first
  2486. transitionDuration = transitionDuration.split(',')[0];
  2487. transitionDelay = transitionDelay.split(',')[0];
  2488. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2489. },
  2490. reflow: function reflow(element) {
  2491. return element.offsetHeight;
  2492. },
  2493. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2494. $(element).trigger(TRANSITION_END);
  2495. },
  2496. // TODO: Remove in v5
  2497. supportsTransitionEnd: function supportsTransitionEnd() {
  2498. return Boolean(TRANSITION_END);
  2499. },
  2500. isElement: function isElement(obj) {
  2501. return (obj[0] || obj).nodeType;
  2502. },
  2503. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2504. for (var property in configTypes) {
  2505. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2506. var expectedTypes = configTypes[property];
  2507. var value = config[property];
  2508. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2509. if (!new RegExp(expectedTypes).test(valueType)) {
  2510. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2511. }
  2512. }
  2513. }
  2514. },
  2515. findShadowRoot: function findShadowRoot(element) {
  2516. if (!document.documentElement.attachShadow) {
  2517. return null;
  2518. } // Can find the shadow root otherwise it'll return the document
  2519. if (typeof element.getRootNode === 'function') {
  2520. var root = element.getRootNode();
  2521. return root instanceof ShadowRoot ? root : null;
  2522. }
  2523. if (element instanceof ShadowRoot) {
  2524. return element;
  2525. } // when we don't find a shadow root
  2526. if (!element.parentNode) {
  2527. return null;
  2528. }
  2529. return Util.findShadowRoot(element.parentNode);
  2530. },
  2531. jQueryDetection: function jQueryDetection() {
  2532. if (typeof $ === 'undefined') {
  2533. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2534. }
  2535. var version = $.fn.jquery.split(' ')[0].split('.');
  2536. var minMajor = 1;
  2537. var ltMajor = 2;
  2538. var minMinor = 9;
  2539. var minPatch = 1;
  2540. var maxMajor = 4;
  2541. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2542. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2543. }
  2544. }
  2545. };
  2546. Util.jQueryDetection();
  2547. setTransitionEndSupport();
  2548. /**
  2549. * ------------------------------------------------------------------------
  2550. * Constants
  2551. * ------------------------------------------------------------------------
  2552. */
  2553. var NAME = 'alert';
  2554. var VERSION = '4.4.1';
  2555. var DATA_KEY = 'bs.alert';
  2556. var EVENT_KEY = "." + DATA_KEY;
  2557. var DATA_API_KEY = '.data-api';
  2558. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2559. var Selector = {
  2560. DISMISS: '[data-dismiss="alert"]'
  2561. };
  2562. var Event = {
  2563. CLOSE: "close" + EVENT_KEY,
  2564. CLOSED: "closed" + EVENT_KEY,
  2565. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2566. };
  2567. var ClassName = {
  2568. ALERT: 'alert',
  2569. FADE: 'fade',
  2570. SHOW: 'show'
  2571. };
  2572. /**
  2573. * ------------------------------------------------------------------------
  2574. * Class Definition
  2575. * ------------------------------------------------------------------------
  2576. */
  2577. var Alert =
  2578. /*#__PURE__*/
  2579. function () {
  2580. function Alert(element) {
  2581. this._element = element;
  2582. } // Getters
  2583. var _proto = Alert.prototype;
  2584. // Public
  2585. _proto.close = function close(element) {
  2586. var rootElement = this._element;
  2587. if (element) {
  2588. rootElement = this._getRootElement(element);
  2589. }
  2590. var customEvent = this._triggerCloseEvent(rootElement);
  2591. if (customEvent.isDefaultPrevented()) {
  2592. return;
  2593. }
  2594. this._removeElement(rootElement);
  2595. };
  2596. _proto.dispose = function dispose() {
  2597. $.removeData(this._element, DATA_KEY);
  2598. this._element = null;
  2599. } // Private
  2600. ;
  2601. _proto._getRootElement = function _getRootElement(element) {
  2602. var selector = Util.getSelectorFromElement(element);
  2603. var parent = false;
  2604. if (selector) {
  2605. parent = document.querySelector(selector);
  2606. }
  2607. if (!parent) {
  2608. parent = $(element).closest("." + ClassName.ALERT)[0];
  2609. }
  2610. return parent;
  2611. };
  2612. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2613. var closeEvent = $.Event(Event.CLOSE);
  2614. $(element).trigger(closeEvent);
  2615. return closeEvent;
  2616. };
  2617. _proto._removeElement = function _removeElement(element) {
  2618. var _this = this;
  2619. $(element).removeClass(ClassName.SHOW);
  2620. if (!$(element).hasClass(ClassName.FADE)) {
  2621. this._destroyElement(element);
  2622. return;
  2623. }
  2624. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2625. $(element).one(Util.TRANSITION_END, function (event) {
  2626. return _this._destroyElement(element, event);
  2627. }).emulateTransitionEnd(transitionDuration);
  2628. };
  2629. _proto._destroyElement = function _destroyElement(element) {
  2630. $(element).detach().trigger(Event.CLOSED).remove();
  2631. } // Static
  2632. ;
  2633. Alert._jQueryInterface = function _jQueryInterface(config) {
  2634. return this.each(function () {
  2635. var $element = $(this);
  2636. var data = $element.data(DATA_KEY);
  2637. if (!data) {
  2638. data = new Alert(this);
  2639. $element.data(DATA_KEY, data);
  2640. }
  2641. if (config === 'close') {
  2642. data[config](this);
  2643. }
  2644. });
  2645. };
  2646. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2647. return function (event) {
  2648. if (event) {
  2649. event.preventDefault();
  2650. }
  2651. alertInstance.close(this);
  2652. };
  2653. };
  2654. _createClass(Alert, null, [{
  2655. key: "VERSION",
  2656. get: function get() {
  2657. return VERSION;
  2658. }
  2659. }]);
  2660. return Alert;
  2661. }();
  2662. /**
  2663. * ------------------------------------------------------------------------
  2664. * Data Api implementation
  2665. * ------------------------------------------------------------------------
  2666. */
  2667. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2668. /**
  2669. * ------------------------------------------------------------------------
  2670. * jQuery
  2671. * ------------------------------------------------------------------------
  2672. */
  2673. $.fn[NAME] = Alert._jQueryInterface;
  2674. $.fn[NAME].Constructor = Alert;
  2675. $.fn[NAME].noConflict = function () {
  2676. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2677. return Alert._jQueryInterface;
  2678. };
  2679. /**
  2680. * ------------------------------------------------------------------------
  2681. * Constants
  2682. * ------------------------------------------------------------------------
  2683. */
  2684. var NAME$1 = 'button';
  2685. var VERSION$1 = '4.4.1';
  2686. var DATA_KEY$1 = 'bs.button';
  2687. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2688. var DATA_API_KEY$1 = '.data-api';
  2689. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2690. var ClassName$1 = {
  2691. ACTIVE: 'active',
  2692. BUTTON: 'btn',
  2693. FOCUS: 'focus'
  2694. };
  2695. var Selector$1 = {
  2696. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2697. DATA_TOGGLES: '[data-toggle="buttons"]',
  2698. DATA_TOGGLE: '[data-toggle="button"]',
  2699. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2700. INPUT: 'input:not([type="hidden"])',
  2701. ACTIVE: '.active',
  2702. BUTTON: '.btn'
  2703. };
  2704. var Event$1 = {
  2705. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2706. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2707. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2708. };
  2709. /**
  2710. * ------------------------------------------------------------------------
  2711. * Class Definition
  2712. * ------------------------------------------------------------------------
  2713. */
  2714. var Button =
  2715. /*#__PURE__*/
  2716. function () {
  2717. function Button(element) {
  2718. this._element = element;
  2719. } // Getters
  2720. var _proto = Button.prototype;
  2721. // Public
  2722. _proto.toggle = function toggle() {
  2723. var triggerChangeEvent = true;
  2724. var addAriaPressed = true;
  2725. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2726. if (rootElement) {
  2727. var input = this._element.querySelector(Selector$1.INPUT);
  2728. if (input) {
  2729. if (input.type === 'radio') {
  2730. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2731. triggerChangeEvent = false;
  2732. } else {
  2733. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2734. if (activeElement) {
  2735. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2736. }
  2737. }
  2738. } else if (input.type === 'checkbox') {
  2739. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2740. triggerChangeEvent = false;
  2741. }
  2742. } else {
  2743. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2744. triggerChangeEvent = false;
  2745. }
  2746. if (triggerChangeEvent) {
  2747. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2748. $(input).trigger('change');
  2749. }
  2750. input.focus();
  2751. addAriaPressed = false;
  2752. }
  2753. }
  2754. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2755. if (addAriaPressed) {
  2756. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2757. }
  2758. if (triggerChangeEvent) {
  2759. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2760. }
  2761. }
  2762. };
  2763. _proto.dispose = function dispose() {
  2764. $.removeData(this._element, DATA_KEY$1);
  2765. this._element = null;
  2766. } // Static
  2767. ;
  2768. Button._jQueryInterface = function _jQueryInterface(config) {
  2769. return this.each(function () {
  2770. var data = $(this).data(DATA_KEY$1);
  2771. if (!data) {
  2772. data = new Button(this);
  2773. $(this).data(DATA_KEY$1, data);
  2774. }
  2775. if (config === 'toggle') {
  2776. data[config]();
  2777. }
  2778. });
  2779. };
  2780. _createClass(Button, null, [{
  2781. key: "VERSION",
  2782. get: function get() {
  2783. return VERSION$1;
  2784. }
  2785. }]);
  2786. return Button;
  2787. }();
  2788. /**
  2789. * ------------------------------------------------------------------------
  2790. * Data Api implementation
  2791. * ------------------------------------------------------------------------
  2792. */
  2793. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2794. var button = event.target;
  2795. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2796. button = $(button).closest(Selector$1.BUTTON)[0];
  2797. }
  2798. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2799. event.preventDefault(); // work around Firefox bug #1540995
  2800. } else {
  2801. var inputBtn = button.querySelector(Selector$1.INPUT);
  2802. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2803. event.preventDefault(); // work around Firefox bug #1540995
  2804. return;
  2805. }
  2806. Button._jQueryInterface.call($(button), 'toggle');
  2807. }
  2808. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2809. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2810. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2811. });
  2812. $(window).on(Event$1.LOAD_DATA_API, function () {
  2813. // ensure correct active class is set to match the controls' actual values/states
  2814. // find all checkboxes/readio buttons inside data-toggle groups
  2815. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2816. for (var i = 0, len = buttons.length; i < len; i++) {
  2817. var button = buttons[i];
  2818. var input = button.querySelector(Selector$1.INPUT);
  2819. if (input.checked || input.hasAttribute('checked')) {
  2820. button.classList.add(ClassName$1.ACTIVE);
  2821. } else {
  2822. button.classList.remove(ClassName$1.ACTIVE);
  2823. }
  2824. } // find all button toggles
  2825. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2826. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2827. var _button = buttons[_i];
  2828. if (_button.getAttribute('aria-pressed') === 'true') {
  2829. _button.classList.add(ClassName$1.ACTIVE);
  2830. } else {
  2831. _button.classList.remove(ClassName$1.ACTIVE);
  2832. }
  2833. }
  2834. });
  2835. /**
  2836. * ------------------------------------------------------------------------
  2837. * jQuery
  2838. * ------------------------------------------------------------------------
  2839. */
  2840. $.fn[NAME$1] = Button._jQueryInterface;
  2841. $.fn[NAME$1].Constructor = Button;
  2842. $.fn[NAME$1].noConflict = function () {
  2843. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2844. return Button._jQueryInterface;
  2845. };
  2846. /**
  2847. * ------------------------------------------------------------------------
  2848. * Constants
  2849. * ------------------------------------------------------------------------
  2850. */
  2851. var NAME$2 = 'carousel';
  2852. var VERSION$2 = '4.4.1';
  2853. var DATA_KEY$2 = 'bs.carousel';
  2854. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2855. var DATA_API_KEY$2 = '.data-api';
  2856. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2857. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2858. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2859. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2860. var SWIPE_THRESHOLD = 40;
  2861. var Default = {
  2862. interval: 5000,
  2863. keyboard: true,
  2864. slide: false,
  2865. pause: 'hover',
  2866. wrap: true,
  2867. touch: true
  2868. };
  2869. var DefaultType = {
  2870. interval: '(number|boolean)',
  2871. keyboard: 'boolean',
  2872. slide: '(boolean|string)',
  2873. pause: '(string|boolean)',
  2874. wrap: 'boolean',
  2875. touch: 'boolean'
  2876. };
  2877. var Direction = {
  2878. NEXT: 'next',
  2879. PREV: 'prev',
  2880. LEFT: 'left',
  2881. RIGHT: 'right'
  2882. };
  2883. var Event$2 = {
  2884. SLIDE: "slide" + EVENT_KEY$2,
  2885. SLID: "slid" + EVENT_KEY$2,
  2886. KEYDOWN: "keydown" + EVENT_KEY$2,
  2887. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2888. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2889. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2890. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2891. TOUCHEND: "touchend" + EVENT_KEY$2,
  2892. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2893. POINTERUP: "pointerup" + EVENT_KEY$2,
  2894. DRAG_START: "dragstart" + EVENT_KEY$2,
  2895. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2896. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2897. };
  2898. var ClassName$2 = {
  2899. CAROUSEL: 'carousel',
  2900. ACTIVE: 'active',
  2901. SLIDE: 'slide',
  2902. RIGHT: 'carousel-item-right',
  2903. LEFT: 'carousel-item-left',
  2904. NEXT: 'carousel-item-next',
  2905. PREV: 'carousel-item-prev',
  2906. ITEM: 'carousel-item',
  2907. POINTER_EVENT: 'pointer-event'
  2908. };
  2909. var Selector$2 = {
  2910. ACTIVE: '.active',
  2911. ACTIVE_ITEM: '.active.carousel-item',
  2912. ITEM: '.carousel-item',
  2913. ITEM_IMG: '.carousel-item img',
  2914. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2915. INDICATORS: '.carousel-indicators',
  2916. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2917. DATA_RIDE: '[data-ride="carousel"]'
  2918. };
  2919. var PointerType = {
  2920. TOUCH: 'touch',
  2921. PEN: 'pen'
  2922. };
  2923. /**
  2924. * ------------------------------------------------------------------------
  2925. * Class Definition
  2926. * ------------------------------------------------------------------------
  2927. */
  2928. var Carousel =
  2929. /*#__PURE__*/
  2930. function () {
  2931. function Carousel(element, config) {
  2932. this._items = null;
  2933. this._interval = null;
  2934. this._activeElement = null;
  2935. this._isPaused = false;
  2936. this._isSliding = false;
  2937. this.touchTimeout = null;
  2938. this.touchStartX = 0;
  2939. this.touchDeltaX = 0;
  2940. this._config = this._getConfig(config);
  2941. this._element = element;
  2942. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2943. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2944. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2945. this._addEventListeners();
  2946. } // Getters
  2947. var _proto = Carousel.prototype;
  2948. // Public
  2949. _proto.next = function next() {
  2950. if (!this._isSliding) {
  2951. this._slide(Direction.NEXT);
  2952. }
  2953. };
  2954. _proto.nextWhenVisible = function nextWhenVisible() {
  2955. // Don't call next when the page isn't visible
  2956. // or the carousel or its parent isn't visible
  2957. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2958. this.next();
  2959. }
  2960. };
  2961. _proto.prev = function prev() {
  2962. if (!this._isSliding) {
  2963. this._slide(Direction.PREV);
  2964. }
  2965. };
  2966. _proto.pause = function pause(event) {
  2967. if (!event) {
  2968. this._isPaused = true;
  2969. }
  2970. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2971. Util.triggerTransitionEnd(this._element);
  2972. this.cycle(true);
  2973. }
  2974. clearInterval(this._interval);
  2975. this._interval = null;
  2976. };
  2977. _proto.cycle = function cycle(event) {
  2978. if (!event) {
  2979. this._isPaused = false;
  2980. }
  2981. if (this._interval) {
  2982. clearInterval(this._interval);
  2983. this._interval = null;
  2984. }
  2985. if (this._config.interval && !this._isPaused) {
  2986. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2987. }
  2988. };
  2989. _proto.to = function to(index) {
  2990. var _this = this;
  2991. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2992. var activeIndex = this._getItemIndex(this._activeElement);
  2993. if (index > this._items.length - 1 || index < 0) {
  2994. return;
  2995. }
  2996. if (this._isSliding) {
  2997. $(this._element).one(Event$2.SLID, function () {
  2998. return _this.to(index);
  2999. });
  3000. return;
  3001. }
  3002. if (activeIndex === index) {
  3003. this.pause();
  3004. this.cycle();
  3005. return;
  3006. }
  3007. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3008. this._slide(direction, this._items[index]);
  3009. };
  3010. _proto.dispose = function dispose() {
  3011. $(this._element).off(EVENT_KEY$2);
  3012. $.removeData(this._element, DATA_KEY$2);
  3013. this._items = null;
  3014. this._config = null;
  3015. this._element = null;
  3016. this._interval = null;
  3017. this._isPaused = null;
  3018. this._isSliding = null;
  3019. this._activeElement = null;
  3020. this._indicatorsElement = null;
  3021. } // Private
  3022. ;
  3023. _proto._getConfig = function _getConfig(config) {
  3024. config = _objectSpread2({}, Default, {}, config);
  3025. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3026. return config;
  3027. };
  3028. _proto._handleSwipe = function _handleSwipe() {
  3029. var absDeltax = Math.abs(this.touchDeltaX);
  3030. if (absDeltax <= SWIPE_THRESHOLD) {
  3031. return;
  3032. }
  3033. var direction = absDeltax / this.touchDeltaX;
  3034. this.touchDeltaX = 0; // swipe left
  3035. if (direction > 0) {
  3036. this.prev();
  3037. } // swipe right
  3038. if (direction < 0) {
  3039. this.next();
  3040. }
  3041. };
  3042. _proto._addEventListeners = function _addEventListeners() {
  3043. var _this2 = this;
  3044. if (this._config.keyboard) {
  3045. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3046. return _this2._keydown(event);
  3047. });
  3048. }
  3049. if (this._config.pause === 'hover') {
  3050. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3051. return _this2.pause(event);
  3052. }).on(Event$2.MOUSELEAVE, function (event) {
  3053. return _this2.cycle(event);
  3054. });
  3055. }
  3056. if (this._config.touch) {
  3057. this._addTouchEventListeners();
  3058. }
  3059. };
  3060. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3061. var _this3 = this;
  3062. if (!this._touchSupported) {
  3063. return;
  3064. }
  3065. var start = function start(event) {
  3066. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3067. _this3.touchStartX = event.originalEvent.clientX;
  3068. } else if (!_this3._pointerEvent) {
  3069. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3070. }
  3071. };
  3072. var move = function move(event) {
  3073. // ensure swiping with one touch and not pinching
  3074. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3075. _this3.touchDeltaX = 0;
  3076. } else {
  3077. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3078. }
  3079. };
  3080. var end = function end(event) {
  3081. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3082. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3083. }
  3084. _this3._handleSwipe();
  3085. if (_this3._config.pause === 'hover') {
  3086. // If it's a touch-enabled device, mouseenter/leave are fired as
  3087. // part of the mouse compatibility events on first tap - the carousel
  3088. // would stop cycling until user tapped out of it;
  3089. // here, we listen for touchend, explicitly pause the carousel
  3090. // (as if it's the second time we tap on it, mouseenter compat event
  3091. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3092. // events to fire) we explicitly restart cycling
  3093. _this3.pause();
  3094. if (_this3.touchTimeout) {
  3095. clearTimeout(_this3.touchTimeout);
  3096. }
  3097. _this3.touchTimeout = setTimeout(function (event) {
  3098. return _this3.cycle(event);
  3099. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3100. }
  3101. };
  3102. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3103. return e.preventDefault();
  3104. });
  3105. if (this._pointerEvent) {
  3106. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3107. return start(event);
  3108. });
  3109. $(this._element).on(Event$2.POINTERUP, function (event) {
  3110. return end(event);
  3111. });
  3112. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3113. } else {
  3114. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3115. return start(event);
  3116. });
  3117. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3118. return move(event);
  3119. });
  3120. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3121. return end(event);
  3122. });
  3123. }
  3124. };
  3125. _proto._keydown = function _keydown(event) {
  3126. if (/input|textarea/i.test(event.target.tagName)) {
  3127. return;
  3128. }
  3129. switch (event.which) {
  3130. case ARROW_LEFT_KEYCODE:
  3131. event.preventDefault();
  3132. this.prev();
  3133. break;
  3134. case ARROW_RIGHT_KEYCODE:
  3135. event.preventDefault();
  3136. this.next();
  3137. break;
  3138. }
  3139. };
  3140. _proto._getItemIndex = function _getItemIndex(element) {
  3141. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3142. return this._items.indexOf(element);
  3143. };
  3144. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3145. var isNextDirection = direction === Direction.NEXT;
  3146. var isPrevDirection = direction === Direction.PREV;
  3147. var activeIndex = this._getItemIndex(activeElement);
  3148. var lastItemIndex = this._items.length - 1;
  3149. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3150. if (isGoingToWrap && !this._config.wrap) {
  3151. return activeElement;
  3152. }
  3153. var delta = direction === Direction.PREV ? -1 : 1;
  3154. var itemIndex = (activeIndex + delta) % this._items.length;
  3155. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3156. };
  3157. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3158. var targetIndex = this._getItemIndex(relatedTarget);
  3159. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3160. var slideEvent = $.Event(Event$2.SLIDE, {
  3161. relatedTarget: relatedTarget,
  3162. direction: eventDirectionName,
  3163. from: fromIndex,
  3164. to: targetIndex
  3165. });
  3166. $(this._element).trigger(slideEvent);
  3167. return slideEvent;
  3168. };
  3169. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3170. if (this._indicatorsElement) {
  3171. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3172. $(indicators).removeClass(ClassName$2.ACTIVE);
  3173. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3174. if (nextIndicator) {
  3175. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3176. }
  3177. }
  3178. };
  3179. _proto._slide = function _slide(direction, element) {
  3180. var _this4 = this;
  3181. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3182. var activeElementIndex = this._getItemIndex(activeElement);
  3183. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3184. var nextElementIndex = this._getItemIndex(nextElement);
  3185. var isCycling = Boolean(this._interval);
  3186. var directionalClassName;
  3187. var orderClassName;
  3188. var eventDirectionName;
  3189. if (direction === Direction.NEXT) {
  3190. directionalClassName = ClassName$2.LEFT;
  3191. orderClassName = ClassName$2.NEXT;
  3192. eventDirectionName = Direction.LEFT;
  3193. } else {
  3194. directionalClassName = ClassName$2.RIGHT;
  3195. orderClassName = ClassName$2.PREV;
  3196. eventDirectionName = Direction.RIGHT;
  3197. }
  3198. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3199. this._isSliding = false;
  3200. return;
  3201. }
  3202. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3203. if (slideEvent.isDefaultPrevented()) {
  3204. return;
  3205. }
  3206. if (!activeElement || !nextElement) {
  3207. // Some weirdness is happening, so we bail
  3208. return;
  3209. }
  3210. this._isSliding = true;
  3211. if (isCycling) {
  3212. this.pause();
  3213. }
  3214. this._setActiveIndicatorElement(nextElement);
  3215. var slidEvent = $.Event(Event$2.SLID, {
  3216. relatedTarget: nextElement,
  3217. direction: eventDirectionName,
  3218. from: activeElementIndex,
  3219. to: nextElementIndex
  3220. });
  3221. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3222. $(nextElement).addClass(orderClassName);
  3223. Util.reflow(nextElement);
  3224. $(activeElement).addClass(directionalClassName);
  3225. $(nextElement).addClass(directionalClassName);
  3226. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3227. if (nextElementInterval) {
  3228. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3229. this._config.interval = nextElementInterval;
  3230. } else {
  3231. this._config.interval = this._config.defaultInterval || this._config.interval;
  3232. }
  3233. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3234. $(activeElement).one(Util.TRANSITION_END, function () {
  3235. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3236. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3237. _this4._isSliding = false;
  3238. setTimeout(function () {
  3239. return $(_this4._element).trigger(slidEvent);
  3240. }, 0);
  3241. }).emulateTransitionEnd(transitionDuration);
  3242. } else {
  3243. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3244. $(nextElement).addClass(ClassName$2.ACTIVE);
  3245. this._isSliding = false;
  3246. $(this._element).trigger(slidEvent);
  3247. }
  3248. if (isCycling) {
  3249. this.cycle();
  3250. }
  3251. } // Static
  3252. ;
  3253. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3254. return this.each(function () {
  3255. var data = $(this).data(DATA_KEY$2);
  3256. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3257. if (typeof config === 'object') {
  3258. _config = _objectSpread2({}, _config, {}, config);
  3259. }
  3260. var action = typeof config === 'string' ? config : _config.slide;
  3261. if (!data) {
  3262. data = new Carousel(this, _config);
  3263. $(this).data(DATA_KEY$2, data);
  3264. }
  3265. if (typeof config === 'number') {
  3266. data.to(config);
  3267. } else if (typeof action === 'string') {
  3268. if (typeof data[action] === 'undefined') {
  3269. throw new TypeError("No method named \"" + action + "\"");
  3270. }
  3271. data[action]();
  3272. } else if (_config.interval && _config.ride) {
  3273. data.pause();
  3274. data.cycle();
  3275. }
  3276. });
  3277. };
  3278. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3279. var selector = Util.getSelectorFromElement(this);
  3280. if (!selector) {
  3281. return;
  3282. }
  3283. var target = $(selector)[0];
  3284. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3285. return;
  3286. }
  3287. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3288. var slideIndex = this.getAttribute('data-slide-to');
  3289. if (slideIndex) {
  3290. config.interval = false;
  3291. }
  3292. Carousel._jQueryInterface.call($(target), config);
  3293. if (slideIndex) {
  3294. $(target).data(DATA_KEY$2).to(slideIndex);
  3295. }
  3296. event.preventDefault();
  3297. };
  3298. _createClass(Carousel, null, [{
  3299. key: "VERSION",
  3300. get: function get() {
  3301. return VERSION$2;
  3302. }
  3303. }, {
  3304. key: "Default",
  3305. get: function get() {
  3306. return Default;
  3307. }
  3308. }]);
  3309. return Carousel;
  3310. }();
  3311. /**
  3312. * ------------------------------------------------------------------------
  3313. * Data Api implementation
  3314. * ------------------------------------------------------------------------
  3315. */
  3316. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3317. $(window).on(Event$2.LOAD_DATA_API, function () {
  3318. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3319. for (var i = 0, len = carousels.length; i < len; i++) {
  3320. var $carousel = $(carousels[i]);
  3321. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3322. }
  3323. });
  3324. /**
  3325. * ------------------------------------------------------------------------
  3326. * jQuery
  3327. * ------------------------------------------------------------------------
  3328. */
  3329. $.fn[NAME$2] = Carousel._jQueryInterface;
  3330. $.fn[NAME$2].Constructor = Carousel;
  3331. $.fn[NAME$2].noConflict = function () {
  3332. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3333. return Carousel._jQueryInterface;
  3334. };
  3335. /**
  3336. * ------------------------------------------------------------------------
  3337. * Constants
  3338. * ------------------------------------------------------------------------
  3339. */
  3340. var NAME$3 = 'collapse';
  3341. var VERSION$3 = '4.4.1';
  3342. var DATA_KEY$3 = 'bs.collapse';
  3343. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3344. var DATA_API_KEY$3 = '.data-api';
  3345. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3346. var Default$1 = {
  3347. toggle: true,
  3348. parent: ''
  3349. };
  3350. var DefaultType$1 = {
  3351. toggle: 'boolean',
  3352. parent: '(string|element)'
  3353. };
  3354. var Event$3 = {
  3355. SHOW: "show" + EVENT_KEY$3,
  3356. SHOWN: "shown" + EVENT_KEY$3,
  3357. HIDE: "hide" + EVENT_KEY$3,
  3358. HIDDEN: "hidden" + EVENT_KEY$3,
  3359. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3360. };
  3361. var ClassName$3 = {
  3362. SHOW: 'show',
  3363. COLLAPSE: 'collapse',
  3364. COLLAPSING: 'collapsing',
  3365. COLLAPSED: 'collapsed'
  3366. };
  3367. var Dimension = {
  3368. WIDTH: 'width',
  3369. HEIGHT: 'height'
  3370. };
  3371. var Selector$3 = {
  3372. ACTIVES: '.show, .collapsing',
  3373. DATA_TOGGLE: '[data-toggle="collapse"]'
  3374. };
  3375. /**
  3376. * ------------------------------------------------------------------------
  3377. * Class Definition
  3378. * ------------------------------------------------------------------------
  3379. */
  3380. var Collapse =
  3381. /*#__PURE__*/
  3382. function () {
  3383. function Collapse(element, config) {
  3384. this._isTransitioning = false;
  3385. this._element = element;
  3386. this._config = this._getConfig(config);
  3387. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3388. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3389. for (var i = 0, len = toggleList.length; i < len; i++) {
  3390. var elem = toggleList[i];
  3391. var selector = Util.getSelectorFromElement(elem);
  3392. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3393. return foundElem === element;
  3394. });
  3395. if (selector !== null && filterElement.length > 0) {
  3396. this._selector = selector;
  3397. this._triggerArray.push(elem);
  3398. }
  3399. }
  3400. this._parent = this._config.parent ? this._getParent() : null;
  3401. if (!this._config.parent) {
  3402. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3403. }
  3404. if (this._config.toggle) {
  3405. this.toggle();
  3406. }
  3407. } // Getters
  3408. var _proto = Collapse.prototype;
  3409. // Public
  3410. _proto.toggle = function toggle() {
  3411. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3412. this.hide();
  3413. } else {
  3414. this.show();
  3415. }
  3416. };
  3417. _proto.show = function show() {
  3418. var _this = this;
  3419. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3420. return;
  3421. }
  3422. var actives;
  3423. var activesData;
  3424. if (this._parent) {
  3425. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3426. if (typeof _this._config.parent === 'string') {
  3427. return elem.getAttribute('data-parent') === _this._config.parent;
  3428. }
  3429. return elem.classList.contains(ClassName$3.COLLAPSE);
  3430. });
  3431. if (actives.length === 0) {
  3432. actives = null;
  3433. }
  3434. }
  3435. if (actives) {
  3436. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3437. if (activesData && activesData._isTransitioning) {
  3438. return;
  3439. }
  3440. }
  3441. var startEvent = $.Event(Event$3.SHOW);
  3442. $(this._element).trigger(startEvent);
  3443. if (startEvent.isDefaultPrevented()) {
  3444. return;
  3445. }
  3446. if (actives) {
  3447. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3448. if (!activesData) {
  3449. $(actives).data(DATA_KEY$3, null);
  3450. }
  3451. }
  3452. var dimension = this._getDimension();
  3453. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3454. this._element.style[dimension] = 0;
  3455. if (this._triggerArray.length) {
  3456. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3457. }
  3458. this.setTransitioning(true);
  3459. var complete = function complete() {
  3460. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3461. _this._element.style[dimension] = '';
  3462. _this.setTransitioning(false);
  3463. $(_this._element).trigger(Event$3.SHOWN);
  3464. };
  3465. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3466. var scrollSize = "scroll" + capitalizedDimension;
  3467. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3468. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3469. this._element.style[dimension] = this._element[scrollSize] + "px";
  3470. };
  3471. _proto.hide = function hide() {
  3472. var _this2 = this;
  3473. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3474. return;
  3475. }
  3476. var startEvent = $.Event(Event$3.HIDE);
  3477. $(this._element).trigger(startEvent);
  3478. if (startEvent.isDefaultPrevented()) {
  3479. return;
  3480. }
  3481. var dimension = this._getDimension();
  3482. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3483. Util.reflow(this._element);
  3484. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3485. var triggerArrayLength = this._triggerArray.length;
  3486. if (triggerArrayLength > 0) {
  3487. for (var i = 0; i < triggerArrayLength; i++) {
  3488. var trigger = this._triggerArray[i];
  3489. var selector = Util.getSelectorFromElement(trigger);
  3490. if (selector !== null) {
  3491. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3492. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3493. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3494. }
  3495. }
  3496. }
  3497. }
  3498. this.setTransitioning(true);
  3499. var complete = function complete() {
  3500. _this2.setTransitioning(false);
  3501. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3502. };
  3503. this._element.style[dimension] = '';
  3504. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3505. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3506. };
  3507. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3508. this._isTransitioning = isTransitioning;
  3509. };
  3510. _proto.dispose = function dispose() {
  3511. $.removeData(this._element, DATA_KEY$3);
  3512. this._config = null;
  3513. this._parent = null;
  3514. this._element = null;
  3515. this._triggerArray = null;
  3516. this._isTransitioning = null;
  3517. } // Private
  3518. ;
  3519. _proto._getConfig = function _getConfig(config) {
  3520. config = _objectSpread2({}, Default$1, {}, config);
  3521. config.toggle = Boolean(config.toggle); // Coerce string values
  3522. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3523. return config;
  3524. };
  3525. _proto._getDimension = function _getDimension() {
  3526. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3527. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3528. };
  3529. _proto._getParent = function _getParent() {
  3530. var _this3 = this;
  3531. var parent;
  3532. if (Util.isElement(this._config.parent)) {
  3533. parent = this._config.parent; // It's a jQuery object
  3534. if (typeof this._config.parent.jquery !== 'undefined') {
  3535. parent = this._config.parent[0];
  3536. }
  3537. } else {
  3538. parent = document.querySelector(this._config.parent);
  3539. }
  3540. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3541. var children = [].slice.call(parent.querySelectorAll(selector));
  3542. $(children).each(function (i, element) {
  3543. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3544. });
  3545. return parent;
  3546. };
  3547. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3548. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3549. if (triggerArray.length) {
  3550. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3551. }
  3552. } // Static
  3553. ;
  3554. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3555. var selector = Util.getSelectorFromElement(element);
  3556. return selector ? document.querySelector(selector) : null;
  3557. };
  3558. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3559. return this.each(function () {
  3560. var $this = $(this);
  3561. var data = $this.data(DATA_KEY$3);
  3562. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3563. if (!data && _config.toggle && /show|hide/.test(config)) {
  3564. _config.toggle = false;
  3565. }
  3566. if (!data) {
  3567. data = new Collapse(this, _config);
  3568. $this.data(DATA_KEY$3, data);
  3569. }
  3570. if (typeof config === 'string') {
  3571. if (typeof data[config] === 'undefined') {
  3572. throw new TypeError("No method named \"" + config + "\"");
  3573. }
  3574. data[config]();
  3575. }
  3576. });
  3577. };
  3578. _createClass(Collapse, null, [{
  3579. key: "VERSION",
  3580. get: function get() {
  3581. return VERSION$3;
  3582. }
  3583. }, {
  3584. key: "Default",
  3585. get: function get() {
  3586. return Default$1;
  3587. }
  3588. }]);
  3589. return Collapse;
  3590. }();
  3591. /**
  3592. * ------------------------------------------------------------------------
  3593. * Data Api implementation
  3594. * ------------------------------------------------------------------------
  3595. */
  3596. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3597. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3598. if (event.currentTarget.tagName === 'A') {
  3599. event.preventDefault();
  3600. }
  3601. var $trigger = $(this);
  3602. var selector = Util.getSelectorFromElement(this);
  3603. var selectors = [].slice.call(document.querySelectorAll(selector));
  3604. $(selectors).each(function () {
  3605. var $target = $(this);
  3606. var data = $target.data(DATA_KEY$3);
  3607. var config = data ? 'toggle' : $trigger.data();
  3608. Collapse._jQueryInterface.call($target, config);
  3609. });
  3610. });
  3611. /**
  3612. * ------------------------------------------------------------------------
  3613. * jQuery
  3614. * ------------------------------------------------------------------------
  3615. */
  3616. $.fn[NAME$3] = Collapse._jQueryInterface;
  3617. $.fn[NAME$3].Constructor = Collapse;
  3618. $.fn[NAME$3].noConflict = function () {
  3619. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3620. return Collapse._jQueryInterface;
  3621. };
  3622. /**
  3623. * ------------------------------------------------------------------------
  3624. * Constants
  3625. * ------------------------------------------------------------------------
  3626. */
  3627. var NAME$4 = 'dropdown';
  3628. var VERSION$4 = '4.4.1';
  3629. var DATA_KEY$4 = 'bs.dropdown';
  3630. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3631. var DATA_API_KEY$4 = '.data-api';
  3632. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3633. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3634. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3635. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3636. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3637. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3638. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3639. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3640. var Event$4 = {
  3641. HIDE: "hide" + EVENT_KEY$4,
  3642. HIDDEN: "hidden" + EVENT_KEY$4,
  3643. SHOW: "show" + EVENT_KEY$4,
  3644. SHOWN: "shown" + EVENT_KEY$4,
  3645. CLICK: "click" + EVENT_KEY$4,
  3646. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3647. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3648. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3649. };
  3650. var ClassName$4 = {
  3651. DISABLED: 'disabled',
  3652. SHOW: 'show',
  3653. DROPUP: 'dropup',
  3654. DROPRIGHT: 'dropright',
  3655. DROPLEFT: 'dropleft',
  3656. MENURIGHT: 'dropdown-menu-right',
  3657. MENULEFT: 'dropdown-menu-left',
  3658. POSITION_STATIC: 'position-static'
  3659. };
  3660. var Selector$4 = {
  3661. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3662. FORM_CHILD: '.dropdown form',
  3663. MENU: '.dropdown-menu',
  3664. NAVBAR_NAV: '.navbar-nav',
  3665. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3666. };
  3667. var AttachmentMap = {
  3668. TOP: 'top-start',
  3669. TOPEND: 'top-end',
  3670. BOTTOM: 'bottom-start',
  3671. BOTTOMEND: 'bottom-end',
  3672. RIGHT: 'right-start',
  3673. RIGHTEND: 'right-end',
  3674. LEFT: 'left-start',
  3675. LEFTEND: 'left-end'
  3676. };
  3677. var Default$2 = {
  3678. offset: 0,
  3679. flip: true,
  3680. boundary: 'scrollParent',
  3681. reference: 'toggle',
  3682. display: 'dynamic',
  3683. popperConfig: null
  3684. };
  3685. var DefaultType$2 = {
  3686. offset: '(number|string|function)',
  3687. flip: 'boolean',
  3688. boundary: '(string|element)',
  3689. reference: '(string|element)',
  3690. display: 'string',
  3691. popperConfig: '(null|object)'
  3692. };
  3693. /**
  3694. * ------------------------------------------------------------------------
  3695. * Class Definition
  3696. * ------------------------------------------------------------------------
  3697. */
  3698. var Dropdown =
  3699. /*#__PURE__*/
  3700. function () {
  3701. function Dropdown(element, config) {
  3702. this._element = element;
  3703. this._popper = null;
  3704. this._config = this._getConfig(config);
  3705. this._menu = this._getMenuElement();
  3706. this._inNavbar = this._detectNavbar();
  3707. this._addEventListeners();
  3708. } // Getters
  3709. var _proto = Dropdown.prototype;
  3710. // Public
  3711. _proto.toggle = function toggle() {
  3712. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3713. return;
  3714. }
  3715. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3716. Dropdown._clearMenus();
  3717. if (isActive) {
  3718. return;
  3719. }
  3720. this.show(true);
  3721. };
  3722. _proto.show = function show(usePopper) {
  3723. if (usePopper === void 0) {
  3724. usePopper = false;
  3725. }
  3726. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3727. return;
  3728. }
  3729. var relatedTarget = {
  3730. relatedTarget: this._element
  3731. };
  3732. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3733. var parent = Dropdown._getParentFromElement(this._element);
  3734. $(parent).trigger(showEvent);
  3735. if (showEvent.isDefaultPrevented()) {
  3736. return;
  3737. } // Disable totally Popper.js for Dropdown in Navbar
  3738. if (!this._inNavbar && usePopper) {
  3739. /**
  3740. * Check for Popper dependency
  3741. * Popper - https://popper.js.org
  3742. */
  3743. if (typeof Popper === 'undefined') {
  3744. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3745. }
  3746. var referenceElement = this._element;
  3747. if (this._config.reference === 'parent') {
  3748. referenceElement = parent;
  3749. } else if (Util.isElement(this._config.reference)) {
  3750. referenceElement = this._config.reference; // Check if it's jQuery element
  3751. if (typeof this._config.reference.jquery !== 'undefined') {
  3752. referenceElement = this._config.reference[0];
  3753. }
  3754. } // If boundary is not `scrollParent`, then set position to `static`
  3755. // to allow the menu to "escape" the scroll parent's boundaries
  3756. // https://github.com/twbs/bootstrap/issues/24251
  3757. if (this._config.boundary !== 'scrollParent') {
  3758. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3759. }
  3760. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3761. } // If this is a touch-enabled device we add extra
  3762. // empty mouseover listeners to the body's immediate children;
  3763. // only needed because of broken event delegation on iOS
  3764. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3765. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3766. $(document.body).children().on('mouseover', null, $.noop);
  3767. }
  3768. this._element.focus();
  3769. this._element.setAttribute('aria-expanded', true);
  3770. $(this._menu).toggleClass(ClassName$4.SHOW);
  3771. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3772. };
  3773. _proto.hide = function hide() {
  3774. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3775. return;
  3776. }
  3777. var relatedTarget = {
  3778. relatedTarget: this._element
  3779. };
  3780. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3781. var parent = Dropdown._getParentFromElement(this._element);
  3782. $(parent).trigger(hideEvent);
  3783. if (hideEvent.isDefaultPrevented()) {
  3784. return;
  3785. }
  3786. if (this._popper) {
  3787. this._popper.destroy();
  3788. }
  3789. $(this._menu).toggleClass(ClassName$4.SHOW);
  3790. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3791. };
  3792. _proto.dispose = function dispose() {
  3793. $.removeData(this._element, DATA_KEY$4);
  3794. $(this._element).off(EVENT_KEY$4);
  3795. this._element = null;
  3796. this._menu = null;
  3797. if (this._popper !== null) {
  3798. this._popper.destroy();
  3799. this._popper = null;
  3800. }
  3801. };
  3802. _proto.update = function update() {
  3803. this._inNavbar = this._detectNavbar();
  3804. if (this._popper !== null) {
  3805. this._popper.scheduleUpdate();
  3806. }
  3807. } // Private
  3808. ;
  3809. _proto._addEventListeners = function _addEventListeners() {
  3810. var _this = this;
  3811. $(this._element).on(Event$4.CLICK, function (event) {
  3812. event.preventDefault();
  3813. event.stopPropagation();
  3814. _this.toggle();
  3815. });
  3816. };
  3817. _proto._getConfig = function _getConfig(config) {
  3818. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3819. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3820. return config;
  3821. };
  3822. _proto._getMenuElement = function _getMenuElement() {
  3823. if (!this._menu) {
  3824. var parent = Dropdown._getParentFromElement(this._element);
  3825. if (parent) {
  3826. this._menu = parent.querySelector(Selector$4.MENU);
  3827. }
  3828. }
  3829. return this._menu;
  3830. };
  3831. _proto._getPlacement = function _getPlacement() {
  3832. var $parentDropdown = $(this._element.parentNode);
  3833. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3834. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3835. placement = AttachmentMap.TOP;
  3836. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3837. placement = AttachmentMap.TOPEND;
  3838. }
  3839. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3840. placement = AttachmentMap.RIGHT;
  3841. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3842. placement = AttachmentMap.LEFT;
  3843. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3844. placement = AttachmentMap.BOTTOMEND;
  3845. }
  3846. return placement;
  3847. };
  3848. _proto._detectNavbar = function _detectNavbar() {
  3849. return $(this._element).closest('.navbar').length > 0;
  3850. };
  3851. _proto._getOffset = function _getOffset() {
  3852. var _this2 = this;
  3853. var offset = {};
  3854. if (typeof this._config.offset === 'function') {
  3855. offset.fn = function (data) {
  3856. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3857. return data;
  3858. };
  3859. } else {
  3860. offset.offset = this._config.offset;
  3861. }
  3862. return offset;
  3863. };
  3864. _proto._getPopperConfig = function _getPopperConfig() {
  3865. var popperConfig = {
  3866. placement: this._getPlacement(),
  3867. modifiers: {
  3868. offset: this._getOffset(),
  3869. flip: {
  3870. enabled: this._config.flip
  3871. },
  3872. preventOverflow: {
  3873. boundariesElement: this._config.boundary
  3874. }
  3875. }
  3876. }; // Disable Popper.js if we have a static display
  3877. if (this._config.display === 'static') {
  3878. popperConfig.modifiers.applyStyle = {
  3879. enabled: false
  3880. };
  3881. }
  3882. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3883. } // Static
  3884. ;
  3885. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3886. return this.each(function () {
  3887. var data = $(this).data(DATA_KEY$4);
  3888. var _config = typeof config === 'object' ? config : null;
  3889. if (!data) {
  3890. data = new Dropdown(this, _config);
  3891. $(this).data(DATA_KEY$4, data);
  3892. }
  3893. if (typeof config === 'string') {
  3894. if (typeof data[config] === 'undefined') {
  3895. throw new TypeError("No method named \"" + config + "\"");
  3896. }
  3897. data[config]();
  3898. }
  3899. });
  3900. };
  3901. Dropdown._clearMenus = function _clearMenus(event) {
  3902. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3903. return;
  3904. }
  3905. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3906. for (var i = 0, len = toggles.length; i < len; i++) {
  3907. var parent = Dropdown._getParentFromElement(toggles[i]);
  3908. var context = $(toggles[i]).data(DATA_KEY$4);
  3909. var relatedTarget = {
  3910. relatedTarget: toggles[i]
  3911. };
  3912. if (event && event.type === 'click') {
  3913. relatedTarget.clickEvent = event;
  3914. }
  3915. if (!context) {
  3916. continue;
  3917. }
  3918. var dropdownMenu = context._menu;
  3919. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3920. continue;
  3921. }
  3922. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3923. continue;
  3924. }
  3925. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3926. $(parent).trigger(hideEvent);
  3927. if (hideEvent.isDefaultPrevented()) {
  3928. continue;
  3929. } // If this is a touch-enabled device we remove the extra
  3930. // empty mouseover listeners we added for iOS support
  3931. if ('ontouchstart' in document.documentElement) {
  3932. $(document.body).children().off('mouseover', null, $.noop);
  3933. }
  3934. toggles[i].setAttribute('aria-expanded', 'false');
  3935. if (context._popper) {
  3936. context._popper.destroy();
  3937. }
  3938. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3939. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3940. }
  3941. };
  3942. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3943. var parent;
  3944. var selector = Util.getSelectorFromElement(element);
  3945. if (selector) {
  3946. parent = document.querySelector(selector);
  3947. }
  3948. return parent || element.parentNode;
  3949. } // eslint-disable-next-line complexity
  3950. ;
  3951. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3952. // If not input/textarea:
  3953. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3954. // If input/textarea:
  3955. // - If space key => not a dropdown command
  3956. // - If key is other than escape
  3957. // - If key is not up or down => not a dropdown command
  3958. // - If trigger inside the menu => not a dropdown command
  3959. 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)) {
  3960. return;
  3961. }
  3962. event.preventDefault();
  3963. event.stopPropagation();
  3964. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3965. return;
  3966. }
  3967. var parent = Dropdown._getParentFromElement(this);
  3968. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3969. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3970. return;
  3971. }
  3972. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3973. if (event.which === ESCAPE_KEYCODE) {
  3974. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3975. $(toggle).trigger('focus');
  3976. }
  3977. $(this).trigger('click');
  3978. return;
  3979. }
  3980. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3981. return $(item).is(':visible');
  3982. });
  3983. if (items.length === 0) {
  3984. return;
  3985. }
  3986. var index = items.indexOf(event.target);
  3987. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3988. // Up
  3989. index--;
  3990. }
  3991. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3992. // Down
  3993. index++;
  3994. }
  3995. if (index < 0) {
  3996. index = 0;
  3997. }
  3998. items[index].focus();
  3999. };
  4000. _createClass(Dropdown, null, [{
  4001. key: "VERSION",
  4002. get: function get() {
  4003. return VERSION$4;
  4004. }
  4005. }, {
  4006. key: "Default",
  4007. get: function get() {
  4008. return Default$2;
  4009. }
  4010. }, {
  4011. key: "DefaultType",
  4012. get: function get() {
  4013. return DefaultType$2;
  4014. }
  4015. }]);
  4016. return Dropdown;
  4017. }();
  4018. /**
  4019. * ------------------------------------------------------------------------
  4020. * Data Api implementation
  4021. * ------------------------------------------------------------------------
  4022. */
  4023. $(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) {
  4024. event.preventDefault();
  4025. event.stopPropagation();
  4026. Dropdown._jQueryInterface.call($(this), 'toggle');
  4027. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4028. e.stopPropagation();
  4029. });
  4030. /**
  4031. * ------------------------------------------------------------------------
  4032. * jQuery
  4033. * ------------------------------------------------------------------------
  4034. */
  4035. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4036. $.fn[NAME$4].Constructor = Dropdown;
  4037. $.fn[NAME$4].noConflict = function () {
  4038. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4039. return Dropdown._jQueryInterface;
  4040. };
  4041. /**
  4042. * ------------------------------------------------------------------------
  4043. * Constants
  4044. * ------------------------------------------------------------------------
  4045. */
  4046. var NAME$5 = 'modal';
  4047. var VERSION$5 = '4.4.1';
  4048. var DATA_KEY$5 = 'bs.modal';
  4049. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4050. var DATA_API_KEY$5 = '.data-api';
  4051. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4052. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4053. var Default$3 = {
  4054. backdrop: true,
  4055. keyboard: true,
  4056. focus: true,
  4057. show: true
  4058. };
  4059. var DefaultType$3 = {
  4060. backdrop: '(boolean|string)',
  4061. keyboard: 'boolean',
  4062. focus: 'boolean',
  4063. show: 'boolean'
  4064. };
  4065. var Event$5 = {
  4066. HIDE: "hide" + EVENT_KEY$5,
  4067. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4068. HIDDEN: "hidden" + EVENT_KEY$5,
  4069. SHOW: "show" + EVENT_KEY$5,
  4070. SHOWN: "shown" + EVENT_KEY$5,
  4071. FOCUSIN: "focusin" + EVENT_KEY$5,
  4072. RESIZE: "resize" + EVENT_KEY$5,
  4073. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4074. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4075. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4076. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4077. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4078. };
  4079. var ClassName$5 = {
  4080. SCROLLABLE: 'modal-dialog-scrollable',
  4081. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4082. BACKDROP: 'modal-backdrop',
  4083. OPEN: 'modal-open',
  4084. FADE: 'fade',
  4085. SHOW: 'show',
  4086. STATIC: 'modal-static'
  4087. };
  4088. var Selector$5 = {
  4089. DIALOG: '.modal-dialog',
  4090. MODAL_BODY: '.modal-body',
  4091. DATA_TOGGLE: '[data-toggle="modal"]',
  4092. DATA_DISMISS: '[data-dismiss="modal"]',
  4093. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4094. STICKY_CONTENT: '.sticky-top'
  4095. };
  4096. /**
  4097. * ------------------------------------------------------------------------
  4098. * Class Definition
  4099. * ------------------------------------------------------------------------
  4100. */
  4101. var Modal =
  4102. /*#__PURE__*/
  4103. function () {
  4104. function Modal(element, config) {
  4105. this._config = this._getConfig(config);
  4106. this._element = element;
  4107. this._dialog = element.querySelector(Selector$5.DIALOG);
  4108. this._backdrop = null;
  4109. this._isShown = false;
  4110. this._isBodyOverflowing = false;
  4111. this._ignoreBackdropClick = false;
  4112. this._isTransitioning = false;
  4113. this._scrollbarWidth = 0;
  4114. } // Getters
  4115. var _proto = Modal.prototype;
  4116. // Public
  4117. _proto.toggle = function toggle(relatedTarget) {
  4118. return this._isShown ? this.hide() : this.show(relatedTarget);
  4119. };
  4120. _proto.show = function show(relatedTarget) {
  4121. var _this = this;
  4122. if (this._isShown || this._isTransitioning) {
  4123. return;
  4124. }
  4125. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4126. this._isTransitioning = true;
  4127. }
  4128. var showEvent = $.Event(Event$5.SHOW, {
  4129. relatedTarget: relatedTarget
  4130. });
  4131. $(this._element).trigger(showEvent);
  4132. if (this._isShown || showEvent.isDefaultPrevented()) {
  4133. return;
  4134. }
  4135. this._isShown = true;
  4136. this._checkScrollbar();
  4137. this._setScrollbar();
  4138. this._adjustDialog();
  4139. this._setEscapeEvent();
  4140. this._setResizeEvent();
  4141. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4142. return _this.hide(event);
  4143. });
  4144. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4145. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4146. if ($(event.target).is(_this._element)) {
  4147. _this._ignoreBackdropClick = true;
  4148. }
  4149. });
  4150. });
  4151. this._showBackdrop(function () {
  4152. return _this._showElement(relatedTarget);
  4153. });
  4154. };
  4155. _proto.hide = function hide(event) {
  4156. var _this2 = this;
  4157. if (event) {
  4158. event.preventDefault();
  4159. }
  4160. if (!this._isShown || this._isTransitioning) {
  4161. return;
  4162. }
  4163. var hideEvent = $.Event(Event$5.HIDE);
  4164. $(this._element).trigger(hideEvent);
  4165. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4166. return;
  4167. }
  4168. this._isShown = false;
  4169. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4170. if (transition) {
  4171. this._isTransitioning = true;
  4172. }
  4173. this._setEscapeEvent();
  4174. this._setResizeEvent();
  4175. $(document).off(Event$5.FOCUSIN);
  4176. $(this._element).removeClass(ClassName$5.SHOW);
  4177. $(this._element).off(Event$5.CLICK_DISMISS);
  4178. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4179. if (transition) {
  4180. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4181. $(this._element).one(Util.TRANSITION_END, function (event) {
  4182. return _this2._hideModal(event);
  4183. }).emulateTransitionEnd(transitionDuration);
  4184. } else {
  4185. this._hideModal();
  4186. }
  4187. };
  4188. _proto.dispose = function dispose() {
  4189. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4190. return $(htmlElement).off(EVENT_KEY$5);
  4191. });
  4192. /**
  4193. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4194. * Do not move `document` in `htmlElements` array
  4195. * It will remove `Event.CLICK_DATA_API` event that should remain
  4196. */
  4197. $(document).off(Event$5.FOCUSIN);
  4198. $.removeData(this._element, DATA_KEY$5);
  4199. this._config = null;
  4200. this._element = null;
  4201. this._dialog = null;
  4202. this._backdrop = null;
  4203. this._isShown = null;
  4204. this._isBodyOverflowing = null;
  4205. this._ignoreBackdropClick = null;
  4206. this._isTransitioning = null;
  4207. this._scrollbarWidth = null;
  4208. };
  4209. _proto.handleUpdate = function handleUpdate() {
  4210. this._adjustDialog();
  4211. } // Private
  4212. ;
  4213. _proto._getConfig = function _getConfig(config) {
  4214. config = _objectSpread2({}, Default$3, {}, config);
  4215. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4216. return config;
  4217. };
  4218. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4219. var _this3 = this;
  4220. if (this._config.backdrop === 'static') {
  4221. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4222. $(this._element).trigger(hideEventPrevented);
  4223. if (hideEventPrevented.defaultPrevented) {
  4224. return;
  4225. }
  4226. this._element.classList.add(ClassName$5.STATIC);
  4227. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4228. $(this._element).one(Util.TRANSITION_END, function () {
  4229. _this3._element.classList.remove(ClassName$5.STATIC);
  4230. }).emulateTransitionEnd(modalTransitionDuration);
  4231. this._element.focus();
  4232. } else {
  4233. this.hide();
  4234. }
  4235. };
  4236. _proto._showElement = function _showElement(relatedTarget) {
  4237. var _this4 = this;
  4238. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4239. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4240. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4241. // Don't move modal's DOM position
  4242. document.body.appendChild(this._element);
  4243. }
  4244. this._element.style.display = 'block';
  4245. this._element.removeAttribute('aria-hidden');
  4246. this._element.setAttribute('aria-modal', true);
  4247. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4248. modalBody.scrollTop = 0;
  4249. } else {
  4250. this._element.scrollTop = 0;
  4251. }
  4252. if (transition) {
  4253. Util.reflow(this._element);
  4254. }
  4255. $(this._element).addClass(ClassName$5.SHOW);
  4256. if (this._config.focus) {
  4257. this._enforceFocus();
  4258. }
  4259. var shownEvent = $.Event(Event$5.SHOWN, {
  4260. relatedTarget: relatedTarget
  4261. });
  4262. var transitionComplete = function transitionComplete() {
  4263. if (_this4._config.focus) {
  4264. _this4._element.focus();
  4265. }
  4266. _this4._isTransitioning = false;
  4267. $(_this4._element).trigger(shownEvent);
  4268. };
  4269. if (transition) {
  4270. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4271. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4272. } else {
  4273. transitionComplete();
  4274. }
  4275. };
  4276. _proto._enforceFocus = function _enforceFocus() {
  4277. var _this5 = this;
  4278. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4279. .on(Event$5.FOCUSIN, function (event) {
  4280. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4281. _this5._element.focus();
  4282. }
  4283. });
  4284. };
  4285. _proto._setEscapeEvent = function _setEscapeEvent() {
  4286. var _this6 = this;
  4287. if (this._isShown && this._config.keyboard) {
  4288. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4289. if (event.which === ESCAPE_KEYCODE$1) {
  4290. _this6._triggerBackdropTransition();
  4291. }
  4292. });
  4293. } else if (!this._isShown) {
  4294. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4295. }
  4296. };
  4297. _proto._setResizeEvent = function _setResizeEvent() {
  4298. var _this7 = this;
  4299. if (this._isShown) {
  4300. $(window).on(Event$5.RESIZE, function (event) {
  4301. return _this7.handleUpdate(event);
  4302. });
  4303. } else {
  4304. $(window).off(Event$5.RESIZE);
  4305. }
  4306. };
  4307. _proto._hideModal = function _hideModal() {
  4308. var _this8 = this;
  4309. this._element.style.display = 'none';
  4310. this._element.setAttribute('aria-hidden', true);
  4311. this._element.removeAttribute('aria-modal');
  4312. this._isTransitioning = false;
  4313. this._showBackdrop(function () {
  4314. $(document.body).removeClass(ClassName$5.OPEN);
  4315. _this8._resetAdjustments();
  4316. _this8._resetScrollbar();
  4317. $(_this8._element).trigger(Event$5.HIDDEN);
  4318. });
  4319. };
  4320. _proto._removeBackdrop = function _removeBackdrop() {
  4321. if (this._backdrop) {
  4322. $(this._backdrop).remove();
  4323. this._backdrop = null;
  4324. }
  4325. };
  4326. _proto._showBackdrop = function _showBackdrop(callback) {
  4327. var _this9 = this;
  4328. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4329. if (this._isShown && this._config.backdrop) {
  4330. this._backdrop = document.createElement('div');
  4331. this._backdrop.className = ClassName$5.BACKDROP;
  4332. if (animate) {
  4333. this._backdrop.classList.add(animate);
  4334. }
  4335. $(this._backdrop).appendTo(document.body);
  4336. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4337. if (_this9._ignoreBackdropClick) {
  4338. _this9._ignoreBackdropClick = false;
  4339. return;
  4340. }
  4341. if (event.target !== event.currentTarget) {
  4342. return;
  4343. }
  4344. _this9._triggerBackdropTransition();
  4345. });
  4346. if (animate) {
  4347. Util.reflow(this._backdrop);
  4348. }
  4349. $(this._backdrop).addClass(ClassName$5.SHOW);
  4350. if (!callback) {
  4351. return;
  4352. }
  4353. if (!animate) {
  4354. callback();
  4355. return;
  4356. }
  4357. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4358. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4359. } else if (!this._isShown && this._backdrop) {
  4360. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4361. var callbackRemove = function callbackRemove() {
  4362. _this9._removeBackdrop();
  4363. if (callback) {
  4364. callback();
  4365. }
  4366. };
  4367. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4368. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4369. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4370. } else {
  4371. callbackRemove();
  4372. }
  4373. } else if (callback) {
  4374. callback();
  4375. }
  4376. } // ----------------------------------------------------------------------
  4377. // the following methods are used to handle overflowing modals
  4378. // todo (fat): these should probably be refactored out of modal.js
  4379. // ----------------------------------------------------------------------
  4380. ;
  4381. _proto._adjustDialog = function _adjustDialog() {
  4382. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4383. if (!this._isBodyOverflowing && isModalOverflowing) {
  4384. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4385. }
  4386. if (this._isBodyOverflowing && !isModalOverflowing) {
  4387. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4388. }
  4389. };
  4390. _proto._resetAdjustments = function _resetAdjustments() {
  4391. this._element.style.paddingLeft = '';
  4392. this._element.style.paddingRight = '';
  4393. };
  4394. _proto._checkScrollbar = function _checkScrollbar() {
  4395. var rect = document.body.getBoundingClientRect();
  4396. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4397. this._scrollbarWidth = this._getScrollbarWidth();
  4398. };
  4399. _proto._setScrollbar = function _setScrollbar() {
  4400. var _this10 = this;
  4401. if (this._isBodyOverflowing) {
  4402. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4403. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4404. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4405. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4406. $(fixedContent).each(function (index, element) {
  4407. var actualPadding = element.style.paddingRight;
  4408. var calculatedPadding = $(element).css('padding-right');
  4409. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4410. }); // Adjust sticky content margin
  4411. $(stickyContent).each(function (index, element) {
  4412. var actualMargin = element.style.marginRight;
  4413. var calculatedMargin = $(element).css('margin-right');
  4414. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4415. }); // Adjust body padding
  4416. var actualPadding = document.body.style.paddingRight;
  4417. var calculatedPadding = $(document.body).css('padding-right');
  4418. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4419. }
  4420. $(document.body).addClass(ClassName$5.OPEN);
  4421. };
  4422. _proto._resetScrollbar = function _resetScrollbar() {
  4423. // Restore fixed content padding
  4424. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4425. $(fixedContent).each(function (index, element) {
  4426. var padding = $(element).data('padding-right');
  4427. $(element).removeData('padding-right');
  4428. element.style.paddingRight = padding ? padding : '';
  4429. }); // Restore sticky content
  4430. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4431. $(elements).each(function (index, element) {
  4432. var margin = $(element).data('margin-right');
  4433. if (typeof margin !== 'undefined') {
  4434. $(element).css('margin-right', margin).removeData('margin-right');
  4435. }
  4436. }); // Restore body padding
  4437. var padding = $(document.body).data('padding-right');
  4438. $(document.body).removeData('padding-right');
  4439. document.body.style.paddingRight = padding ? padding : '';
  4440. };
  4441. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4442. // thx d.walsh
  4443. var scrollDiv = document.createElement('div');
  4444. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4445. document.body.appendChild(scrollDiv);
  4446. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4447. document.body.removeChild(scrollDiv);
  4448. return scrollbarWidth;
  4449. } // Static
  4450. ;
  4451. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4452. return this.each(function () {
  4453. var data = $(this).data(DATA_KEY$5);
  4454. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4455. if (!data) {
  4456. data = new Modal(this, _config);
  4457. $(this).data(DATA_KEY$5, data);
  4458. }
  4459. if (typeof config === 'string') {
  4460. if (typeof data[config] === 'undefined') {
  4461. throw new TypeError("No method named \"" + config + "\"");
  4462. }
  4463. data[config](relatedTarget);
  4464. } else if (_config.show) {
  4465. data.show(relatedTarget);
  4466. }
  4467. });
  4468. };
  4469. _createClass(Modal, null, [{
  4470. key: "VERSION",
  4471. get: function get() {
  4472. return VERSION$5;
  4473. }
  4474. }, {
  4475. key: "Default",
  4476. get: function get() {
  4477. return Default$3;
  4478. }
  4479. }]);
  4480. return Modal;
  4481. }();
  4482. /**
  4483. * ------------------------------------------------------------------------
  4484. * Data Api implementation
  4485. * ------------------------------------------------------------------------
  4486. */
  4487. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4488. var _this11 = this;
  4489. var target;
  4490. var selector = Util.getSelectorFromElement(this);
  4491. if (selector) {
  4492. target = document.querySelector(selector);
  4493. }
  4494. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4495. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4496. event.preventDefault();
  4497. }
  4498. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4499. if (showEvent.isDefaultPrevented()) {
  4500. // Only register focus restorer if modal will actually get shown
  4501. return;
  4502. }
  4503. $target.one(Event$5.HIDDEN, function () {
  4504. if ($(_this11).is(':visible')) {
  4505. _this11.focus();
  4506. }
  4507. });
  4508. });
  4509. Modal._jQueryInterface.call($(target), config, this);
  4510. });
  4511. /**
  4512. * ------------------------------------------------------------------------
  4513. * jQuery
  4514. * ------------------------------------------------------------------------
  4515. */
  4516. $.fn[NAME$5] = Modal._jQueryInterface;
  4517. $.fn[NAME$5].Constructor = Modal;
  4518. $.fn[NAME$5].noConflict = function () {
  4519. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4520. return Modal._jQueryInterface;
  4521. };
  4522. /**
  4523. * --------------------------------------------------------------------------
  4524. * Bootstrap (v4.4.1): tools/sanitizer.js
  4525. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4526. * --------------------------------------------------------------------------
  4527. */
  4528. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4529. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4530. var DefaultWhitelist = {
  4531. // Global attributes allowed on any supplied element below.
  4532. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4533. a: ['target', 'href', 'title', 'rel'],
  4534. area: [],
  4535. b: [],
  4536. br: [],
  4537. col: [],
  4538. code: [],
  4539. div: [],
  4540. em: [],
  4541. hr: [],
  4542. h1: [],
  4543. h2: [],
  4544. h3: [],
  4545. h4: [],
  4546. h5: [],
  4547. h6: [],
  4548. i: [],
  4549. img: ['src', 'alt', 'title', 'width', 'height'],
  4550. li: [],
  4551. ol: [],
  4552. p: [],
  4553. pre: [],
  4554. s: [],
  4555. small: [],
  4556. span: [],
  4557. sub: [],
  4558. sup: [],
  4559. strong: [],
  4560. u: [],
  4561. ul: []
  4562. };
  4563. /**
  4564. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4565. *
  4566. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4567. */
  4568. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4569. /**
  4570. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4571. *
  4572. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4573. */
  4574. 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;
  4575. function allowedAttribute(attr, allowedAttributeList) {
  4576. var attrName = attr.nodeName.toLowerCase();
  4577. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4578. if (uriAttrs.indexOf(attrName) !== -1) {
  4579. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4580. }
  4581. return true;
  4582. }
  4583. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4584. return attrRegex instanceof RegExp;
  4585. }); // Check if a regular expression validates the attribute.
  4586. for (var i = 0, l = regExp.length; i < l; i++) {
  4587. if (attrName.match(regExp[i])) {
  4588. return true;
  4589. }
  4590. }
  4591. return false;
  4592. }
  4593. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4594. if (unsafeHtml.length === 0) {
  4595. return unsafeHtml;
  4596. }
  4597. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4598. return sanitizeFn(unsafeHtml);
  4599. }
  4600. var domParser = new window.DOMParser();
  4601. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4602. var whitelistKeys = Object.keys(whiteList);
  4603. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4604. var _loop = function _loop(i, len) {
  4605. var el = elements[i];
  4606. var elName = el.nodeName.toLowerCase();
  4607. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4608. el.parentNode.removeChild(el);
  4609. return "continue";
  4610. }
  4611. var attributeList = [].slice.call(el.attributes);
  4612. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4613. attributeList.forEach(function (attr) {
  4614. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4615. el.removeAttribute(attr.nodeName);
  4616. }
  4617. });
  4618. };
  4619. for (var i = 0, len = elements.length; i < len; i++) {
  4620. var _ret = _loop(i);
  4621. if (_ret === "continue") continue;
  4622. }
  4623. return createdDocument.body.innerHTML;
  4624. }
  4625. /**
  4626. * ------------------------------------------------------------------------
  4627. * Constants
  4628. * ------------------------------------------------------------------------
  4629. */
  4630. var NAME$6 = 'tooltip';
  4631. var VERSION$6 = '4.4.1';
  4632. var DATA_KEY$6 = 'bs.tooltip';
  4633. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4634. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4635. var CLASS_PREFIX = 'bs-tooltip';
  4636. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4637. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4638. var DefaultType$4 = {
  4639. animation: 'boolean',
  4640. template: 'string',
  4641. title: '(string|element|function)',
  4642. trigger: 'string',
  4643. delay: '(number|object)',
  4644. html: 'boolean',
  4645. selector: '(string|boolean)',
  4646. placement: '(string|function)',
  4647. offset: '(number|string|function)',
  4648. container: '(string|element|boolean)',
  4649. fallbackPlacement: '(string|array)',
  4650. boundary: '(string|element)',
  4651. sanitize: 'boolean',
  4652. sanitizeFn: '(null|function)',
  4653. whiteList: 'object',
  4654. popperConfig: '(null|object)'
  4655. };
  4656. var AttachmentMap$1 = {
  4657. AUTO: 'auto',
  4658. TOP: 'top',
  4659. RIGHT: 'right',
  4660. BOTTOM: 'bottom',
  4661. LEFT: 'left'
  4662. };
  4663. var Default$4 = {
  4664. animation: true,
  4665. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4666. trigger: 'hover focus',
  4667. title: '',
  4668. delay: 0,
  4669. html: false,
  4670. selector: false,
  4671. placement: 'top',
  4672. offset: 0,
  4673. container: false,
  4674. fallbackPlacement: 'flip',
  4675. boundary: 'scrollParent',
  4676. sanitize: true,
  4677. sanitizeFn: null,
  4678. whiteList: DefaultWhitelist,
  4679. popperConfig: null
  4680. };
  4681. var HoverState = {
  4682. SHOW: 'show',
  4683. OUT: 'out'
  4684. };
  4685. var Event$6 = {
  4686. HIDE: "hide" + EVENT_KEY$6,
  4687. HIDDEN: "hidden" + EVENT_KEY$6,
  4688. SHOW: "show" + EVENT_KEY$6,
  4689. SHOWN: "shown" + EVENT_KEY$6,
  4690. INSERTED: "inserted" + EVENT_KEY$6,
  4691. CLICK: "click" + EVENT_KEY$6,
  4692. FOCUSIN: "focusin" + EVENT_KEY$6,
  4693. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4694. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4695. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4696. };
  4697. var ClassName$6 = {
  4698. FADE: 'fade',
  4699. SHOW: 'show'
  4700. };
  4701. var Selector$6 = {
  4702. TOOLTIP: '.tooltip',
  4703. TOOLTIP_INNER: '.tooltip-inner',
  4704. ARROW: '.arrow'
  4705. };
  4706. var Trigger = {
  4707. HOVER: 'hover',
  4708. FOCUS: 'focus',
  4709. CLICK: 'click',
  4710. MANUAL: 'manual'
  4711. };
  4712. /**
  4713. * ------------------------------------------------------------------------
  4714. * Class Definition
  4715. * ------------------------------------------------------------------------
  4716. */
  4717. var Tooltip =
  4718. /*#__PURE__*/
  4719. function () {
  4720. function Tooltip(element, config) {
  4721. if (typeof Popper === 'undefined') {
  4722. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4723. } // private
  4724. this._isEnabled = true;
  4725. this._timeout = 0;
  4726. this._hoverState = '';
  4727. this._activeTrigger = {};
  4728. this._popper = null; // Protected
  4729. this.element = element;
  4730. this.config = this._getConfig(config);
  4731. this.tip = null;
  4732. this._setListeners();
  4733. } // Getters
  4734. var _proto = Tooltip.prototype;
  4735. // Public
  4736. _proto.enable = function enable() {
  4737. this._isEnabled = true;
  4738. };
  4739. _proto.disable = function disable() {
  4740. this._isEnabled = false;
  4741. };
  4742. _proto.toggleEnabled = function toggleEnabled() {
  4743. this._isEnabled = !this._isEnabled;
  4744. };
  4745. _proto.toggle = function toggle(event) {
  4746. if (!this._isEnabled) {
  4747. return;
  4748. }
  4749. if (event) {
  4750. var dataKey = this.constructor.DATA_KEY;
  4751. var context = $(event.currentTarget).data(dataKey);
  4752. if (!context) {
  4753. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4754. $(event.currentTarget).data(dataKey, context);
  4755. }
  4756. context._activeTrigger.click = !context._activeTrigger.click;
  4757. if (context._isWithActiveTrigger()) {
  4758. context._enter(null, context);
  4759. } else {
  4760. context._leave(null, context);
  4761. }
  4762. } else {
  4763. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4764. this._leave(null, this);
  4765. return;
  4766. }
  4767. this._enter(null, this);
  4768. }
  4769. };
  4770. _proto.dispose = function dispose() {
  4771. clearTimeout(this._timeout);
  4772. $.removeData(this.element, this.constructor.DATA_KEY);
  4773. $(this.element).off(this.constructor.EVENT_KEY);
  4774. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4775. if (this.tip) {
  4776. $(this.tip).remove();
  4777. }
  4778. this._isEnabled = null;
  4779. this._timeout = null;
  4780. this._hoverState = null;
  4781. this._activeTrigger = null;
  4782. if (this._popper) {
  4783. this._popper.destroy();
  4784. }
  4785. this._popper = null;
  4786. this.element = null;
  4787. this.config = null;
  4788. this.tip = null;
  4789. };
  4790. _proto.show = function show() {
  4791. var _this = this;
  4792. if ($(this.element).css('display') === 'none') {
  4793. throw new Error('Please use show on visible elements');
  4794. }
  4795. var showEvent = $.Event(this.constructor.Event.SHOW);
  4796. if (this.isWithContent() && this._isEnabled) {
  4797. $(this.element).trigger(showEvent);
  4798. var shadowRoot = Util.findShadowRoot(this.element);
  4799. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4800. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4801. return;
  4802. }
  4803. var tip = this.getTipElement();
  4804. var tipId = Util.getUID(this.constructor.NAME);
  4805. tip.setAttribute('id', tipId);
  4806. this.element.setAttribute('aria-describedby', tipId);
  4807. this.setContent();
  4808. if (this.config.animation) {
  4809. $(tip).addClass(ClassName$6.FADE);
  4810. }
  4811. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4812. var attachment = this._getAttachment(placement);
  4813. this.addAttachmentClass(attachment);
  4814. var container = this._getContainer();
  4815. $(tip).data(this.constructor.DATA_KEY, this);
  4816. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4817. $(tip).appendTo(container);
  4818. }
  4819. $(this.element).trigger(this.constructor.Event.INSERTED);
  4820. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4821. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4822. // empty mouseover listeners to the body's immediate children;
  4823. // only needed because of broken event delegation on iOS
  4824. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4825. if ('ontouchstart' in document.documentElement) {
  4826. $(document.body).children().on('mouseover', null, $.noop);
  4827. }
  4828. var complete = function complete() {
  4829. if (_this.config.animation) {
  4830. _this._fixTransition();
  4831. }
  4832. var prevHoverState = _this._hoverState;
  4833. _this._hoverState = null;
  4834. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4835. if (prevHoverState === HoverState.OUT) {
  4836. _this._leave(null, _this);
  4837. }
  4838. };
  4839. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4840. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4841. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4842. } else {
  4843. complete();
  4844. }
  4845. }
  4846. };
  4847. _proto.hide = function hide(callback) {
  4848. var _this2 = this;
  4849. var tip = this.getTipElement();
  4850. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4851. var complete = function complete() {
  4852. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4853. tip.parentNode.removeChild(tip);
  4854. }
  4855. _this2._cleanTipClass();
  4856. _this2.element.removeAttribute('aria-describedby');
  4857. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4858. if (_this2._popper !== null) {
  4859. _this2._popper.destroy();
  4860. }
  4861. if (callback) {
  4862. callback();
  4863. }
  4864. };
  4865. $(this.element).trigger(hideEvent);
  4866. if (hideEvent.isDefaultPrevented()) {
  4867. return;
  4868. }
  4869. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4870. // empty mouseover listeners we added for iOS support
  4871. if ('ontouchstart' in document.documentElement) {
  4872. $(document.body).children().off('mouseover', null, $.noop);
  4873. }
  4874. this._activeTrigger[Trigger.CLICK] = false;
  4875. this._activeTrigger[Trigger.FOCUS] = false;
  4876. this._activeTrigger[Trigger.HOVER] = false;
  4877. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4878. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4879. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4880. } else {
  4881. complete();
  4882. }
  4883. this._hoverState = '';
  4884. };
  4885. _proto.update = function update() {
  4886. if (this._popper !== null) {
  4887. this._popper.scheduleUpdate();
  4888. }
  4889. } // Protected
  4890. ;
  4891. _proto.isWithContent = function isWithContent() {
  4892. return Boolean(this.getTitle());
  4893. };
  4894. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4895. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4896. };
  4897. _proto.getTipElement = function getTipElement() {
  4898. this.tip = this.tip || $(this.config.template)[0];
  4899. return this.tip;
  4900. };
  4901. _proto.setContent = function setContent() {
  4902. var tip = this.getTipElement();
  4903. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4904. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4905. };
  4906. _proto.setElementContent = function setElementContent($element, content) {
  4907. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4908. // Content is a DOM node or a jQuery
  4909. if (this.config.html) {
  4910. if (!$(content).parent().is($element)) {
  4911. $element.empty().append(content);
  4912. }
  4913. } else {
  4914. $element.text($(content).text());
  4915. }
  4916. return;
  4917. }
  4918. if (this.config.html) {
  4919. if (this.config.sanitize) {
  4920. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4921. }
  4922. $element.html(content);
  4923. } else {
  4924. $element.text(content);
  4925. }
  4926. };
  4927. _proto.getTitle = function getTitle() {
  4928. var title = this.element.getAttribute('data-original-title');
  4929. if (!title) {
  4930. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4931. }
  4932. return title;
  4933. } // Private
  4934. ;
  4935. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4936. var _this3 = this;
  4937. var defaultBsConfig = {
  4938. placement: attachment,
  4939. modifiers: {
  4940. offset: this._getOffset(),
  4941. flip: {
  4942. behavior: this.config.fallbackPlacement
  4943. },
  4944. arrow: {
  4945. element: Selector$6.ARROW
  4946. },
  4947. preventOverflow: {
  4948. boundariesElement: this.config.boundary
  4949. }
  4950. },
  4951. onCreate: function onCreate(data) {
  4952. if (data.originalPlacement !== data.placement) {
  4953. _this3._handlePopperPlacementChange(data);
  4954. }
  4955. },
  4956. onUpdate: function onUpdate(data) {
  4957. return _this3._handlePopperPlacementChange(data);
  4958. }
  4959. };
  4960. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4961. };
  4962. _proto._getOffset = function _getOffset() {
  4963. var _this4 = this;
  4964. var offset = {};
  4965. if (typeof this.config.offset === 'function') {
  4966. offset.fn = function (data) {
  4967. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4968. return data;
  4969. };
  4970. } else {
  4971. offset.offset = this.config.offset;
  4972. }
  4973. return offset;
  4974. };
  4975. _proto._getContainer = function _getContainer() {
  4976. if (this.config.container === false) {
  4977. return document.body;
  4978. }
  4979. if (Util.isElement(this.config.container)) {
  4980. return $(this.config.container);
  4981. }
  4982. return $(document).find(this.config.container);
  4983. };
  4984. _proto._getAttachment = function _getAttachment(placement) {
  4985. return AttachmentMap$1[placement.toUpperCase()];
  4986. };
  4987. _proto._setListeners = function _setListeners() {
  4988. var _this5 = this;
  4989. var triggers = this.config.trigger.split(' ');
  4990. triggers.forEach(function (trigger) {
  4991. if (trigger === 'click') {
  4992. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4993. return _this5.toggle(event);
  4994. });
  4995. } else if (trigger !== Trigger.MANUAL) {
  4996. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4997. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4998. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4999. return _this5._enter(event);
  5000. }).on(eventOut, _this5.config.selector, function (event) {
  5001. return _this5._leave(event);
  5002. });
  5003. }
  5004. });
  5005. this._hideModalHandler = function () {
  5006. if (_this5.element) {
  5007. _this5.hide();
  5008. }
  5009. };
  5010. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5011. if (this.config.selector) {
  5012. this.config = _objectSpread2({}, this.config, {
  5013. trigger: 'manual',
  5014. selector: ''
  5015. });
  5016. } else {
  5017. this._fixTitle();
  5018. }
  5019. };
  5020. _proto._fixTitle = function _fixTitle() {
  5021. var titleType = typeof this.element.getAttribute('data-original-title');
  5022. if (this.element.getAttribute('title') || titleType !== 'string') {
  5023. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5024. this.element.setAttribute('title', '');
  5025. }
  5026. };
  5027. _proto._enter = function _enter(event, context) {
  5028. var dataKey = this.constructor.DATA_KEY;
  5029. context = context || $(event.currentTarget).data(dataKey);
  5030. if (!context) {
  5031. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5032. $(event.currentTarget).data(dataKey, context);
  5033. }
  5034. if (event) {
  5035. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5036. }
  5037. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5038. context._hoverState = HoverState.SHOW;
  5039. return;
  5040. }
  5041. clearTimeout(context._timeout);
  5042. context._hoverState = HoverState.SHOW;
  5043. if (!context.config.delay || !context.config.delay.show) {
  5044. context.show();
  5045. return;
  5046. }
  5047. context._timeout = setTimeout(function () {
  5048. if (context._hoverState === HoverState.SHOW) {
  5049. context.show();
  5050. }
  5051. }, context.config.delay.show);
  5052. };
  5053. _proto._leave = function _leave(event, context) {
  5054. var dataKey = this.constructor.DATA_KEY;
  5055. context = context || $(event.currentTarget).data(dataKey);
  5056. if (!context) {
  5057. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5058. $(event.currentTarget).data(dataKey, context);
  5059. }
  5060. if (event) {
  5061. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5062. }
  5063. if (context._isWithActiveTrigger()) {
  5064. return;
  5065. }
  5066. clearTimeout(context._timeout);
  5067. context._hoverState = HoverState.OUT;
  5068. if (!context.config.delay || !context.config.delay.hide) {
  5069. context.hide();
  5070. return;
  5071. }
  5072. context._timeout = setTimeout(function () {
  5073. if (context._hoverState === HoverState.OUT) {
  5074. context.hide();
  5075. }
  5076. }, context.config.delay.hide);
  5077. };
  5078. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5079. for (var trigger in this._activeTrigger) {
  5080. if (this._activeTrigger[trigger]) {
  5081. return true;
  5082. }
  5083. }
  5084. return false;
  5085. };
  5086. _proto._getConfig = function _getConfig(config) {
  5087. var dataAttributes = $(this.element).data();
  5088. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5089. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5090. delete dataAttributes[dataAttr];
  5091. }
  5092. });
  5093. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5094. if (typeof config.delay === 'number') {
  5095. config.delay = {
  5096. show: config.delay,
  5097. hide: config.delay
  5098. };
  5099. }
  5100. if (typeof config.title === 'number') {
  5101. config.title = config.title.toString();
  5102. }
  5103. if (typeof config.content === 'number') {
  5104. config.content = config.content.toString();
  5105. }
  5106. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5107. if (config.sanitize) {
  5108. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5109. }
  5110. return config;
  5111. };
  5112. _proto._getDelegateConfig = function _getDelegateConfig() {
  5113. var config = {};
  5114. if (this.config) {
  5115. for (var key in this.config) {
  5116. if (this.constructor.Default[key] !== this.config[key]) {
  5117. config[key] = this.config[key];
  5118. }
  5119. }
  5120. }
  5121. return config;
  5122. };
  5123. _proto._cleanTipClass = function _cleanTipClass() {
  5124. var $tip = $(this.getTipElement());
  5125. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5126. if (tabClass !== null && tabClass.length) {
  5127. $tip.removeClass(tabClass.join(''));
  5128. }
  5129. };
  5130. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5131. var popperInstance = popperData.instance;
  5132. this.tip = popperInstance.popper;
  5133. this._cleanTipClass();
  5134. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5135. };
  5136. _proto._fixTransition = function _fixTransition() {
  5137. var tip = this.getTipElement();
  5138. var initConfigAnimation = this.config.animation;
  5139. if (tip.getAttribute('x-placement') !== null) {
  5140. return;
  5141. }
  5142. $(tip).removeClass(ClassName$6.FADE);
  5143. this.config.animation = false;
  5144. this.hide();
  5145. this.show();
  5146. this.config.animation = initConfigAnimation;
  5147. } // Static
  5148. ;
  5149. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5150. return this.each(function () {
  5151. var data = $(this).data(DATA_KEY$6);
  5152. var _config = typeof config === 'object' && config;
  5153. if (!data && /dispose|hide/.test(config)) {
  5154. return;
  5155. }
  5156. if (!data) {
  5157. data = new Tooltip(this, _config);
  5158. $(this).data(DATA_KEY$6, data);
  5159. }
  5160. if (typeof config === 'string') {
  5161. if (typeof data[config] === 'undefined') {
  5162. throw new TypeError("No method named \"" + config + "\"");
  5163. }
  5164. data[config]();
  5165. }
  5166. });
  5167. };
  5168. _createClass(Tooltip, null, [{
  5169. key: "VERSION",
  5170. get: function get() {
  5171. return VERSION$6;
  5172. }
  5173. }, {
  5174. key: "Default",
  5175. get: function get() {
  5176. return Default$4;
  5177. }
  5178. }, {
  5179. key: "NAME",
  5180. get: function get() {
  5181. return NAME$6;
  5182. }
  5183. }, {
  5184. key: "DATA_KEY",
  5185. get: function get() {
  5186. return DATA_KEY$6;
  5187. }
  5188. }, {
  5189. key: "Event",
  5190. get: function get() {
  5191. return Event$6;
  5192. }
  5193. }, {
  5194. key: "EVENT_KEY",
  5195. get: function get() {
  5196. return EVENT_KEY$6;
  5197. }
  5198. }, {
  5199. key: "DefaultType",
  5200. get: function get() {
  5201. return DefaultType$4;
  5202. }
  5203. }]);
  5204. return Tooltip;
  5205. }();
  5206. /**
  5207. * ------------------------------------------------------------------------
  5208. * jQuery
  5209. * ------------------------------------------------------------------------
  5210. */
  5211. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5212. $.fn[NAME$6].Constructor = Tooltip;
  5213. $.fn[NAME$6].noConflict = function () {
  5214. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5215. return Tooltip._jQueryInterface;
  5216. };
  5217. /**
  5218. * ------------------------------------------------------------------------
  5219. * Constants
  5220. * ------------------------------------------------------------------------
  5221. */
  5222. var NAME$7 = 'popover';
  5223. var VERSION$7 = '4.4.1';
  5224. var DATA_KEY$7 = 'bs.popover';
  5225. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5226. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5227. var CLASS_PREFIX$1 = 'bs-popover';
  5228. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5229. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5230. placement: 'right',
  5231. trigger: 'click',
  5232. content: '',
  5233. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5234. });
  5235. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5236. content: '(string|element|function)'
  5237. });
  5238. var ClassName$7 = {
  5239. FADE: 'fade',
  5240. SHOW: 'show'
  5241. };
  5242. var Selector$7 = {
  5243. TITLE: '.popover-header',
  5244. CONTENT: '.popover-body'
  5245. };
  5246. var Event$7 = {
  5247. HIDE: "hide" + EVENT_KEY$7,
  5248. HIDDEN: "hidden" + EVENT_KEY$7,
  5249. SHOW: "show" + EVENT_KEY$7,
  5250. SHOWN: "shown" + EVENT_KEY$7,
  5251. INSERTED: "inserted" + EVENT_KEY$7,
  5252. CLICK: "click" + EVENT_KEY$7,
  5253. FOCUSIN: "focusin" + EVENT_KEY$7,
  5254. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5255. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5256. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5257. };
  5258. /**
  5259. * ------------------------------------------------------------------------
  5260. * Class Definition
  5261. * ------------------------------------------------------------------------
  5262. */
  5263. var Popover =
  5264. /*#__PURE__*/
  5265. function (_Tooltip) {
  5266. _inheritsLoose(Popover, _Tooltip);
  5267. function Popover() {
  5268. return _Tooltip.apply(this, arguments) || this;
  5269. }
  5270. var _proto = Popover.prototype;
  5271. // Overrides
  5272. _proto.isWithContent = function isWithContent() {
  5273. return this.getTitle() || this._getContent();
  5274. };
  5275. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5276. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5277. };
  5278. _proto.getTipElement = function getTipElement() {
  5279. this.tip = this.tip || $(this.config.template)[0];
  5280. return this.tip;
  5281. };
  5282. _proto.setContent = function setContent() {
  5283. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5284. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5285. var content = this._getContent();
  5286. if (typeof content === 'function') {
  5287. content = content.call(this.element);
  5288. }
  5289. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5290. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5291. } // Private
  5292. ;
  5293. _proto._getContent = function _getContent() {
  5294. return this.element.getAttribute('data-content') || this.config.content;
  5295. };
  5296. _proto._cleanTipClass = function _cleanTipClass() {
  5297. var $tip = $(this.getTipElement());
  5298. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5299. if (tabClass !== null && tabClass.length > 0) {
  5300. $tip.removeClass(tabClass.join(''));
  5301. }
  5302. } // Static
  5303. ;
  5304. Popover._jQueryInterface = function _jQueryInterface(config) {
  5305. return this.each(function () {
  5306. var data = $(this).data(DATA_KEY$7);
  5307. var _config = typeof config === 'object' ? config : null;
  5308. if (!data && /dispose|hide/.test(config)) {
  5309. return;
  5310. }
  5311. if (!data) {
  5312. data = new Popover(this, _config);
  5313. $(this).data(DATA_KEY$7, data);
  5314. }
  5315. if (typeof config === 'string') {
  5316. if (typeof data[config] === 'undefined') {
  5317. throw new TypeError("No method named \"" + config + "\"");
  5318. }
  5319. data[config]();
  5320. }
  5321. });
  5322. };
  5323. _createClass(Popover, null, [{
  5324. key: "VERSION",
  5325. // Getters
  5326. get: function get() {
  5327. return VERSION$7;
  5328. }
  5329. }, {
  5330. key: "Default",
  5331. get: function get() {
  5332. return Default$5;
  5333. }
  5334. }, {
  5335. key: "NAME",
  5336. get: function get() {
  5337. return NAME$7;
  5338. }
  5339. }, {
  5340. key: "DATA_KEY",
  5341. get: function get() {
  5342. return DATA_KEY$7;
  5343. }
  5344. }, {
  5345. key: "Event",
  5346. get: function get() {
  5347. return Event$7;
  5348. }
  5349. }, {
  5350. key: "EVENT_KEY",
  5351. get: function get() {
  5352. return EVENT_KEY$7;
  5353. }
  5354. }, {
  5355. key: "DefaultType",
  5356. get: function get() {
  5357. return DefaultType$5;
  5358. }
  5359. }]);
  5360. return Popover;
  5361. }(Tooltip);
  5362. /**
  5363. * ------------------------------------------------------------------------
  5364. * jQuery
  5365. * ------------------------------------------------------------------------
  5366. */
  5367. $.fn[NAME$7] = Popover._jQueryInterface;
  5368. $.fn[NAME$7].Constructor = Popover;
  5369. $.fn[NAME$7].noConflict = function () {
  5370. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5371. return Popover._jQueryInterface;
  5372. };
  5373. /**
  5374. * ------------------------------------------------------------------------
  5375. * Constants
  5376. * ------------------------------------------------------------------------
  5377. */
  5378. var NAME$8 = 'scrollspy';
  5379. var VERSION$8 = '4.4.1';
  5380. var DATA_KEY$8 = 'bs.scrollspy';
  5381. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5382. var DATA_API_KEY$6 = '.data-api';
  5383. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5384. var Default$6 = {
  5385. offset: 10,
  5386. method: 'auto',
  5387. target: ''
  5388. };
  5389. var DefaultType$6 = {
  5390. offset: 'number',
  5391. method: 'string',
  5392. target: '(string|element)'
  5393. };
  5394. var Event$8 = {
  5395. ACTIVATE: "activate" + EVENT_KEY$8,
  5396. SCROLL: "scroll" + EVENT_KEY$8,
  5397. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5398. };
  5399. var ClassName$8 = {
  5400. DROPDOWN_ITEM: 'dropdown-item',
  5401. DROPDOWN_MENU: 'dropdown-menu',
  5402. ACTIVE: 'active'
  5403. };
  5404. var Selector$8 = {
  5405. DATA_SPY: '[data-spy="scroll"]',
  5406. ACTIVE: '.active',
  5407. NAV_LIST_GROUP: '.nav, .list-group',
  5408. NAV_LINKS: '.nav-link',
  5409. NAV_ITEMS: '.nav-item',
  5410. LIST_ITEMS: '.list-group-item',
  5411. DROPDOWN: '.dropdown',
  5412. DROPDOWN_ITEMS: '.dropdown-item',
  5413. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5414. };
  5415. var OffsetMethod = {
  5416. OFFSET: 'offset',
  5417. POSITION: 'position'
  5418. };
  5419. /**
  5420. * ------------------------------------------------------------------------
  5421. * Class Definition
  5422. * ------------------------------------------------------------------------
  5423. */
  5424. var ScrollSpy =
  5425. /*#__PURE__*/
  5426. function () {
  5427. function ScrollSpy(element, config) {
  5428. var _this = this;
  5429. this._element = element;
  5430. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5431. this._config = this._getConfig(config);
  5432. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5433. this._offsets = [];
  5434. this._targets = [];
  5435. this._activeTarget = null;
  5436. this._scrollHeight = 0;
  5437. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5438. return _this._process(event);
  5439. });
  5440. this.refresh();
  5441. this._process();
  5442. } // Getters
  5443. var _proto = ScrollSpy.prototype;
  5444. // Public
  5445. _proto.refresh = function refresh() {
  5446. var _this2 = this;
  5447. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5448. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5449. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5450. this._offsets = [];
  5451. this._targets = [];
  5452. this._scrollHeight = this._getScrollHeight();
  5453. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5454. targets.map(function (element) {
  5455. var target;
  5456. var targetSelector = Util.getSelectorFromElement(element);
  5457. if (targetSelector) {
  5458. target = document.querySelector(targetSelector);
  5459. }
  5460. if (target) {
  5461. var targetBCR = target.getBoundingClientRect();
  5462. if (targetBCR.width || targetBCR.height) {
  5463. // TODO (fat): remove sketch reliance on jQuery position/offset
  5464. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5465. }
  5466. }
  5467. return null;
  5468. }).filter(function (item) {
  5469. return item;
  5470. }).sort(function (a, b) {
  5471. return a[0] - b[0];
  5472. }).forEach(function (item) {
  5473. _this2._offsets.push(item[0]);
  5474. _this2._targets.push(item[1]);
  5475. });
  5476. };
  5477. _proto.dispose = function dispose() {
  5478. $.removeData(this._element, DATA_KEY$8);
  5479. $(this._scrollElement).off(EVENT_KEY$8);
  5480. this._element = null;
  5481. this._scrollElement = null;
  5482. this._config = null;
  5483. this._selector = null;
  5484. this._offsets = null;
  5485. this._targets = null;
  5486. this._activeTarget = null;
  5487. this._scrollHeight = null;
  5488. } // Private
  5489. ;
  5490. _proto._getConfig = function _getConfig(config) {
  5491. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5492. if (typeof config.target !== 'string') {
  5493. var id = $(config.target).attr('id');
  5494. if (!id) {
  5495. id = Util.getUID(NAME$8);
  5496. $(config.target).attr('id', id);
  5497. }
  5498. config.target = "#" + id;
  5499. }
  5500. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5501. return config;
  5502. };
  5503. _proto._getScrollTop = function _getScrollTop() {
  5504. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5505. };
  5506. _proto._getScrollHeight = function _getScrollHeight() {
  5507. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5508. };
  5509. _proto._getOffsetHeight = function _getOffsetHeight() {
  5510. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5511. };
  5512. _proto._process = function _process() {
  5513. var scrollTop = this._getScrollTop() + this._config.offset;
  5514. var scrollHeight = this._getScrollHeight();
  5515. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5516. if (this._scrollHeight !== scrollHeight) {
  5517. this.refresh();
  5518. }
  5519. if (scrollTop >= maxScroll) {
  5520. var target = this._targets[this._targets.length - 1];
  5521. if (this._activeTarget !== target) {
  5522. this._activate(target);
  5523. }
  5524. return;
  5525. }
  5526. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5527. this._activeTarget = null;
  5528. this._clear();
  5529. return;
  5530. }
  5531. var offsetLength = this._offsets.length;
  5532. for (var i = offsetLength; i--;) {
  5533. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5534. if (isActiveTarget) {
  5535. this._activate(this._targets[i]);
  5536. }
  5537. }
  5538. };
  5539. _proto._activate = function _activate(target) {
  5540. this._activeTarget = target;
  5541. this._clear();
  5542. var queries = this._selector.split(',').map(function (selector) {
  5543. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5544. });
  5545. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5546. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5547. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5548. $link.addClass(ClassName$8.ACTIVE);
  5549. } else {
  5550. // Set triggered link as active
  5551. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5552. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5553. $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
  5554. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5555. }
  5556. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5557. relatedTarget: target
  5558. });
  5559. };
  5560. _proto._clear = function _clear() {
  5561. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5562. return node.classList.contains(ClassName$8.ACTIVE);
  5563. }).forEach(function (node) {
  5564. return node.classList.remove(ClassName$8.ACTIVE);
  5565. });
  5566. } // Static
  5567. ;
  5568. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5569. return this.each(function () {
  5570. var data = $(this).data(DATA_KEY$8);
  5571. var _config = typeof config === 'object' && config;
  5572. if (!data) {
  5573. data = new ScrollSpy(this, _config);
  5574. $(this).data(DATA_KEY$8, data);
  5575. }
  5576. if (typeof config === 'string') {
  5577. if (typeof data[config] === 'undefined') {
  5578. throw new TypeError("No method named \"" + config + "\"");
  5579. }
  5580. data[config]();
  5581. }
  5582. });
  5583. };
  5584. _createClass(ScrollSpy, null, [{
  5585. key: "VERSION",
  5586. get: function get() {
  5587. return VERSION$8;
  5588. }
  5589. }, {
  5590. key: "Default",
  5591. get: function get() {
  5592. return Default$6;
  5593. }
  5594. }]);
  5595. return ScrollSpy;
  5596. }();
  5597. /**
  5598. * ------------------------------------------------------------------------
  5599. * Data Api implementation
  5600. * ------------------------------------------------------------------------
  5601. */
  5602. $(window).on(Event$8.LOAD_DATA_API, function () {
  5603. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5604. var scrollSpysLength = scrollSpys.length;
  5605. for (var i = scrollSpysLength; i--;) {
  5606. var $spy = $(scrollSpys[i]);
  5607. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5608. }
  5609. });
  5610. /**
  5611. * ------------------------------------------------------------------------
  5612. * jQuery
  5613. * ------------------------------------------------------------------------
  5614. */
  5615. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5616. $.fn[NAME$8].Constructor = ScrollSpy;
  5617. $.fn[NAME$8].noConflict = function () {
  5618. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5619. return ScrollSpy._jQueryInterface;
  5620. };
  5621. /**
  5622. * ------------------------------------------------------------------------
  5623. * Constants
  5624. * ------------------------------------------------------------------------
  5625. */
  5626. var NAME$9 = 'tab';
  5627. var VERSION$9 = '4.4.1';
  5628. var DATA_KEY$9 = 'bs.tab';
  5629. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5630. var DATA_API_KEY$7 = '.data-api';
  5631. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5632. var Event$9 = {
  5633. HIDE: "hide" + EVENT_KEY$9,
  5634. HIDDEN: "hidden" + EVENT_KEY$9,
  5635. SHOW: "show" + EVENT_KEY$9,
  5636. SHOWN: "shown" + EVENT_KEY$9,
  5637. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5638. };
  5639. var ClassName$9 = {
  5640. DROPDOWN_MENU: 'dropdown-menu',
  5641. ACTIVE: 'active',
  5642. DISABLED: 'disabled',
  5643. FADE: 'fade',
  5644. SHOW: 'show'
  5645. };
  5646. var Selector$9 = {
  5647. DROPDOWN: '.dropdown',
  5648. NAV_LIST_GROUP: '.nav, .list-group',
  5649. ACTIVE: '.active',
  5650. ACTIVE_UL: '> li > .active',
  5651. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5652. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5653. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5654. };
  5655. /**
  5656. * ------------------------------------------------------------------------
  5657. * Class Definition
  5658. * ------------------------------------------------------------------------
  5659. */
  5660. var Tab =
  5661. /*#__PURE__*/
  5662. function () {
  5663. function Tab(element) {
  5664. this._element = element;
  5665. } // Getters
  5666. var _proto = Tab.prototype;
  5667. // Public
  5668. _proto.show = function show() {
  5669. var _this = this;
  5670. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5671. return;
  5672. }
  5673. var target;
  5674. var previous;
  5675. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5676. var selector = Util.getSelectorFromElement(this._element);
  5677. if (listElement) {
  5678. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5679. previous = $.makeArray($(listElement).find(itemSelector));
  5680. previous = previous[previous.length - 1];
  5681. }
  5682. var hideEvent = $.Event(Event$9.HIDE, {
  5683. relatedTarget: this._element
  5684. });
  5685. var showEvent = $.Event(Event$9.SHOW, {
  5686. relatedTarget: previous
  5687. });
  5688. if (previous) {
  5689. $(previous).trigger(hideEvent);
  5690. }
  5691. $(this._element).trigger(showEvent);
  5692. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5693. return;
  5694. }
  5695. if (selector) {
  5696. target = document.querySelector(selector);
  5697. }
  5698. this._activate(this._element, listElement);
  5699. var complete = function complete() {
  5700. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5701. relatedTarget: _this._element
  5702. });
  5703. var shownEvent = $.Event(Event$9.SHOWN, {
  5704. relatedTarget: previous
  5705. });
  5706. $(previous).trigger(hiddenEvent);
  5707. $(_this._element).trigger(shownEvent);
  5708. };
  5709. if (target) {
  5710. this._activate(target, target.parentNode, complete);
  5711. } else {
  5712. complete();
  5713. }
  5714. };
  5715. _proto.dispose = function dispose() {
  5716. $.removeData(this._element, DATA_KEY$9);
  5717. this._element = null;
  5718. } // Private
  5719. ;
  5720. _proto._activate = function _activate(element, container, callback) {
  5721. var _this2 = this;
  5722. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5723. var active = activeElements[0];
  5724. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5725. var complete = function complete() {
  5726. return _this2._transitionComplete(element, active, callback);
  5727. };
  5728. if (active && isTransitioning) {
  5729. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5730. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5731. } else {
  5732. complete();
  5733. }
  5734. };
  5735. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5736. if (active) {
  5737. $(active).removeClass(ClassName$9.ACTIVE);
  5738. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5739. if (dropdownChild) {
  5740. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5741. }
  5742. if (active.getAttribute('role') === 'tab') {
  5743. active.setAttribute('aria-selected', false);
  5744. }
  5745. }
  5746. $(element).addClass(ClassName$9.ACTIVE);
  5747. if (element.getAttribute('role') === 'tab') {
  5748. element.setAttribute('aria-selected', true);
  5749. }
  5750. Util.reflow(element);
  5751. if (element.classList.contains(ClassName$9.FADE)) {
  5752. element.classList.add(ClassName$9.SHOW);
  5753. }
  5754. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5755. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5756. if (dropdownElement) {
  5757. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5758. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5759. }
  5760. element.setAttribute('aria-expanded', true);
  5761. }
  5762. if (callback) {
  5763. callback();
  5764. }
  5765. } // Static
  5766. ;
  5767. Tab._jQueryInterface = function _jQueryInterface(config) {
  5768. return this.each(function () {
  5769. var $this = $(this);
  5770. var data = $this.data(DATA_KEY$9);
  5771. if (!data) {
  5772. data = new Tab(this);
  5773. $this.data(DATA_KEY$9, data);
  5774. }
  5775. if (typeof config === 'string') {
  5776. if (typeof data[config] === 'undefined') {
  5777. throw new TypeError("No method named \"" + config + "\"");
  5778. }
  5779. data[config]();
  5780. }
  5781. });
  5782. };
  5783. _createClass(Tab, null, [{
  5784. key: "VERSION",
  5785. get: function get() {
  5786. return VERSION$9;
  5787. }
  5788. }]);
  5789. return Tab;
  5790. }();
  5791. /**
  5792. * ------------------------------------------------------------------------
  5793. * Data Api implementation
  5794. * ------------------------------------------------------------------------
  5795. */
  5796. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5797. event.preventDefault();
  5798. Tab._jQueryInterface.call($(this), 'show');
  5799. });
  5800. /**
  5801. * ------------------------------------------------------------------------
  5802. * jQuery
  5803. * ------------------------------------------------------------------------
  5804. */
  5805. $.fn[NAME$9] = Tab._jQueryInterface;
  5806. $.fn[NAME$9].Constructor = Tab;
  5807. $.fn[NAME$9].noConflict = function () {
  5808. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5809. return Tab._jQueryInterface;
  5810. };
  5811. /**
  5812. * ------------------------------------------------------------------------
  5813. * Constants
  5814. * ------------------------------------------------------------------------
  5815. */
  5816. var NAME$a = 'toast';
  5817. var VERSION$a = '4.4.1';
  5818. var DATA_KEY$a = 'bs.toast';
  5819. var EVENT_KEY$a = "." + DATA_KEY$a;
  5820. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5821. var Event$a = {
  5822. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5823. HIDE: "hide" + EVENT_KEY$a,
  5824. HIDDEN: "hidden" + EVENT_KEY$a,
  5825. SHOW: "show" + EVENT_KEY$a,
  5826. SHOWN: "shown" + EVENT_KEY$a
  5827. };
  5828. var ClassName$a = {
  5829. FADE: 'fade',
  5830. HIDE: 'hide',
  5831. SHOW: 'show',
  5832. SHOWING: 'showing'
  5833. };
  5834. var DefaultType$7 = {
  5835. animation: 'boolean',
  5836. autohide: 'boolean',
  5837. delay: 'number'
  5838. };
  5839. var Default$7 = {
  5840. animation: true,
  5841. autohide: true,
  5842. delay: 500
  5843. };
  5844. var Selector$a = {
  5845. DATA_DISMISS: '[data-dismiss="toast"]'
  5846. };
  5847. /**
  5848. * ------------------------------------------------------------------------
  5849. * Class Definition
  5850. * ------------------------------------------------------------------------
  5851. */
  5852. var Toast =
  5853. /*#__PURE__*/
  5854. function () {
  5855. function Toast(element, config) {
  5856. this._element = element;
  5857. this._config = this._getConfig(config);
  5858. this._timeout = null;
  5859. this._setListeners();
  5860. } // Getters
  5861. var _proto = Toast.prototype;
  5862. // Public
  5863. _proto.show = function show() {
  5864. var _this = this;
  5865. var showEvent = $.Event(Event$a.SHOW);
  5866. $(this._element).trigger(showEvent);
  5867. if (showEvent.isDefaultPrevented()) {
  5868. return;
  5869. }
  5870. if (this._config.animation) {
  5871. this._element.classList.add(ClassName$a.FADE);
  5872. }
  5873. var complete = function complete() {
  5874. _this._element.classList.remove(ClassName$a.SHOWING);
  5875. _this._element.classList.add(ClassName$a.SHOW);
  5876. $(_this._element).trigger(Event$a.SHOWN);
  5877. if (_this._config.autohide) {
  5878. _this._timeout = setTimeout(function () {
  5879. _this.hide();
  5880. }, _this._config.delay);
  5881. }
  5882. };
  5883. this._element.classList.remove(ClassName$a.HIDE);
  5884. Util.reflow(this._element);
  5885. this._element.classList.add(ClassName$a.SHOWING);
  5886. if (this._config.animation) {
  5887. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5888. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5889. } else {
  5890. complete();
  5891. }
  5892. };
  5893. _proto.hide = function hide() {
  5894. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5895. return;
  5896. }
  5897. var hideEvent = $.Event(Event$a.HIDE);
  5898. $(this._element).trigger(hideEvent);
  5899. if (hideEvent.isDefaultPrevented()) {
  5900. return;
  5901. }
  5902. this._close();
  5903. };
  5904. _proto.dispose = function dispose() {
  5905. clearTimeout(this._timeout);
  5906. this._timeout = null;
  5907. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5908. this._element.classList.remove(ClassName$a.SHOW);
  5909. }
  5910. $(this._element).off(Event$a.CLICK_DISMISS);
  5911. $.removeData(this._element, DATA_KEY$a);
  5912. this._element = null;
  5913. this._config = null;
  5914. } // Private
  5915. ;
  5916. _proto._getConfig = function _getConfig(config) {
  5917. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5918. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5919. return config;
  5920. };
  5921. _proto._setListeners = function _setListeners() {
  5922. var _this2 = this;
  5923. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5924. return _this2.hide();
  5925. });
  5926. };
  5927. _proto._close = function _close() {
  5928. var _this3 = this;
  5929. var complete = function complete() {
  5930. _this3._element.classList.add(ClassName$a.HIDE);
  5931. $(_this3._element).trigger(Event$a.HIDDEN);
  5932. };
  5933. this._element.classList.remove(ClassName$a.SHOW);
  5934. if (this._config.animation) {
  5935. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5936. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5937. } else {
  5938. complete();
  5939. }
  5940. } // Static
  5941. ;
  5942. Toast._jQueryInterface = function _jQueryInterface(config) {
  5943. return this.each(function () {
  5944. var $element = $(this);
  5945. var data = $element.data(DATA_KEY$a);
  5946. var _config = typeof config === 'object' && config;
  5947. if (!data) {
  5948. data = new Toast(this, _config);
  5949. $element.data(DATA_KEY$a, data);
  5950. }
  5951. if (typeof config === 'string') {
  5952. if (typeof data[config] === 'undefined') {
  5953. throw new TypeError("No method named \"" + config + "\"");
  5954. }
  5955. data[config](this);
  5956. }
  5957. });
  5958. };
  5959. _createClass(Toast, null, [{
  5960. key: "VERSION",
  5961. get: function get() {
  5962. return VERSION$a;
  5963. }
  5964. }, {
  5965. key: "DefaultType",
  5966. get: function get() {
  5967. return DefaultType$7;
  5968. }
  5969. }, {
  5970. key: "Default",
  5971. get: function get() {
  5972. return Default$7;
  5973. }
  5974. }]);
  5975. return Toast;
  5976. }();
  5977. /**
  5978. * ------------------------------------------------------------------------
  5979. * jQuery
  5980. * ------------------------------------------------------------------------
  5981. */
  5982. $.fn[NAME$a] = Toast._jQueryInterface;
  5983. $.fn[NAME$a].Constructor = Toast;
  5984. $.fn[NAME$a].noConflict = function () {
  5985. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5986. return Toast._jQueryInterface;
  5987. };
  5988. exports.Alert = Alert;
  5989. exports.Button = Button;
  5990. exports.Carousel = Carousel;
  5991. exports.Collapse = Collapse;
  5992. exports.Dropdown = Dropdown;
  5993. exports.Modal = Modal;
  5994. exports.Popover = Popover;
  5995. exports.Scrollspy = ScrollSpy;
  5996. exports.Tab = Tab;
  5997. exports.Toast = Toast;
  5998. exports.Tooltip = Tooltip;
  5999. exports.Util = Util;
  6000. Object.defineProperty(exports, '__esModule', { value: true });
  6001. })));
  6002. //# sourceMappingURL=bootstrap.js.map
  6003. /***/ }),
  6004. /***/ "./node_modules/buffer/index.js":
  6005. /*!**************************************!*\
  6006. !*** ./node_modules/buffer/index.js ***!
  6007. \**************************************/
  6008. /*! no static exports found */
  6009. /***/ (function(module, exports, __webpack_require__) {
  6010. "use strict";
  6011. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6012. * The buffer module from node.js, for the browser.
  6013. *
  6014. * @author Feross Aboukhadijeh <http://feross.org>
  6015. * @license MIT
  6016. */
  6017. /* eslint-disable no-proto */
  6018. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6019. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6020. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6021. exports.Buffer = Buffer
  6022. exports.SlowBuffer = SlowBuffer
  6023. exports.INSPECT_MAX_BYTES = 50
  6024. /**
  6025. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6026. * === true Use Uint8Array implementation (fastest)
  6027. * === false Use Object implementation (most compatible, even IE6)
  6028. *
  6029. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6030. * Opera 11.6+, iOS 4.2+.
  6031. *
  6032. * Due to various browser bugs, sometimes the Object implementation will be used even
  6033. * when the browser supports typed arrays.
  6034. *
  6035. * Note:
  6036. *
  6037. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6038. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6039. *
  6040. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6041. *
  6042. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6043. * incorrect length in some situations.
  6044. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6045. * get the Object implementation, which is slower but behaves correctly.
  6046. */
  6047. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6048. ? global.TYPED_ARRAY_SUPPORT
  6049. : typedArraySupport()
  6050. /*
  6051. * Export kMaxLength after typed array support is determined.
  6052. */
  6053. exports.kMaxLength = kMaxLength()
  6054. function typedArraySupport () {
  6055. try {
  6056. var arr = new Uint8Array(1)
  6057. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6058. return arr.foo() === 42 && // typed array instances can be augmented
  6059. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6060. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6061. } catch (e) {
  6062. return false
  6063. }
  6064. }
  6065. function kMaxLength () {
  6066. return Buffer.TYPED_ARRAY_SUPPORT
  6067. ? 0x7fffffff
  6068. : 0x3fffffff
  6069. }
  6070. function createBuffer (that, length) {
  6071. if (kMaxLength() < length) {
  6072. throw new RangeError('Invalid typed array length')
  6073. }
  6074. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6075. // Return an augmented `Uint8Array` instance, for best performance
  6076. that = new Uint8Array(length)
  6077. that.__proto__ = Buffer.prototype
  6078. } else {
  6079. // Fallback: Return an object instance of the Buffer class
  6080. if (that === null) {
  6081. that = new Buffer(length)
  6082. }
  6083. that.length = length
  6084. }
  6085. return that
  6086. }
  6087. /**
  6088. * The Buffer constructor returns instances of `Uint8Array` that have their
  6089. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6090. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6091. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6092. * returns a single octet.
  6093. *
  6094. * The `Uint8Array` prototype remains unmodified.
  6095. */
  6096. function Buffer (arg, encodingOrOffset, length) {
  6097. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6098. return new Buffer(arg, encodingOrOffset, length)
  6099. }
  6100. // Common case.
  6101. if (typeof arg === 'number') {
  6102. if (typeof encodingOrOffset === 'string') {
  6103. throw new Error(
  6104. 'If encoding is specified then the first argument must be a string'
  6105. )
  6106. }
  6107. return allocUnsafe(this, arg)
  6108. }
  6109. return from(this, arg, encodingOrOffset, length)
  6110. }
  6111. Buffer.poolSize = 8192 // not used by this implementation
  6112. // TODO: Legacy, not needed anymore. Remove in next major version.
  6113. Buffer._augment = function (arr) {
  6114. arr.__proto__ = Buffer.prototype
  6115. return arr
  6116. }
  6117. function from (that, value, encodingOrOffset, length) {
  6118. if (typeof value === 'number') {
  6119. throw new TypeError('"value" argument must not be a number')
  6120. }
  6121. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6122. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6123. }
  6124. if (typeof value === 'string') {
  6125. return fromString(that, value, encodingOrOffset)
  6126. }
  6127. return fromObject(that, value)
  6128. }
  6129. /**
  6130. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6131. * if value is a number.
  6132. * Buffer.from(str[, encoding])
  6133. * Buffer.from(array)
  6134. * Buffer.from(buffer)
  6135. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6136. **/
  6137. Buffer.from = function (value, encodingOrOffset, length) {
  6138. return from(null, value, encodingOrOffset, length)
  6139. }
  6140. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6141. Buffer.prototype.__proto__ = Uint8Array.prototype
  6142. Buffer.__proto__ = Uint8Array
  6143. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6144. Buffer[Symbol.species] === Buffer) {
  6145. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6146. Object.defineProperty(Buffer, Symbol.species, {
  6147. value: null,
  6148. configurable: true
  6149. })
  6150. }
  6151. }
  6152. function assertSize (size) {
  6153. if (typeof size !== 'number') {
  6154. throw new TypeError('"size" argument must be a number')
  6155. } else if (size < 0) {
  6156. throw new RangeError('"size" argument must not be negative')
  6157. }
  6158. }
  6159. function alloc (that, size, fill, encoding) {
  6160. assertSize(size)
  6161. if (size <= 0) {
  6162. return createBuffer(that, size)
  6163. }
  6164. if (fill !== undefined) {
  6165. // Only pay attention to encoding if it's a string. This
  6166. // prevents accidentally sending in a number that would
  6167. // be interpretted as a start offset.
  6168. return typeof encoding === 'string'
  6169. ? createBuffer(that, size).fill(fill, encoding)
  6170. : createBuffer(that, size).fill(fill)
  6171. }
  6172. return createBuffer(that, size)
  6173. }
  6174. /**
  6175. * Creates a new filled Buffer instance.
  6176. * alloc(size[, fill[, encoding]])
  6177. **/
  6178. Buffer.alloc = function (size, fill, encoding) {
  6179. return alloc(null, size, fill, encoding)
  6180. }
  6181. function allocUnsafe (that, size) {
  6182. assertSize(size)
  6183. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6184. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6185. for (var i = 0; i < size; ++i) {
  6186. that[i] = 0
  6187. }
  6188. }
  6189. return that
  6190. }
  6191. /**
  6192. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6193. * */
  6194. Buffer.allocUnsafe = function (size) {
  6195. return allocUnsafe(null, size)
  6196. }
  6197. /**
  6198. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6199. */
  6200. Buffer.allocUnsafeSlow = function (size) {
  6201. return allocUnsafe(null, size)
  6202. }
  6203. function fromString (that, string, encoding) {
  6204. if (typeof encoding !== 'string' || encoding === '') {
  6205. encoding = 'utf8'
  6206. }
  6207. if (!Buffer.isEncoding(encoding)) {
  6208. throw new TypeError('"encoding" must be a valid string encoding')
  6209. }
  6210. var length = byteLength(string, encoding) | 0
  6211. that = createBuffer(that, length)
  6212. var actual = that.write(string, encoding)
  6213. if (actual !== length) {
  6214. // Writing a hex string, for example, that contains invalid characters will
  6215. // cause everything after the first invalid character to be ignored. (e.g.
  6216. // 'abxxcd' will be treated as 'ab')
  6217. that = that.slice(0, actual)
  6218. }
  6219. return that
  6220. }
  6221. function fromArrayLike (that, array) {
  6222. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6223. that = createBuffer(that, length)
  6224. for (var i = 0; i < length; i += 1) {
  6225. that[i] = array[i] & 255
  6226. }
  6227. return that
  6228. }
  6229. function fromArrayBuffer (that, array, byteOffset, length) {
  6230. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6231. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6232. throw new RangeError('\'offset\' is out of bounds')
  6233. }
  6234. if (array.byteLength < byteOffset + (length || 0)) {
  6235. throw new RangeError('\'length\' is out of bounds')
  6236. }
  6237. if (byteOffset === undefined && length === undefined) {
  6238. array = new Uint8Array(array)
  6239. } else if (length === undefined) {
  6240. array = new Uint8Array(array, byteOffset)
  6241. } else {
  6242. array = new Uint8Array(array, byteOffset, length)
  6243. }
  6244. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6245. // Return an augmented `Uint8Array` instance, for best performance
  6246. that = array
  6247. that.__proto__ = Buffer.prototype
  6248. } else {
  6249. // Fallback: Return an object instance of the Buffer class
  6250. that = fromArrayLike(that, array)
  6251. }
  6252. return that
  6253. }
  6254. function fromObject (that, obj) {
  6255. if (Buffer.isBuffer(obj)) {
  6256. var len = checked(obj.length) | 0
  6257. that = createBuffer(that, len)
  6258. if (that.length === 0) {
  6259. return that
  6260. }
  6261. obj.copy(that, 0, 0, len)
  6262. return that
  6263. }
  6264. if (obj) {
  6265. if ((typeof ArrayBuffer !== 'undefined' &&
  6266. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6267. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6268. return createBuffer(that, 0)
  6269. }
  6270. return fromArrayLike(that, obj)
  6271. }
  6272. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6273. return fromArrayLike(that, obj.data)
  6274. }
  6275. }
  6276. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6277. }
  6278. function checked (length) {
  6279. // Note: cannot use `length < kMaxLength()` here because that fails when
  6280. // length is NaN (which is otherwise coerced to zero.)
  6281. if (length >= kMaxLength()) {
  6282. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6283. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6284. }
  6285. return length | 0
  6286. }
  6287. function SlowBuffer (length) {
  6288. if (+length != length) { // eslint-disable-line eqeqeq
  6289. length = 0
  6290. }
  6291. return Buffer.alloc(+length)
  6292. }
  6293. Buffer.isBuffer = function isBuffer (b) {
  6294. return !!(b != null && b._isBuffer)
  6295. }
  6296. Buffer.compare = function compare (a, b) {
  6297. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6298. throw new TypeError('Arguments must be Buffers')
  6299. }
  6300. if (a === b) return 0
  6301. var x = a.length
  6302. var y = b.length
  6303. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6304. if (a[i] !== b[i]) {
  6305. x = a[i]
  6306. y = b[i]
  6307. break
  6308. }
  6309. }
  6310. if (x < y) return -1
  6311. if (y < x) return 1
  6312. return 0
  6313. }
  6314. Buffer.isEncoding = function isEncoding (encoding) {
  6315. switch (String(encoding).toLowerCase()) {
  6316. case 'hex':
  6317. case 'utf8':
  6318. case 'utf-8':
  6319. case 'ascii':
  6320. case 'latin1':
  6321. case 'binary':
  6322. case 'base64':
  6323. case 'ucs2':
  6324. case 'ucs-2':
  6325. case 'utf16le':
  6326. case 'utf-16le':
  6327. return true
  6328. default:
  6329. return false
  6330. }
  6331. }
  6332. Buffer.concat = function concat (list, length) {
  6333. if (!isArray(list)) {
  6334. throw new TypeError('"list" argument must be an Array of Buffers')
  6335. }
  6336. if (list.length === 0) {
  6337. return Buffer.alloc(0)
  6338. }
  6339. var i
  6340. if (length === undefined) {
  6341. length = 0
  6342. for (i = 0; i < list.length; ++i) {
  6343. length += list[i].length
  6344. }
  6345. }
  6346. var buffer = Buffer.allocUnsafe(length)
  6347. var pos = 0
  6348. for (i = 0; i < list.length; ++i) {
  6349. var buf = list[i]
  6350. if (!Buffer.isBuffer(buf)) {
  6351. throw new TypeError('"list" argument must be an Array of Buffers')
  6352. }
  6353. buf.copy(buffer, pos)
  6354. pos += buf.length
  6355. }
  6356. return buffer
  6357. }
  6358. function byteLength (string, encoding) {
  6359. if (Buffer.isBuffer(string)) {
  6360. return string.length
  6361. }
  6362. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6363. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6364. return string.byteLength
  6365. }
  6366. if (typeof string !== 'string') {
  6367. string = '' + string
  6368. }
  6369. var len = string.length
  6370. if (len === 0) return 0
  6371. // Use a for loop to avoid recursion
  6372. var loweredCase = false
  6373. for (;;) {
  6374. switch (encoding) {
  6375. case 'ascii':
  6376. case 'latin1':
  6377. case 'binary':
  6378. return len
  6379. case 'utf8':
  6380. case 'utf-8':
  6381. case undefined:
  6382. return utf8ToBytes(string).length
  6383. case 'ucs2':
  6384. case 'ucs-2':
  6385. case 'utf16le':
  6386. case 'utf-16le':
  6387. return len * 2
  6388. case 'hex':
  6389. return len >>> 1
  6390. case 'base64':
  6391. return base64ToBytes(string).length
  6392. default:
  6393. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6394. encoding = ('' + encoding).toLowerCase()
  6395. loweredCase = true
  6396. }
  6397. }
  6398. }
  6399. Buffer.byteLength = byteLength
  6400. function slowToString (encoding, start, end) {
  6401. var loweredCase = false
  6402. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6403. // property of a typed array.
  6404. // This behaves neither like String nor Uint8Array in that we set start/end
  6405. // to their upper/lower bounds if the value passed is out of range.
  6406. // undefined is handled specially as per ECMA-262 6th Edition,
  6407. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6408. if (start === undefined || start < 0) {
  6409. start = 0
  6410. }
  6411. // Return early if start > this.length. Done here to prevent potential uint32
  6412. // coercion fail below.
  6413. if (start > this.length) {
  6414. return ''
  6415. }
  6416. if (end === undefined || end > this.length) {
  6417. end = this.length
  6418. }
  6419. if (end <= 0) {
  6420. return ''
  6421. }
  6422. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6423. end >>>= 0
  6424. start >>>= 0
  6425. if (end <= start) {
  6426. return ''
  6427. }
  6428. if (!encoding) encoding = 'utf8'
  6429. while (true) {
  6430. switch (encoding) {
  6431. case 'hex':
  6432. return hexSlice(this, start, end)
  6433. case 'utf8':
  6434. case 'utf-8':
  6435. return utf8Slice(this, start, end)
  6436. case 'ascii':
  6437. return asciiSlice(this, start, end)
  6438. case 'latin1':
  6439. case 'binary':
  6440. return latin1Slice(this, start, end)
  6441. case 'base64':
  6442. return base64Slice(this, start, end)
  6443. case 'ucs2':
  6444. case 'ucs-2':
  6445. case 'utf16le':
  6446. case 'utf-16le':
  6447. return utf16leSlice(this, start, end)
  6448. default:
  6449. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6450. encoding = (encoding + '').toLowerCase()
  6451. loweredCase = true
  6452. }
  6453. }
  6454. }
  6455. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6456. // Buffer instances.
  6457. Buffer.prototype._isBuffer = true
  6458. function swap (b, n, m) {
  6459. var i = b[n]
  6460. b[n] = b[m]
  6461. b[m] = i
  6462. }
  6463. Buffer.prototype.swap16 = function swap16 () {
  6464. var len = this.length
  6465. if (len % 2 !== 0) {
  6466. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6467. }
  6468. for (var i = 0; i < len; i += 2) {
  6469. swap(this, i, i + 1)
  6470. }
  6471. return this
  6472. }
  6473. Buffer.prototype.swap32 = function swap32 () {
  6474. var len = this.length
  6475. if (len % 4 !== 0) {
  6476. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6477. }
  6478. for (var i = 0; i < len; i += 4) {
  6479. swap(this, i, i + 3)
  6480. swap(this, i + 1, i + 2)
  6481. }
  6482. return this
  6483. }
  6484. Buffer.prototype.swap64 = function swap64 () {
  6485. var len = this.length
  6486. if (len % 8 !== 0) {
  6487. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6488. }
  6489. for (var i = 0; i < len; i += 8) {
  6490. swap(this, i, i + 7)
  6491. swap(this, i + 1, i + 6)
  6492. swap(this, i + 2, i + 5)
  6493. swap(this, i + 3, i + 4)
  6494. }
  6495. return this
  6496. }
  6497. Buffer.prototype.toString = function toString () {
  6498. var length = this.length | 0
  6499. if (length === 0) return ''
  6500. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6501. return slowToString.apply(this, arguments)
  6502. }
  6503. Buffer.prototype.equals = function equals (b) {
  6504. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6505. if (this === b) return true
  6506. return Buffer.compare(this, b) === 0
  6507. }
  6508. Buffer.prototype.inspect = function inspect () {
  6509. var str = ''
  6510. var max = exports.INSPECT_MAX_BYTES
  6511. if (this.length > 0) {
  6512. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6513. if (this.length > max) str += ' ... '
  6514. }
  6515. return '<Buffer ' + str + '>'
  6516. }
  6517. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6518. if (!Buffer.isBuffer(target)) {
  6519. throw new TypeError('Argument must be a Buffer')
  6520. }
  6521. if (start === undefined) {
  6522. start = 0
  6523. }
  6524. if (end === undefined) {
  6525. end = target ? target.length : 0
  6526. }
  6527. if (thisStart === undefined) {
  6528. thisStart = 0
  6529. }
  6530. if (thisEnd === undefined) {
  6531. thisEnd = this.length
  6532. }
  6533. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6534. throw new RangeError('out of range index')
  6535. }
  6536. if (thisStart >= thisEnd && start >= end) {
  6537. return 0
  6538. }
  6539. if (thisStart >= thisEnd) {
  6540. return -1
  6541. }
  6542. if (start >= end) {
  6543. return 1
  6544. }
  6545. start >>>= 0
  6546. end >>>= 0
  6547. thisStart >>>= 0
  6548. thisEnd >>>= 0
  6549. if (this === target) return 0
  6550. var x = thisEnd - thisStart
  6551. var y = end - start
  6552. var len = Math.min(x, y)
  6553. var thisCopy = this.slice(thisStart, thisEnd)
  6554. var targetCopy = target.slice(start, end)
  6555. for (var i = 0; i < len; ++i) {
  6556. if (thisCopy[i] !== targetCopy[i]) {
  6557. x = thisCopy[i]
  6558. y = targetCopy[i]
  6559. break
  6560. }
  6561. }
  6562. if (x < y) return -1
  6563. if (y < x) return 1
  6564. return 0
  6565. }
  6566. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6567. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6568. //
  6569. // Arguments:
  6570. // - buffer - a Buffer to search
  6571. // - val - a string, Buffer, or number
  6572. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6573. // - encoding - an optional encoding, relevant is val is a string
  6574. // - dir - true for indexOf, false for lastIndexOf
  6575. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6576. // Empty buffer means no match
  6577. if (buffer.length === 0) return -1
  6578. // Normalize byteOffset
  6579. if (typeof byteOffset === 'string') {
  6580. encoding = byteOffset
  6581. byteOffset = 0
  6582. } else if (byteOffset > 0x7fffffff) {
  6583. byteOffset = 0x7fffffff
  6584. } else if (byteOffset < -0x80000000) {
  6585. byteOffset = -0x80000000
  6586. }
  6587. byteOffset = +byteOffset // Coerce to Number.
  6588. if (isNaN(byteOffset)) {
  6589. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6590. byteOffset = dir ? 0 : (buffer.length - 1)
  6591. }
  6592. // Normalize byteOffset: negative offsets start from the end of the buffer
  6593. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6594. if (byteOffset >= buffer.length) {
  6595. if (dir) return -1
  6596. else byteOffset = buffer.length - 1
  6597. } else if (byteOffset < 0) {
  6598. if (dir) byteOffset = 0
  6599. else return -1
  6600. }
  6601. // Normalize val
  6602. if (typeof val === 'string') {
  6603. val = Buffer.from(val, encoding)
  6604. }
  6605. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6606. if (Buffer.isBuffer(val)) {
  6607. // Special case: looking for empty string/buffer always fails
  6608. if (val.length === 0) {
  6609. return -1
  6610. }
  6611. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6612. } else if (typeof val === 'number') {
  6613. val = val & 0xFF // Search for a byte value [0-255]
  6614. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6615. typeof Uint8Array.prototype.indexOf === 'function') {
  6616. if (dir) {
  6617. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6618. } else {
  6619. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6620. }
  6621. }
  6622. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6623. }
  6624. throw new TypeError('val must be string, number or Buffer')
  6625. }
  6626. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6627. var indexSize = 1
  6628. var arrLength = arr.length
  6629. var valLength = val.length
  6630. if (encoding !== undefined) {
  6631. encoding = String(encoding).toLowerCase()
  6632. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6633. encoding === 'utf16le' || encoding === 'utf-16le') {
  6634. if (arr.length < 2 || val.length < 2) {
  6635. return -1
  6636. }
  6637. indexSize = 2
  6638. arrLength /= 2
  6639. valLength /= 2
  6640. byteOffset /= 2
  6641. }
  6642. }
  6643. function read (buf, i) {
  6644. if (indexSize === 1) {
  6645. return buf[i]
  6646. } else {
  6647. return buf.readUInt16BE(i * indexSize)
  6648. }
  6649. }
  6650. var i
  6651. if (dir) {
  6652. var foundIndex = -1
  6653. for (i = byteOffset; i < arrLength; i++) {
  6654. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6655. if (foundIndex === -1) foundIndex = i
  6656. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6657. } else {
  6658. if (foundIndex !== -1) i -= i - foundIndex
  6659. foundIndex = -1
  6660. }
  6661. }
  6662. } else {
  6663. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6664. for (i = byteOffset; i >= 0; i--) {
  6665. var found = true
  6666. for (var j = 0; j < valLength; j++) {
  6667. if (read(arr, i + j) !== read(val, j)) {
  6668. found = false
  6669. break
  6670. }
  6671. }
  6672. if (found) return i
  6673. }
  6674. }
  6675. return -1
  6676. }
  6677. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6678. return this.indexOf(val, byteOffset, encoding) !== -1
  6679. }
  6680. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6681. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6682. }
  6683. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6684. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6685. }
  6686. function hexWrite (buf, string, offset, length) {
  6687. offset = Number(offset) || 0
  6688. var remaining = buf.length - offset
  6689. if (!length) {
  6690. length = remaining
  6691. } else {
  6692. length = Number(length)
  6693. if (length > remaining) {
  6694. length = remaining
  6695. }
  6696. }
  6697. // must be an even number of digits
  6698. var strLen = string.length
  6699. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6700. if (length > strLen / 2) {
  6701. length = strLen / 2
  6702. }
  6703. for (var i = 0; i < length; ++i) {
  6704. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6705. if (isNaN(parsed)) return i
  6706. buf[offset + i] = parsed
  6707. }
  6708. return i
  6709. }
  6710. function utf8Write (buf, string, offset, length) {
  6711. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6712. }
  6713. function asciiWrite (buf, string, offset, length) {
  6714. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6715. }
  6716. function latin1Write (buf, string, offset, length) {
  6717. return asciiWrite(buf, string, offset, length)
  6718. }
  6719. function base64Write (buf, string, offset, length) {
  6720. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6721. }
  6722. function ucs2Write (buf, string, offset, length) {
  6723. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6724. }
  6725. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6726. // Buffer#write(string)
  6727. if (offset === undefined) {
  6728. encoding = 'utf8'
  6729. length = this.length
  6730. offset = 0
  6731. // Buffer#write(string, encoding)
  6732. } else if (length === undefined && typeof offset === 'string') {
  6733. encoding = offset
  6734. length = this.length
  6735. offset = 0
  6736. // Buffer#write(string, offset[, length][, encoding])
  6737. } else if (isFinite(offset)) {
  6738. offset = offset | 0
  6739. if (isFinite(length)) {
  6740. length = length | 0
  6741. if (encoding === undefined) encoding = 'utf8'
  6742. } else {
  6743. encoding = length
  6744. length = undefined
  6745. }
  6746. // legacy write(string, encoding, offset, length) - remove in v0.13
  6747. } else {
  6748. throw new Error(
  6749. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6750. )
  6751. }
  6752. var remaining = this.length - offset
  6753. if (length === undefined || length > remaining) length = remaining
  6754. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6755. throw new RangeError('Attempt to write outside buffer bounds')
  6756. }
  6757. if (!encoding) encoding = 'utf8'
  6758. var loweredCase = false
  6759. for (;;) {
  6760. switch (encoding) {
  6761. case 'hex':
  6762. return hexWrite(this, string, offset, length)
  6763. case 'utf8':
  6764. case 'utf-8':
  6765. return utf8Write(this, string, offset, length)
  6766. case 'ascii':
  6767. return asciiWrite(this, string, offset, length)
  6768. case 'latin1':
  6769. case 'binary':
  6770. return latin1Write(this, string, offset, length)
  6771. case 'base64':
  6772. // Warning: maxLength not taken into account in base64Write
  6773. return base64Write(this, string, offset, length)
  6774. case 'ucs2':
  6775. case 'ucs-2':
  6776. case 'utf16le':
  6777. case 'utf-16le':
  6778. return ucs2Write(this, string, offset, length)
  6779. default:
  6780. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6781. encoding = ('' + encoding).toLowerCase()
  6782. loweredCase = true
  6783. }
  6784. }
  6785. }
  6786. Buffer.prototype.toJSON = function toJSON () {
  6787. return {
  6788. type: 'Buffer',
  6789. data: Array.prototype.slice.call(this._arr || this, 0)
  6790. }
  6791. }
  6792. function base64Slice (buf, start, end) {
  6793. if (start === 0 && end === buf.length) {
  6794. return base64.fromByteArray(buf)
  6795. } else {
  6796. return base64.fromByteArray(buf.slice(start, end))
  6797. }
  6798. }
  6799. function utf8Slice (buf, start, end) {
  6800. end = Math.min(buf.length, end)
  6801. var res = []
  6802. var i = start
  6803. while (i < end) {
  6804. var firstByte = buf[i]
  6805. var codePoint = null
  6806. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6807. : (firstByte > 0xDF) ? 3
  6808. : (firstByte > 0xBF) ? 2
  6809. : 1
  6810. if (i + bytesPerSequence <= end) {
  6811. var secondByte, thirdByte, fourthByte, tempCodePoint
  6812. switch (bytesPerSequence) {
  6813. case 1:
  6814. if (firstByte < 0x80) {
  6815. codePoint = firstByte
  6816. }
  6817. break
  6818. case 2:
  6819. secondByte = buf[i + 1]
  6820. if ((secondByte & 0xC0) === 0x80) {
  6821. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6822. if (tempCodePoint > 0x7F) {
  6823. codePoint = tempCodePoint
  6824. }
  6825. }
  6826. break
  6827. case 3:
  6828. secondByte = buf[i + 1]
  6829. thirdByte = buf[i + 2]
  6830. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6831. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6832. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6833. codePoint = tempCodePoint
  6834. }
  6835. }
  6836. break
  6837. case 4:
  6838. secondByte = buf[i + 1]
  6839. thirdByte = buf[i + 2]
  6840. fourthByte = buf[i + 3]
  6841. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6842. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6843. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6844. codePoint = tempCodePoint
  6845. }
  6846. }
  6847. }
  6848. }
  6849. if (codePoint === null) {
  6850. // we did not generate a valid codePoint so insert a
  6851. // replacement char (U+FFFD) and advance only 1 byte
  6852. codePoint = 0xFFFD
  6853. bytesPerSequence = 1
  6854. } else if (codePoint > 0xFFFF) {
  6855. // encode to utf16 (surrogate pair dance)
  6856. codePoint -= 0x10000
  6857. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6858. codePoint = 0xDC00 | codePoint & 0x3FF
  6859. }
  6860. res.push(codePoint)
  6861. i += bytesPerSequence
  6862. }
  6863. return decodeCodePointsArray(res)
  6864. }
  6865. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6866. // the lowest limit is Chrome, with 0x10000 args.
  6867. // We go 1 magnitude less, for safety
  6868. var MAX_ARGUMENTS_LENGTH = 0x1000
  6869. function decodeCodePointsArray (codePoints) {
  6870. var len = codePoints.length
  6871. if (len <= MAX_ARGUMENTS_LENGTH) {
  6872. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6873. }
  6874. // Decode in chunks to avoid "call stack size exceeded".
  6875. var res = ''
  6876. var i = 0
  6877. while (i < len) {
  6878. res += String.fromCharCode.apply(
  6879. String,
  6880. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6881. )
  6882. }
  6883. return res
  6884. }
  6885. function asciiSlice (buf, start, end) {
  6886. var ret = ''
  6887. end = Math.min(buf.length, end)
  6888. for (var i = start; i < end; ++i) {
  6889. ret += String.fromCharCode(buf[i] & 0x7F)
  6890. }
  6891. return ret
  6892. }
  6893. function latin1Slice (buf, start, end) {
  6894. var ret = ''
  6895. end = Math.min(buf.length, end)
  6896. for (var i = start; i < end; ++i) {
  6897. ret += String.fromCharCode(buf[i])
  6898. }
  6899. return ret
  6900. }
  6901. function hexSlice (buf, start, end) {
  6902. var len = buf.length
  6903. if (!start || start < 0) start = 0
  6904. if (!end || end < 0 || end > len) end = len
  6905. var out = ''
  6906. for (var i = start; i < end; ++i) {
  6907. out += toHex(buf[i])
  6908. }
  6909. return out
  6910. }
  6911. function utf16leSlice (buf, start, end) {
  6912. var bytes = buf.slice(start, end)
  6913. var res = ''
  6914. for (var i = 0; i < bytes.length; i += 2) {
  6915. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6916. }
  6917. return res
  6918. }
  6919. Buffer.prototype.slice = function slice (start, end) {
  6920. var len = this.length
  6921. start = ~~start
  6922. end = end === undefined ? len : ~~end
  6923. if (start < 0) {
  6924. start += len
  6925. if (start < 0) start = 0
  6926. } else if (start > len) {
  6927. start = len
  6928. }
  6929. if (end < 0) {
  6930. end += len
  6931. if (end < 0) end = 0
  6932. } else if (end > len) {
  6933. end = len
  6934. }
  6935. if (end < start) end = start
  6936. var newBuf
  6937. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6938. newBuf = this.subarray(start, end)
  6939. newBuf.__proto__ = Buffer.prototype
  6940. } else {
  6941. var sliceLen = end - start
  6942. newBuf = new Buffer(sliceLen, undefined)
  6943. for (var i = 0; i < sliceLen; ++i) {
  6944. newBuf[i] = this[i + start]
  6945. }
  6946. }
  6947. return newBuf
  6948. }
  6949. /*
  6950. * Need to make sure that buffer isn't trying to write out of bounds.
  6951. */
  6952. function checkOffset (offset, ext, length) {
  6953. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  6954. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  6955. }
  6956. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  6957. offset = offset | 0
  6958. byteLength = byteLength | 0
  6959. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6960. var val = this[offset]
  6961. var mul = 1
  6962. var i = 0
  6963. while (++i < byteLength && (mul *= 0x100)) {
  6964. val += this[offset + i] * mul
  6965. }
  6966. return val
  6967. }
  6968. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  6969. offset = offset | 0
  6970. byteLength = byteLength | 0
  6971. if (!noAssert) {
  6972. checkOffset(offset, byteLength, this.length)
  6973. }
  6974. var val = this[offset + --byteLength]
  6975. var mul = 1
  6976. while (byteLength > 0 && (mul *= 0x100)) {
  6977. val += this[offset + --byteLength] * mul
  6978. }
  6979. return val
  6980. }
  6981. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  6982. if (!noAssert) checkOffset(offset, 1, this.length)
  6983. return this[offset]
  6984. }
  6985. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  6986. if (!noAssert) checkOffset(offset, 2, this.length)
  6987. return this[offset] | (this[offset + 1] << 8)
  6988. }
  6989. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  6990. if (!noAssert) checkOffset(offset, 2, this.length)
  6991. return (this[offset] << 8) | this[offset + 1]
  6992. }
  6993. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  6994. if (!noAssert) checkOffset(offset, 4, this.length)
  6995. return ((this[offset]) |
  6996. (this[offset + 1] << 8) |
  6997. (this[offset + 2] << 16)) +
  6998. (this[offset + 3] * 0x1000000)
  6999. }
  7000. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7001. if (!noAssert) checkOffset(offset, 4, this.length)
  7002. return (this[offset] * 0x1000000) +
  7003. ((this[offset + 1] << 16) |
  7004. (this[offset + 2] << 8) |
  7005. this[offset + 3])
  7006. }
  7007. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7008. offset = offset | 0
  7009. byteLength = byteLength | 0
  7010. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7011. var val = this[offset]
  7012. var mul = 1
  7013. var i = 0
  7014. while (++i < byteLength && (mul *= 0x100)) {
  7015. val += this[offset + i] * mul
  7016. }
  7017. mul *= 0x80
  7018. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7019. return val
  7020. }
  7021. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7022. offset = offset | 0
  7023. byteLength = byteLength | 0
  7024. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7025. var i = byteLength
  7026. var mul = 1
  7027. var val = this[offset + --i]
  7028. while (i > 0 && (mul *= 0x100)) {
  7029. val += this[offset + --i] * mul
  7030. }
  7031. mul *= 0x80
  7032. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7033. return val
  7034. }
  7035. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7036. if (!noAssert) checkOffset(offset, 1, this.length)
  7037. if (!(this[offset] & 0x80)) return (this[offset])
  7038. return ((0xff - this[offset] + 1) * -1)
  7039. }
  7040. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7041. if (!noAssert) checkOffset(offset, 2, this.length)
  7042. var val = this[offset] | (this[offset + 1] << 8)
  7043. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7044. }
  7045. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7046. if (!noAssert) checkOffset(offset, 2, this.length)
  7047. var val = this[offset + 1] | (this[offset] << 8)
  7048. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7049. }
  7050. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7051. if (!noAssert) checkOffset(offset, 4, this.length)
  7052. return (this[offset]) |
  7053. (this[offset + 1] << 8) |
  7054. (this[offset + 2] << 16) |
  7055. (this[offset + 3] << 24)
  7056. }
  7057. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7058. if (!noAssert) checkOffset(offset, 4, this.length)
  7059. return (this[offset] << 24) |
  7060. (this[offset + 1] << 16) |
  7061. (this[offset + 2] << 8) |
  7062. (this[offset + 3])
  7063. }
  7064. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7065. if (!noAssert) checkOffset(offset, 4, this.length)
  7066. return ieee754.read(this, offset, true, 23, 4)
  7067. }
  7068. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7069. if (!noAssert) checkOffset(offset, 4, this.length)
  7070. return ieee754.read(this, offset, false, 23, 4)
  7071. }
  7072. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7073. if (!noAssert) checkOffset(offset, 8, this.length)
  7074. return ieee754.read(this, offset, true, 52, 8)
  7075. }
  7076. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7077. if (!noAssert) checkOffset(offset, 8, this.length)
  7078. return ieee754.read(this, offset, false, 52, 8)
  7079. }
  7080. function checkInt (buf, value, offset, ext, max, min) {
  7081. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7082. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7083. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7084. }
  7085. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7086. value = +value
  7087. offset = offset | 0
  7088. byteLength = byteLength | 0
  7089. if (!noAssert) {
  7090. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7091. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7092. }
  7093. var mul = 1
  7094. var i = 0
  7095. this[offset] = value & 0xFF
  7096. while (++i < byteLength && (mul *= 0x100)) {
  7097. this[offset + i] = (value / mul) & 0xFF
  7098. }
  7099. return offset + byteLength
  7100. }
  7101. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7102. value = +value
  7103. offset = offset | 0
  7104. byteLength = byteLength | 0
  7105. if (!noAssert) {
  7106. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7107. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7108. }
  7109. var i = byteLength - 1
  7110. var mul = 1
  7111. this[offset + i] = value & 0xFF
  7112. while (--i >= 0 && (mul *= 0x100)) {
  7113. this[offset + i] = (value / mul) & 0xFF
  7114. }
  7115. return offset + byteLength
  7116. }
  7117. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7118. value = +value
  7119. offset = offset | 0
  7120. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7121. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7122. this[offset] = (value & 0xff)
  7123. return offset + 1
  7124. }
  7125. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7126. if (value < 0) value = 0xffff + value + 1
  7127. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7128. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7129. (littleEndian ? i : 1 - i) * 8
  7130. }
  7131. }
  7132. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7133. value = +value
  7134. offset = offset | 0
  7135. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7136. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7137. this[offset] = (value & 0xff)
  7138. this[offset + 1] = (value >>> 8)
  7139. } else {
  7140. objectWriteUInt16(this, value, offset, true)
  7141. }
  7142. return offset + 2
  7143. }
  7144. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7145. value = +value
  7146. offset = offset | 0
  7147. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7148. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7149. this[offset] = (value >>> 8)
  7150. this[offset + 1] = (value & 0xff)
  7151. } else {
  7152. objectWriteUInt16(this, value, offset, false)
  7153. }
  7154. return offset + 2
  7155. }
  7156. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7157. if (value < 0) value = 0xffffffff + value + 1
  7158. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7159. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7160. }
  7161. }
  7162. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7163. value = +value
  7164. offset = offset | 0
  7165. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7166. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7167. this[offset + 3] = (value >>> 24)
  7168. this[offset + 2] = (value >>> 16)
  7169. this[offset + 1] = (value >>> 8)
  7170. this[offset] = (value & 0xff)
  7171. } else {
  7172. objectWriteUInt32(this, value, offset, true)
  7173. }
  7174. return offset + 4
  7175. }
  7176. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7177. value = +value
  7178. offset = offset | 0
  7179. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7180. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7181. this[offset] = (value >>> 24)
  7182. this[offset + 1] = (value >>> 16)
  7183. this[offset + 2] = (value >>> 8)
  7184. this[offset + 3] = (value & 0xff)
  7185. } else {
  7186. objectWriteUInt32(this, value, offset, false)
  7187. }
  7188. return offset + 4
  7189. }
  7190. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7191. value = +value
  7192. offset = offset | 0
  7193. if (!noAssert) {
  7194. var limit = Math.pow(2, 8 * byteLength - 1)
  7195. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7196. }
  7197. var i = 0
  7198. var mul = 1
  7199. var sub = 0
  7200. this[offset] = value & 0xFF
  7201. while (++i < byteLength && (mul *= 0x100)) {
  7202. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7203. sub = 1
  7204. }
  7205. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7206. }
  7207. return offset + byteLength
  7208. }
  7209. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7210. value = +value
  7211. offset = offset | 0
  7212. if (!noAssert) {
  7213. var limit = Math.pow(2, 8 * byteLength - 1)
  7214. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7215. }
  7216. var i = byteLength - 1
  7217. var mul = 1
  7218. var sub = 0
  7219. this[offset + i] = value & 0xFF
  7220. while (--i >= 0 && (mul *= 0x100)) {
  7221. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7222. sub = 1
  7223. }
  7224. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7225. }
  7226. return offset + byteLength
  7227. }
  7228. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7229. value = +value
  7230. offset = offset | 0
  7231. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7232. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7233. if (value < 0) value = 0xff + value + 1
  7234. this[offset] = (value & 0xff)
  7235. return offset + 1
  7236. }
  7237. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7238. value = +value
  7239. offset = offset | 0
  7240. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7241. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7242. this[offset] = (value & 0xff)
  7243. this[offset + 1] = (value >>> 8)
  7244. } else {
  7245. objectWriteUInt16(this, value, offset, true)
  7246. }
  7247. return offset + 2
  7248. }
  7249. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7250. value = +value
  7251. offset = offset | 0
  7252. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7253. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7254. this[offset] = (value >>> 8)
  7255. this[offset + 1] = (value & 0xff)
  7256. } else {
  7257. objectWriteUInt16(this, value, offset, false)
  7258. }
  7259. return offset + 2
  7260. }
  7261. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7262. value = +value
  7263. offset = offset | 0
  7264. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7265. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7266. this[offset] = (value & 0xff)
  7267. this[offset + 1] = (value >>> 8)
  7268. this[offset + 2] = (value >>> 16)
  7269. this[offset + 3] = (value >>> 24)
  7270. } else {
  7271. objectWriteUInt32(this, value, offset, true)
  7272. }
  7273. return offset + 4
  7274. }
  7275. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7276. value = +value
  7277. offset = offset | 0
  7278. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7279. if (value < 0) value = 0xffffffff + value + 1
  7280. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7281. this[offset] = (value >>> 24)
  7282. this[offset + 1] = (value >>> 16)
  7283. this[offset + 2] = (value >>> 8)
  7284. this[offset + 3] = (value & 0xff)
  7285. } else {
  7286. objectWriteUInt32(this, value, offset, false)
  7287. }
  7288. return offset + 4
  7289. }
  7290. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7291. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7292. if (offset < 0) throw new RangeError('Index out of range')
  7293. }
  7294. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7295. if (!noAssert) {
  7296. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7297. }
  7298. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7299. return offset + 4
  7300. }
  7301. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7302. return writeFloat(this, value, offset, true, noAssert)
  7303. }
  7304. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7305. return writeFloat(this, value, offset, false, noAssert)
  7306. }
  7307. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7308. if (!noAssert) {
  7309. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7310. }
  7311. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7312. return offset + 8
  7313. }
  7314. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7315. return writeDouble(this, value, offset, true, noAssert)
  7316. }
  7317. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7318. return writeDouble(this, value, offset, false, noAssert)
  7319. }
  7320. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7321. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7322. if (!start) start = 0
  7323. if (!end && end !== 0) end = this.length
  7324. if (targetStart >= target.length) targetStart = target.length
  7325. if (!targetStart) targetStart = 0
  7326. if (end > 0 && end < start) end = start
  7327. // Copy 0 bytes; we're done
  7328. if (end === start) return 0
  7329. if (target.length === 0 || this.length === 0) return 0
  7330. // Fatal error conditions
  7331. if (targetStart < 0) {
  7332. throw new RangeError('targetStart out of bounds')
  7333. }
  7334. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7335. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7336. // Are we oob?
  7337. if (end > this.length) end = this.length
  7338. if (target.length - targetStart < end - start) {
  7339. end = target.length - targetStart + start
  7340. }
  7341. var len = end - start
  7342. var i
  7343. if (this === target && start < targetStart && targetStart < end) {
  7344. // descending copy from end
  7345. for (i = len - 1; i >= 0; --i) {
  7346. target[i + targetStart] = this[i + start]
  7347. }
  7348. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7349. // ascending copy from start
  7350. for (i = 0; i < len; ++i) {
  7351. target[i + targetStart] = this[i + start]
  7352. }
  7353. } else {
  7354. Uint8Array.prototype.set.call(
  7355. target,
  7356. this.subarray(start, start + len),
  7357. targetStart
  7358. )
  7359. }
  7360. return len
  7361. }
  7362. // Usage:
  7363. // buffer.fill(number[, offset[, end]])
  7364. // buffer.fill(buffer[, offset[, end]])
  7365. // buffer.fill(string[, offset[, end]][, encoding])
  7366. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7367. // Handle string cases:
  7368. if (typeof val === 'string') {
  7369. if (typeof start === 'string') {
  7370. encoding = start
  7371. start = 0
  7372. end = this.length
  7373. } else if (typeof end === 'string') {
  7374. encoding = end
  7375. end = this.length
  7376. }
  7377. if (val.length === 1) {
  7378. var code = val.charCodeAt(0)
  7379. if (code < 256) {
  7380. val = code
  7381. }
  7382. }
  7383. if (encoding !== undefined && typeof encoding !== 'string') {
  7384. throw new TypeError('encoding must be a string')
  7385. }
  7386. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7387. throw new TypeError('Unknown encoding: ' + encoding)
  7388. }
  7389. } else if (typeof val === 'number') {
  7390. val = val & 255
  7391. }
  7392. // Invalid ranges are not set to a default, so can range check early.
  7393. if (start < 0 || this.length < start || this.length < end) {
  7394. throw new RangeError('Out of range index')
  7395. }
  7396. if (end <= start) {
  7397. return this
  7398. }
  7399. start = start >>> 0
  7400. end = end === undefined ? this.length : end >>> 0
  7401. if (!val) val = 0
  7402. var i
  7403. if (typeof val === 'number') {
  7404. for (i = start; i < end; ++i) {
  7405. this[i] = val
  7406. }
  7407. } else {
  7408. var bytes = Buffer.isBuffer(val)
  7409. ? val
  7410. : utf8ToBytes(new Buffer(val, encoding).toString())
  7411. var len = bytes.length
  7412. for (i = 0; i < end - start; ++i) {
  7413. this[i + start] = bytes[i % len]
  7414. }
  7415. }
  7416. return this
  7417. }
  7418. // HELPER FUNCTIONS
  7419. // ================
  7420. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7421. function base64clean (str) {
  7422. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7423. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7424. // Node converts strings with length < 2 to ''
  7425. if (str.length < 2) return ''
  7426. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7427. while (str.length % 4 !== 0) {
  7428. str = str + '='
  7429. }
  7430. return str
  7431. }
  7432. function stringtrim (str) {
  7433. if (str.trim) return str.trim()
  7434. return str.replace(/^\s+|\s+$/g, '')
  7435. }
  7436. function toHex (n) {
  7437. if (n < 16) return '0' + n.toString(16)
  7438. return n.toString(16)
  7439. }
  7440. function utf8ToBytes (string, units) {
  7441. units = units || Infinity
  7442. var codePoint
  7443. var length = string.length
  7444. var leadSurrogate = null
  7445. var bytes = []
  7446. for (var i = 0; i < length; ++i) {
  7447. codePoint = string.charCodeAt(i)
  7448. // is surrogate component
  7449. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7450. // last char was a lead
  7451. if (!leadSurrogate) {
  7452. // no lead yet
  7453. if (codePoint > 0xDBFF) {
  7454. // unexpected trail
  7455. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7456. continue
  7457. } else if (i + 1 === length) {
  7458. // unpaired lead
  7459. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7460. continue
  7461. }
  7462. // valid lead
  7463. leadSurrogate = codePoint
  7464. continue
  7465. }
  7466. // 2 leads in a row
  7467. if (codePoint < 0xDC00) {
  7468. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7469. leadSurrogate = codePoint
  7470. continue
  7471. }
  7472. // valid surrogate pair
  7473. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7474. } else if (leadSurrogate) {
  7475. // valid bmp char, but last char was a lead
  7476. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7477. }
  7478. leadSurrogate = null
  7479. // encode utf8
  7480. if (codePoint < 0x80) {
  7481. if ((units -= 1) < 0) break
  7482. bytes.push(codePoint)
  7483. } else if (codePoint < 0x800) {
  7484. if ((units -= 2) < 0) break
  7485. bytes.push(
  7486. codePoint >> 0x6 | 0xC0,
  7487. codePoint & 0x3F | 0x80
  7488. )
  7489. } else if (codePoint < 0x10000) {
  7490. if ((units -= 3) < 0) break
  7491. bytes.push(
  7492. codePoint >> 0xC | 0xE0,
  7493. codePoint >> 0x6 & 0x3F | 0x80,
  7494. codePoint & 0x3F | 0x80
  7495. )
  7496. } else if (codePoint < 0x110000) {
  7497. if ((units -= 4) < 0) break
  7498. bytes.push(
  7499. codePoint >> 0x12 | 0xF0,
  7500. codePoint >> 0xC & 0x3F | 0x80,
  7501. codePoint >> 0x6 & 0x3F | 0x80,
  7502. codePoint & 0x3F | 0x80
  7503. )
  7504. } else {
  7505. throw new Error('Invalid code point')
  7506. }
  7507. }
  7508. return bytes
  7509. }
  7510. function asciiToBytes (str) {
  7511. var byteArray = []
  7512. for (var i = 0; i < str.length; ++i) {
  7513. // Node's code seems to be doing this and not & 0x7F..
  7514. byteArray.push(str.charCodeAt(i) & 0xFF)
  7515. }
  7516. return byteArray
  7517. }
  7518. function utf16leToBytes (str, units) {
  7519. var c, hi, lo
  7520. var byteArray = []
  7521. for (var i = 0; i < str.length; ++i) {
  7522. if ((units -= 2) < 0) break
  7523. c = str.charCodeAt(i)
  7524. hi = c >> 8
  7525. lo = c % 256
  7526. byteArray.push(lo)
  7527. byteArray.push(hi)
  7528. }
  7529. return byteArray
  7530. }
  7531. function base64ToBytes (str) {
  7532. return base64.toByteArray(base64clean(str))
  7533. }
  7534. function blitBuffer (src, dst, offset, length) {
  7535. for (var i = 0; i < length; ++i) {
  7536. if ((i + offset >= dst.length) || (i >= src.length)) break
  7537. dst[i + offset] = src[i]
  7538. }
  7539. return i
  7540. }
  7541. function isnan (val) {
  7542. return val !== val // eslint-disable-line no-self-compare
  7543. }
  7544. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7545. /***/ }),
  7546. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7547. /*!**************************************************!*\
  7548. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7549. \**************************************************/
  7550. /*! no static exports found */
  7551. /***/ (function(module, exports, __webpack_require__) {
  7552. /*!
  7553. * clipboard.js v2.0.4
  7554. * https://zenorocha.github.io/clipboard.js
  7555. *
  7556. * Licensed MIT © Zeno Rocha
  7557. */
  7558. (function webpackUniversalModuleDefinition(root, factory) {
  7559. if(true)
  7560. module.exports = factory();
  7561. else {}
  7562. })(this, function() {
  7563. return /******/ (function(modules) { // webpackBootstrap
  7564. /******/ // The module cache
  7565. /******/ var installedModules = {};
  7566. /******/
  7567. /******/ // The require function
  7568. /******/ function __webpack_require__(moduleId) {
  7569. /******/
  7570. /******/ // Check if module is in cache
  7571. /******/ if(installedModules[moduleId]) {
  7572. /******/ return installedModules[moduleId].exports;
  7573. /******/ }
  7574. /******/ // Create a new module (and put it into the cache)
  7575. /******/ var module = installedModules[moduleId] = {
  7576. /******/ i: moduleId,
  7577. /******/ l: false,
  7578. /******/ exports: {}
  7579. /******/ };
  7580. /******/
  7581. /******/ // Execute the module function
  7582. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7583. /******/
  7584. /******/ // Flag the module as loaded
  7585. /******/ module.l = true;
  7586. /******/
  7587. /******/ // Return the exports of the module
  7588. /******/ return module.exports;
  7589. /******/ }
  7590. /******/
  7591. /******/
  7592. /******/ // expose the modules object (__webpack_modules__)
  7593. /******/ __webpack_require__.m = modules;
  7594. /******/
  7595. /******/ // expose the module cache
  7596. /******/ __webpack_require__.c = installedModules;
  7597. /******/
  7598. /******/ // define getter function for harmony exports
  7599. /******/ __webpack_require__.d = function(exports, name, getter) {
  7600. /******/ if(!__webpack_require__.o(exports, name)) {
  7601. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7602. /******/ }
  7603. /******/ };
  7604. /******/
  7605. /******/ // define __esModule on exports
  7606. /******/ __webpack_require__.r = function(exports) {
  7607. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7608. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7609. /******/ }
  7610. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7611. /******/ };
  7612. /******/
  7613. /******/ // create a fake namespace object
  7614. /******/ // mode & 1: value is a module id, require it
  7615. /******/ // mode & 2: merge all properties of value into the ns
  7616. /******/ // mode & 4: return value when already ns object
  7617. /******/ // mode & 8|1: behave like require
  7618. /******/ __webpack_require__.t = function(value, mode) {
  7619. /******/ if(mode & 1) value = __webpack_require__(value);
  7620. /******/ if(mode & 8) return value;
  7621. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7622. /******/ var ns = Object.create(null);
  7623. /******/ __webpack_require__.r(ns);
  7624. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7625. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7626. /******/ return ns;
  7627. /******/ };
  7628. /******/
  7629. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7630. /******/ __webpack_require__.n = function(module) {
  7631. /******/ var getter = module && module.__esModule ?
  7632. /******/ function getDefault() { return module['default']; } :
  7633. /******/ function getModuleExports() { return module; };
  7634. /******/ __webpack_require__.d(getter, 'a', getter);
  7635. /******/ return getter;
  7636. /******/ };
  7637. /******/
  7638. /******/ // Object.prototype.hasOwnProperty.call
  7639. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7640. /******/
  7641. /******/ // __webpack_public_path__
  7642. /******/ __webpack_require__.p = "";
  7643. /******/
  7644. /******/
  7645. /******/ // Load entry module and return exports
  7646. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7647. /******/ })
  7648. /************************************************************************/
  7649. /******/ ([
  7650. /* 0 */
  7651. /***/ (function(module, exports, __webpack_require__) {
  7652. "use strict";
  7653. 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; };
  7654. 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; }; }();
  7655. var _clipboardAction = __webpack_require__(1);
  7656. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7657. var _tinyEmitter = __webpack_require__(3);
  7658. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7659. var _goodListener = __webpack_require__(4);
  7660. var _goodListener2 = _interopRequireDefault(_goodListener);
  7661. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7662. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7663. 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; }
  7664. 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; }
  7665. /**
  7666. * Base class which takes one or more elements, adds event listeners to them,
  7667. * and instantiates a new `ClipboardAction` on each click.
  7668. */
  7669. var Clipboard = function (_Emitter) {
  7670. _inherits(Clipboard, _Emitter);
  7671. /**
  7672. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7673. * @param {Object} options
  7674. */
  7675. function Clipboard(trigger, options) {
  7676. _classCallCheck(this, Clipboard);
  7677. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7678. _this.resolveOptions(options);
  7679. _this.listenClick(trigger);
  7680. return _this;
  7681. }
  7682. /**
  7683. * Defines if attributes would be resolved using internal setter functions
  7684. * or custom functions that were passed in the constructor.
  7685. * @param {Object} options
  7686. */
  7687. _createClass(Clipboard, [{
  7688. key: 'resolveOptions',
  7689. value: function resolveOptions() {
  7690. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7691. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7692. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7693. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7694. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7695. }
  7696. /**
  7697. * Adds a click event listener to the passed trigger.
  7698. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7699. */
  7700. }, {
  7701. key: 'listenClick',
  7702. value: function listenClick(trigger) {
  7703. var _this2 = this;
  7704. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7705. return _this2.onClick(e);
  7706. });
  7707. }
  7708. /**
  7709. * Defines a new `ClipboardAction` on each click event.
  7710. * @param {Event} e
  7711. */
  7712. }, {
  7713. key: 'onClick',
  7714. value: function onClick(e) {
  7715. var trigger = e.delegateTarget || e.currentTarget;
  7716. if (this.clipboardAction) {
  7717. this.clipboardAction = null;
  7718. }
  7719. this.clipboardAction = new _clipboardAction2.default({
  7720. action: this.action(trigger),
  7721. target: this.target(trigger),
  7722. text: this.text(trigger),
  7723. container: this.container,
  7724. trigger: trigger,
  7725. emitter: this
  7726. });
  7727. }
  7728. /**
  7729. * Default `action` lookup function.
  7730. * @param {Element} trigger
  7731. */
  7732. }, {
  7733. key: 'defaultAction',
  7734. value: function defaultAction(trigger) {
  7735. return getAttributeValue('action', trigger);
  7736. }
  7737. /**
  7738. * Default `target` lookup function.
  7739. * @param {Element} trigger
  7740. */
  7741. }, {
  7742. key: 'defaultTarget',
  7743. value: function defaultTarget(trigger) {
  7744. var selector = getAttributeValue('target', trigger);
  7745. if (selector) {
  7746. return document.querySelector(selector);
  7747. }
  7748. }
  7749. /**
  7750. * Returns the support of the given action, or all actions if no action is
  7751. * given.
  7752. * @param {String} [action]
  7753. */
  7754. }, {
  7755. key: 'defaultText',
  7756. /**
  7757. * Default `text` lookup function.
  7758. * @param {Element} trigger
  7759. */
  7760. value: function defaultText(trigger) {
  7761. return getAttributeValue('text', trigger);
  7762. }
  7763. /**
  7764. * Destroy lifecycle.
  7765. */
  7766. }, {
  7767. key: 'destroy',
  7768. value: function destroy() {
  7769. this.listener.destroy();
  7770. if (this.clipboardAction) {
  7771. this.clipboardAction.destroy();
  7772. this.clipboardAction = null;
  7773. }
  7774. }
  7775. }], [{
  7776. key: 'isSupported',
  7777. value: function isSupported() {
  7778. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7779. var actions = typeof action === 'string' ? [action] : action;
  7780. var support = !!document.queryCommandSupported;
  7781. actions.forEach(function (action) {
  7782. support = support && !!document.queryCommandSupported(action);
  7783. });
  7784. return support;
  7785. }
  7786. }]);
  7787. return Clipboard;
  7788. }(_tinyEmitter2.default);
  7789. /**
  7790. * Helper function to retrieve attribute value.
  7791. * @param {String} suffix
  7792. * @param {Element} element
  7793. */
  7794. function getAttributeValue(suffix, element) {
  7795. var attribute = 'data-clipboard-' + suffix;
  7796. if (!element.hasAttribute(attribute)) {
  7797. return;
  7798. }
  7799. return element.getAttribute(attribute);
  7800. }
  7801. module.exports = Clipboard;
  7802. /***/ }),
  7803. /* 1 */
  7804. /***/ (function(module, exports, __webpack_require__) {
  7805. "use strict";
  7806. 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; };
  7807. 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; }; }();
  7808. var _select = __webpack_require__(2);
  7809. var _select2 = _interopRequireDefault(_select);
  7810. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7811. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7812. /**
  7813. * Inner class which performs selection from either `text` or `target`
  7814. * properties and then executes copy or cut operations.
  7815. */
  7816. var ClipboardAction = function () {
  7817. /**
  7818. * @param {Object} options
  7819. */
  7820. function ClipboardAction(options) {
  7821. _classCallCheck(this, ClipboardAction);
  7822. this.resolveOptions(options);
  7823. this.initSelection();
  7824. }
  7825. /**
  7826. * Defines base properties passed from constructor.
  7827. * @param {Object} options
  7828. */
  7829. _createClass(ClipboardAction, [{
  7830. key: 'resolveOptions',
  7831. value: function resolveOptions() {
  7832. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7833. this.action = options.action;
  7834. this.container = options.container;
  7835. this.emitter = options.emitter;
  7836. this.target = options.target;
  7837. this.text = options.text;
  7838. this.trigger = options.trigger;
  7839. this.selectedText = '';
  7840. }
  7841. /**
  7842. * Decides which selection strategy is going to be applied based
  7843. * on the existence of `text` and `target` properties.
  7844. */
  7845. }, {
  7846. key: 'initSelection',
  7847. value: function initSelection() {
  7848. if (this.text) {
  7849. this.selectFake();
  7850. } else if (this.target) {
  7851. this.selectTarget();
  7852. }
  7853. }
  7854. /**
  7855. * Creates a fake textarea element, sets its value from `text` property,
  7856. * and makes a selection on it.
  7857. */
  7858. }, {
  7859. key: 'selectFake',
  7860. value: function selectFake() {
  7861. var _this = this;
  7862. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7863. this.removeFake();
  7864. this.fakeHandlerCallback = function () {
  7865. return _this.removeFake();
  7866. };
  7867. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7868. this.fakeElem = document.createElement('textarea');
  7869. // Prevent zooming on iOS
  7870. this.fakeElem.style.fontSize = '12pt';
  7871. // Reset box model
  7872. this.fakeElem.style.border = '0';
  7873. this.fakeElem.style.padding = '0';
  7874. this.fakeElem.style.margin = '0';
  7875. // Move element out of screen horizontally
  7876. this.fakeElem.style.position = 'absolute';
  7877. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7878. // Move element to the same position vertically
  7879. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7880. this.fakeElem.style.top = yPosition + 'px';
  7881. this.fakeElem.setAttribute('readonly', '');
  7882. this.fakeElem.value = this.text;
  7883. this.container.appendChild(this.fakeElem);
  7884. this.selectedText = (0, _select2.default)(this.fakeElem);
  7885. this.copyText();
  7886. }
  7887. /**
  7888. * Only removes the fake element after another click event, that way
  7889. * a user can hit `Ctrl+C` to copy because selection still exists.
  7890. */
  7891. }, {
  7892. key: 'removeFake',
  7893. value: function removeFake() {
  7894. if (this.fakeHandler) {
  7895. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7896. this.fakeHandler = null;
  7897. this.fakeHandlerCallback = null;
  7898. }
  7899. if (this.fakeElem) {
  7900. this.container.removeChild(this.fakeElem);
  7901. this.fakeElem = null;
  7902. }
  7903. }
  7904. /**
  7905. * Selects the content from element passed on `target` property.
  7906. */
  7907. }, {
  7908. key: 'selectTarget',
  7909. value: function selectTarget() {
  7910. this.selectedText = (0, _select2.default)(this.target);
  7911. this.copyText();
  7912. }
  7913. /**
  7914. * Executes the copy operation based on the current selection.
  7915. */
  7916. }, {
  7917. key: 'copyText',
  7918. value: function copyText() {
  7919. var succeeded = void 0;
  7920. try {
  7921. succeeded = document.execCommand(this.action);
  7922. } catch (err) {
  7923. succeeded = false;
  7924. }
  7925. this.handleResult(succeeded);
  7926. }
  7927. /**
  7928. * Fires an event based on the copy operation result.
  7929. * @param {Boolean} succeeded
  7930. */
  7931. }, {
  7932. key: 'handleResult',
  7933. value: function handleResult(succeeded) {
  7934. this.emitter.emit(succeeded ? 'success' : 'error', {
  7935. action: this.action,
  7936. text: this.selectedText,
  7937. trigger: this.trigger,
  7938. clearSelection: this.clearSelection.bind(this)
  7939. });
  7940. }
  7941. /**
  7942. * Moves focus away from `target` and back to the trigger, removes current selection.
  7943. */
  7944. }, {
  7945. key: 'clearSelection',
  7946. value: function clearSelection() {
  7947. if (this.trigger) {
  7948. this.trigger.focus();
  7949. }
  7950. window.getSelection().removeAllRanges();
  7951. }
  7952. /**
  7953. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  7954. * @param {String} action
  7955. */
  7956. }, {
  7957. key: 'destroy',
  7958. /**
  7959. * Destroy lifecycle.
  7960. */
  7961. value: function destroy() {
  7962. this.removeFake();
  7963. }
  7964. }, {
  7965. key: 'action',
  7966. set: function set() {
  7967. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  7968. this._action = action;
  7969. if (this._action !== 'copy' && this._action !== 'cut') {
  7970. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  7971. }
  7972. }
  7973. /**
  7974. * Gets the `action` property.
  7975. * @return {String}
  7976. */
  7977. ,
  7978. get: function get() {
  7979. return this._action;
  7980. }
  7981. /**
  7982. * Sets the `target` property using an element
  7983. * that will be have its content copied.
  7984. * @param {Element} target
  7985. */
  7986. }, {
  7987. key: 'target',
  7988. set: function set(target) {
  7989. if (target !== undefined) {
  7990. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  7991. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  7992. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  7993. }
  7994. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  7995. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  7996. }
  7997. this._target = target;
  7998. } else {
  7999. throw new Error('Invalid "target" value, use a valid Element');
  8000. }
  8001. }
  8002. }
  8003. /**
  8004. * Gets the `target` property.
  8005. * @return {String|HTMLElement}
  8006. */
  8007. ,
  8008. get: function get() {
  8009. return this._target;
  8010. }
  8011. }]);
  8012. return ClipboardAction;
  8013. }();
  8014. module.exports = ClipboardAction;
  8015. /***/ }),
  8016. /* 2 */
  8017. /***/ (function(module, exports) {
  8018. function select(element) {
  8019. var selectedText;
  8020. if (element.nodeName === 'SELECT') {
  8021. element.focus();
  8022. selectedText = element.value;
  8023. }
  8024. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8025. var isReadOnly = element.hasAttribute('readonly');
  8026. if (!isReadOnly) {
  8027. element.setAttribute('readonly', '');
  8028. }
  8029. element.select();
  8030. element.setSelectionRange(0, element.value.length);
  8031. if (!isReadOnly) {
  8032. element.removeAttribute('readonly');
  8033. }
  8034. selectedText = element.value;
  8035. }
  8036. else {
  8037. if (element.hasAttribute('contenteditable')) {
  8038. element.focus();
  8039. }
  8040. var selection = window.getSelection();
  8041. var range = document.createRange();
  8042. range.selectNodeContents(element);
  8043. selection.removeAllRanges();
  8044. selection.addRange(range);
  8045. selectedText = selection.toString();
  8046. }
  8047. return selectedText;
  8048. }
  8049. module.exports = select;
  8050. /***/ }),
  8051. /* 3 */
  8052. /***/ (function(module, exports) {
  8053. function E () {
  8054. // Keep this empty so it's easier to inherit from
  8055. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8056. }
  8057. E.prototype = {
  8058. on: function (name, callback, ctx) {
  8059. var e = this.e || (this.e = {});
  8060. (e[name] || (e[name] = [])).push({
  8061. fn: callback,
  8062. ctx: ctx
  8063. });
  8064. return this;
  8065. },
  8066. once: function (name, callback, ctx) {
  8067. var self = this;
  8068. function listener () {
  8069. self.off(name, listener);
  8070. callback.apply(ctx, arguments);
  8071. };
  8072. listener._ = callback
  8073. return this.on(name, listener, ctx);
  8074. },
  8075. emit: function (name) {
  8076. var data = [].slice.call(arguments, 1);
  8077. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8078. var i = 0;
  8079. var len = evtArr.length;
  8080. for (i; i < len; i++) {
  8081. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8082. }
  8083. return this;
  8084. },
  8085. off: function (name, callback) {
  8086. var e = this.e || (this.e = {});
  8087. var evts = e[name];
  8088. var liveEvents = [];
  8089. if (evts && callback) {
  8090. for (var i = 0, len = evts.length; i < len; i++) {
  8091. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8092. liveEvents.push(evts[i]);
  8093. }
  8094. }
  8095. // Remove event from queue to prevent memory leak
  8096. // Suggested by https://github.com/lazd
  8097. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8098. (liveEvents.length)
  8099. ? e[name] = liveEvents
  8100. : delete e[name];
  8101. return this;
  8102. }
  8103. };
  8104. module.exports = E;
  8105. /***/ }),
  8106. /* 4 */
  8107. /***/ (function(module, exports, __webpack_require__) {
  8108. var is = __webpack_require__(5);
  8109. var delegate = __webpack_require__(6);
  8110. /**
  8111. * Validates all params and calls the right
  8112. * listener function based on its target type.
  8113. *
  8114. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8115. * @param {String} type
  8116. * @param {Function} callback
  8117. * @return {Object}
  8118. */
  8119. function listen(target, type, callback) {
  8120. if (!target && !type && !callback) {
  8121. throw new Error('Missing required arguments');
  8122. }
  8123. if (!is.string(type)) {
  8124. throw new TypeError('Second argument must be a String');
  8125. }
  8126. if (!is.fn(callback)) {
  8127. throw new TypeError('Third argument must be a Function');
  8128. }
  8129. if (is.node(target)) {
  8130. return listenNode(target, type, callback);
  8131. }
  8132. else if (is.nodeList(target)) {
  8133. return listenNodeList(target, type, callback);
  8134. }
  8135. else if (is.string(target)) {
  8136. return listenSelector(target, type, callback);
  8137. }
  8138. else {
  8139. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8140. }
  8141. }
  8142. /**
  8143. * Adds an event listener to a HTML element
  8144. * and returns a remove listener function.
  8145. *
  8146. * @param {HTMLElement} node
  8147. * @param {String} type
  8148. * @param {Function} callback
  8149. * @return {Object}
  8150. */
  8151. function listenNode(node, type, callback) {
  8152. node.addEventListener(type, callback);
  8153. return {
  8154. destroy: function() {
  8155. node.removeEventListener(type, callback);
  8156. }
  8157. }
  8158. }
  8159. /**
  8160. * Add an event listener to a list of HTML elements
  8161. * and returns a remove listener function.
  8162. *
  8163. * @param {NodeList|HTMLCollection} nodeList
  8164. * @param {String} type
  8165. * @param {Function} callback
  8166. * @return {Object}
  8167. */
  8168. function listenNodeList(nodeList, type, callback) {
  8169. Array.prototype.forEach.call(nodeList, function(node) {
  8170. node.addEventListener(type, callback);
  8171. });
  8172. return {
  8173. destroy: function() {
  8174. Array.prototype.forEach.call(nodeList, function(node) {
  8175. node.removeEventListener(type, callback);
  8176. });
  8177. }
  8178. }
  8179. }
  8180. /**
  8181. * Add an event listener to a selector
  8182. * and returns a remove listener function.
  8183. *
  8184. * @param {String} selector
  8185. * @param {String} type
  8186. * @param {Function} callback
  8187. * @return {Object}
  8188. */
  8189. function listenSelector(selector, type, callback) {
  8190. return delegate(document.body, selector, type, callback);
  8191. }
  8192. module.exports = listen;
  8193. /***/ }),
  8194. /* 5 */
  8195. /***/ (function(module, exports) {
  8196. /**
  8197. * Check if argument is a HTML element.
  8198. *
  8199. * @param {Object} value
  8200. * @return {Boolean}
  8201. */
  8202. exports.node = function(value) {
  8203. return value !== undefined
  8204. && value instanceof HTMLElement
  8205. && value.nodeType === 1;
  8206. };
  8207. /**
  8208. * Check if argument is a list of HTML elements.
  8209. *
  8210. * @param {Object} value
  8211. * @return {Boolean}
  8212. */
  8213. exports.nodeList = function(value) {
  8214. var type = Object.prototype.toString.call(value);
  8215. return value !== undefined
  8216. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8217. && ('length' in value)
  8218. && (value.length === 0 || exports.node(value[0]));
  8219. };
  8220. /**
  8221. * Check if argument is a string.
  8222. *
  8223. * @param {Object} value
  8224. * @return {Boolean}
  8225. */
  8226. exports.string = function(value) {
  8227. return typeof value === 'string'
  8228. || value instanceof String;
  8229. };
  8230. /**
  8231. * Check if argument is a function.
  8232. *
  8233. * @param {Object} value
  8234. * @return {Boolean}
  8235. */
  8236. exports.fn = function(value) {
  8237. var type = Object.prototype.toString.call(value);
  8238. return type === '[object Function]';
  8239. };
  8240. /***/ }),
  8241. /* 6 */
  8242. /***/ (function(module, exports, __webpack_require__) {
  8243. var closest = __webpack_require__(7);
  8244. /**
  8245. * Delegates event to a selector.
  8246. *
  8247. * @param {Element} element
  8248. * @param {String} selector
  8249. * @param {String} type
  8250. * @param {Function} callback
  8251. * @param {Boolean} useCapture
  8252. * @return {Object}
  8253. */
  8254. function _delegate(element, selector, type, callback, useCapture) {
  8255. var listenerFn = listener.apply(this, arguments);
  8256. element.addEventListener(type, listenerFn, useCapture);
  8257. return {
  8258. destroy: function() {
  8259. element.removeEventListener(type, listenerFn, useCapture);
  8260. }
  8261. }
  8262. }
  8263. /**
  8264. * Delegates event to a selector.
  8265. *
  8266. * @param {Element|String|Array} [elements]
  8267. * @param {String} selector
  8268. * @param {String} type
  8269. * @param {Function} callback
  8270. * @param {Boolean} useCapture
  8271. * @return {Object}
  8272. */
  8273. function delegate(elements, selector, type, callback, useCapture) {
  8274. // Handle the regular Element usage
  8275. if (typeof elements.addEventListener === 'function') {
  8276. return _delegate.apply(null, arguments);
  8277. }
  8278. // Handle Element-less usage, it defaults to global delegation
  8279. if (typeof type === 'function') {
  8280. // Use `document` as the first parameter, then apply arguments
  8281. // This is a short way to .unshift `arguments` without running into deoptimizations
  8282. return _delegate.bind(null, document).apply(null, arguments);
  8283. }
  8284. // Handle Selector-based usage
  8285. if (typeof elements === 'string') {
  8286. elements = document.querySelectorAll(elements);
  8287. }
  8288. // Handle Array-like based usage
  8289. return Array.prototype.map.call(elements, function (element) {
  8290. return _delegate(element, selector, type, callback, useCapture);
  8291. });
  8292. }
  8293. /**
  8294. * Finds closest match and invokes callback.
  8295. *
  8296. * @param {Element} element
  8297. * @param {String} selector
  8298. * @param {String} type
  8299. * @param {Function} callback
  8300. * @return {Function}
  8301. */
  8302. function listener(element, selector, type, callback) {
  8303. return function(e) {
  8304. e.delegateTarget = closest(e.target, selector);
  8305. if (e.delegateTarget) {
  8306. callback.call(element, e);
  8307. }
  8308. }
  8309. }
  8310. module.exports = delegate;
  8311. /***/ }),
  8312. /* 7 */
  8313. /***/ (function(module, exports) {
  8314. var DOCUMENT_NODE_TYPE = 9;
  8315. /**
  8316. * A polyfill for Element.matches()
  8317. */
  8318. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8319. var proto = Element.prototype;
  8320. proto.matches = proto.matchesSelector ||
  8321. proto.mozMatchesSelector ||
  8322. proto.msMatchesSelector ||
  8323. proto.oMatchesSelector ||
  8324. proto.webkitMatchesSelector;
  8325. }
  8326. /**
  8327. * Finds the closest parent that matches a selector.
  8328. *
  8329. * @param {Element} element
  8330. * @param {String} selector
  8331. * @return {Function}
  8332. */
  8333. function closest (element, selector) {
  8334. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8335. if (typeof element.matches === 'function' &&
  8336. element.matches(selector)) {
  8337. return element;
  8338. }
  8339. element = element.parentNode;
  8340. }
  8341. }
  8342. module.exports = closest;
  8343. /***/ })
  8344. /******/ ]);
  8345. });
  8346. /***/ }),
  8347. /***/ "./node_modules/ieee754/index.js":
  8348. /*!***************************************!*\
  8349. !*** ./node_modules/ieee754/index.js ***!
  8350. \***************************************/
  8351. /*! no static exports found */
  8352. /***/ (function(module, exports) {
  8353. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8354. var e, m
  8355. var eLen = (nBytes * 8) - mLen - 1
  8356. var eMax = (1 << eLen) - 1
  8357. var eBias = eMax >> 1
  8358. var nBits = -7
  8359. var i = isLE ? (nBytes - 1) : 0
  8360. var d = isLE ? -1 : 1
  8361. var s = buffer[offset + i]
  8362. i += d
  8363. e = s & ((1 << (-nBits)) - 1)
  8364. s >>= (-nBits)
  8365. nBits += eLen
  8366. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8367. m = e & ((1 << (-nBits)) - 1)
  8368. e >>= (-nBits)
  8369. nBits += mLen
  8370. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8371. if (e === 0) {
  8372. e = 1 - eBias
  8373. } else if (e === eMax) {
  8374. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8375. } else {
  8376. m = m + Math.pow(2, mLen)
  8377. e = e - eBias
  8378. }
  8379. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8380. }
  8381. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8382. var e, m, c
  8383. var eLen = (nBytes * 8) - mLen - 1
  8384. var eMax = (1 << eLen) - 1
  8385. var eBias = eMax >> 1
  8386. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8387. var i = isLE ? 0 : (nBytes - 1)
  8388. var d = isLE ? 1 : -1
  8389. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8390. value = Math.abs(value)
  8391. if (isNaN(value) || value === Infinity) {
  8392. m = isNaN(value) ? 1 : 0
  8393. e = eMax
  8394. } else {
  8395. e = Math.floor(Math.log(value) / Math.LN2)
  8396. if (value * (c = Math.pow(2, -e)) < 1) {
  8397. e--
  8398. c *= 2
  8399. }
  8400. if (e + eBias >= 1) {
  8401. value += rt / c
  8402. } else {
  8403. value += rt * Math.pow(2, 1 - eBias)
  8404. }
  8405. if (value * c >= 2) {
  8406. e++
  8407. c /= 2
  8408. }
  8409. if (e + eBias >= eMax) {
  8410. m = 0
  8411. e = eMax
  8412. } else if (e + eBias >= 1) {
  8413. m = ((value * c) - 1) * Math.pow(2, mLen)
  8414. e = e + eBias
  8415. } else {
  8416. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8417. e = 0
  8418. }
  8419. }
  8420. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8421. e = (e << mLen) | m
  8422. eLen += mLen
  8423. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8424. buffer[offset + i - d] |= s * 128
  8425. }
  8426. /***/ }),
  8427. /***/ "./node_modules/isarray/index.js":
  8428. /*!***************************************!*\
  8429. !*** ./node_modules/isarray/index.js ***!
  8430. \***************************************/
  8431. /*! no static exports found */
  8432. /***/ (function(module, exports) {
  8433. var toString = {}.toString;
  8434. module.exports = Array.isArray || function (arr) {
  8435. return toString.call(arr) == '[object Array]';
  8436. };
  8437. /***/ }),
  8438. /***/ "./node_modules/jquery/dist/jquery.js":
  8439. /*!********************************************!*\
  8440. !*** ./node_modules/jquery/dist/jquery.js ***!
  8441. \********************************************/
  8442. /*! no static exports found */
  8443. /***/ (function(module, exports, __webpack_require__) {
  8444. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8445. * jQuery JavaScript Library v3.4.1
  8446. * https://jquery.com/
  8447. *
  8448. * Includes Sizzle.js
  8449. * https://sizzlejs.com/
  8450. *
  8451. * Copyright JS Foundation and other contributors
  8452. * Released under the MIT license
  8453. * https://jquery.org/license
  8454. *
  8455. * Date: 2019-05-01T21:04Z
  8456. */
  8457. ( function( global, factory ) {
  8458. "use strict";
  8459. if ( true && typeof module.exports === "object" ) {
  8460. // For CommonJS and CommonJS-like environments where a proper `window`
  8461. // is present, execute the factory and get jQuery.
  8462. // For environments that do not have a `window` with a `document`
  8463. // (such as Node.js), expose a factory as module.exports.
  8464. // This accentuates the need for the creation of a real `window`.
  8465. // e.g. var jQuery = require("jquery")(window);
  8466. // See ticket #14549 for more info.
  8467. module.exports = global.document ?
  8468. factory( global, true ) :
  8469. function( w ) {
  8470. if ( !w.document ) {
  8471. throw new Error( "jQuery requires a window with a document" );
  8472. }
  8473. return factory( w );
  8474. };
  8475. } else {
  8476. factory( global );
  8477. }
  8478. // Pass this if window is not defined yet
  8479. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8480. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8481. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8482. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8483. // enough that all such attempts are guarded in a try block.
  8484. "use strict";
  8485. var arr = [];
  8486. var document = window.document;
  8487. var getProto = Object.getPrototypeOf;
  8488. var slice = arr.slice;
  8489. var concat = arr.concat;
  8490. var push = arr.push;
  8491. var indexOf = arr.indexOf;
  8492. var class2type = {};
  8493. var toString = class2type.toString;
  8494. var hasOwn = class2type.hasOwnProperty;
  8495. var fnToString = hasOwn.toString;
  8496. var ObjectFunctionString = fnToString.call( Object );
  8497. var support = {};
  8498. var isFunction = function isFunction( obj ) {
  8499. // Support: Chrome <=57, Firefox <=52
  8500. // In some browsers, typeof returns "function" for HTML <object> elements
  8501. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8502. // We don't want to classify *any* DOM node as a function.
  8503. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8504. };
  8505. var isWindow = function isWindow( obj ) {
  8506. return obj != null && obj === obj.window;
  8507. };
  8508. var preservedScriptAttributes = {
  8509. type: true,
  8510. src: true,
  8511. nonce: true,
  8512. noModule: true
  8513. };
  8514. function DOMEval( code, node, doc ) {
  8515. doc = doc || document;
  8516. var i, val,
  8517. script = doc.createElement( "script" );
  8518. script.text = code;
  8519. if ( node ) {
  8520. for ( i in preservedScriptAttributes ) {
  8521. // Support: Firefox 64+, Edge 18+
  8522. // Some browsers don't support the "nonce" property on scripts.
  8523. // On the other hand, just using `getAttribute` is not enough as
  8524. // the `nonce` attribute is reset to an empty string whenever it
  8525. // becomes browsing-context connected.
  8526. // See https://github.com/whatwg/html/issues/2369
  8527. // See https://html.spec.whatwg.org/#nonce-attributes
  8528. // The `node.getAttribute` check was added for the sake of
  8529. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8530. // via an object.
  8531. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8532. if ( val ) {
  8533. script.setAttribute( i, val );
  8534. }
  8535. }
  8536. }
  8537. doc.head.appendChild( script ).parentNode.removeChild( script );
  8538. }
  8539. function toType( obj ) {
  8540. if ( obj == null ) {
  8541. return obj + "";
  8542. }
  8543. // Support: Android <=2.3 only (functionish RegExp)
  8544. return typeof obj === "object" || typeof obj === "function" ?
  8545. class2type[ toString.call( obj ) ] || "object" :
  8546. typeof obj;
  8547. }
  8548. /* global Symbol */
  8549. // Defining this global in .eslintrc.json would create a danger of using the global
  8550. // unguarded in another place, it seems safer to define global only for this module
  8551. var
  8552. version = "3.4.1",
  8553. // Define a local copy of jQuery
  8554. jQuery = function( selector, context ) {
  8555. // The jQuery object is actually just the init constructor 'enhanced'
  8556. // Need init if jQuery is called (just allow error to be thrown if not included)
  8557. return new jQuery.fn.init( selector, context );
  8558. },
  8559. // Support: Android <=4.0 only
  8560. // Make sure we trim BOM and NBSP
  8561. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8562. jQuery.fn = jQuery.prototype = {
  8563. // The current version of jQuery being used
  8564. jquery: version,
  8565. constructor: jQuery,
  8566. // The default length of a jQuery object is 0
  8567. length: 0,
  8568. toArray: function() {
  8569. return slice.call( this );
  8570. },
  8571. // Get the Nth element in the matched element set OR
  8572. // Get the whole matched element set as a clean array
  8573. get: function( num ) {
  8574. // Return all the elements in a clean array
  8575. if ( num == null ) {
  8576. return slice.call( this );
  8577. }
  8578. // Return just the one element from the set
  8579. return num < 0 ? this[ num + this.length ] : this[ num ];
  8580. },
  8581. // Take an array of elements and push it onto the stack
  8582. // (returning the new matched element set)
  8583. pushStack: function( elems ) {
  8584. // Build a new jQuery matched element set
  8585. var ret = jQuery.merge( this.constructor(), elems );
  8586. // Add the old object onto the stack (as a reference)
  8587. ret.prevObject = this;
  8588. // Return the newly-formed element set
  8589. return ret;
  8590. },
  8591. // Execute a callback for every element in the matched set.
  8592. each: function( callback ) {
  8593. return jQuery.each( this, callback );
  8594. },
  8595. map: function( callback ) {
  8596. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8597. return callback.call( elem, i, elem );
  8598. } ) );
  8599. },
  8600. slice: function() {
  8601. return this.pushStack( slice.apply( this, arguments ) );
  8602. },
  8603. first: function() {
  8604. return this.eq( 0 );
  8605. },
  8606. last: function() {
  8607. return this.eq( -1 );
  8608. },
  8609. eq: function( i ) {
  8610. var len = this.length,
  8611. j = +i + ( i < 0 ? len : 0 );
  8612. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8613. },
  8614. end: function() {
  8615. return this.prevObject || this.constructor();
  8616. },
  8617. // For internal use only.
  8618. // Behaves like an Array's method, not like a jQuery method.
  8619. push: push,
  8620. sort: arr.sort,
  8621. splice: arr.splice
  8622. };
  8623. jQuery.extend = jQuery.fn.extend = function() {
  8624. var options, name, src, copy, copyIsArray, clone,
  8625. target = arguments[ 0 ] || {},
  8626. i = 1,
  8627. length = arguments.length,
  8628. deep = false;
  8629. // Handle a deep copy situation
  8630. if ( typeof target === "boolean" ) {
  8631. deep = target;
  8632. // Skip the boolean and the target
  8633. target = arguments[ i ] || {};
  8634. i++;
  8635. }
  8636. // Handle case when target is a string or something (possible in deep copy)
  8637. if ( typeof target !== "object" && !isFunction( target ) ) {
  8638. target = {};
  8639. }
  8640. // Extend jQuery itself if only one argument is passed
  8641. if ( i === length ) {
  8642. target = this;
  8643. i--;
  8644. }
  8645. for ( ; i < length; i++ ) {
  8646. // Only deal with non-null/undefined values
  8647. if ( ( options = arguments[ i ] ) != null ) {
  8648. // Extend the base object
  8649. for ( name in options ) {
  8650. copy = options[ name ];
  8651. // Prevent Object.prototype pollution
  8652. // Prevent never-ending loop
  8653. if ( name === "__proto__" || target === copy ) {
  8654. continue;
  8655. }
  8656. // Recurse if we're merging plain objects or arrays
  8657. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8658. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8659. src = target[ name ];
  8660. // Ensure proper type for the source value
  8661. if ( copyIsArray && !Array.isArray( src ) ) {
  8662. clone = [];
  8663. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8664. clone = {};
  8665. } else {
  8666. clone = src;
  8667. }
  8668. copyIsArray = false;
  8669. // Never move original objects, clone them
  8670. target[ name ] = jQuery.extend( deep, clone, copy );
  8671. // Don't bring in undefined values
  8672. } else if ( copy !== undefined ) {
  8673. target[ name ] = copy;
  8674. }
  8675. }
  8676. }
  8677. }
  8678. // Return the modified object
  8679. return target;
  8680. };
  8681. jQuery.extend( {
  8682. // Unique for each copy of jQuery on the page
  8683. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8684. // Assume jQuery is ready without the ready module
  8685. isReady: true,
  8686. error: function( msg ) {
  8687. throw new Error( msg );
  8688. },
  8689. noop: function() {},
  8690. isPlainObject: function( obj ) {
  8691. var proto, Ctor;
  8692. // Detect obvious negatives
  8693. // Use toString instead of jQuery.type to catch host objects
  8694. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8695. return false;
  8696. }
  8697. proto = getProto( obj );
  8698. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8699. if ( !proto ) {
  8700. return true;
  8701. }
  8702. // Objects with prototype are plain iff they were constructed by a global Object function
  8703. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8704. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8705. },
  8706. isEmptyObject: function( obj ) {
  8707. var name;
  8708. for ( name in obj ) {
  8709. return false;
  8710. }
  8711. return true;
  8712. },
  8713. // Evaluates a script in a global context
  8714. globalEval: function( code, options ) {
  8715. DOMEval( code, { nonce: options && options.nonce } );
  8716. },
  8717. each: function( obj, callback ) {
  8718. var length, i = 0;
  8719. if ( isArrayLike( obj ) ) {
  8720. length = obj.length;
  8721. for ( ; i < length; i++ ) {
  8722. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8723. break;
  8724. }
  8725. }
  8726. } else {
  8727. for ( i in obj ) {
  8728. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8729. break;
  8730. }
  8731. }
  8732. }
  8733. return obj;
  8734. },
  8735. // Support: Android <=4.0 only
  8736. trim: function( text ) {
  8737. return text == null ?
  8738. "" :
  8739. ( text + "" ).replace( rtrim, "" );
  8740. },
  8741. // results is for internal usage only
  8742. makeArray: function( arr, results ) {
  8743. var ret = results || [];
  8744. if ( arr != null ) {
  8745. if ( isArrayLike( Object( arr ) ) ) {
  8746. jQuery.merge( ret,
  8747. typeof arr === "string" ?
  8748. [ arr ] : arr
  8749. );
  8750. } else {
  8751. push.call( ret, arr );
  8752. }
  8753. }
  8754. return ret;
  8755. },
  8756. inArray: function( elem, arr, i ) {
  8757. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8758. },
  8759. // Support: Android <=4.0 only, PhantomJS 1 only
  8760. // push.apply(_, arraylike) throws on ancient WebKit
  8761. merge: function( first, second ) {
  8762. var len = +second.length,
  8763. j = 0,
  8764. i = first.length;
  8765. for ( ; j < len; j++ ) {
  8766. first[ i++ ] = second[ j ];
  8767. }
  8768. first.length = i;
  8769. return first;
  8770. },
  8771. grep: function( elems, callback, invert ) {
  8772. var callbackInverse,
  8773. matches = [],
  8774. i = 0,
  8775. length = elems.length,
  8776. callbackExpect = !invert;
  8777. // Go through the array, only saving the items
  8778. // that pass the validator function
  8779. for ( ; i < length; i++ ) {
  8780. callbackInverse = !callback( elems[ i ], i );
  8781. if ( callbackInverse !== callbackExpect ) {
  8782. matches.push( elems[ i ] );
  8783. }
  8784. }
  8785. return matches;
  8786. },
  8787. // arg is for internal usage only
  8788. map: function( elems, callback, arg ) {
  8789. var length, value,
  8790. i = 0,
  8791. ret = [];
  8792. // Go through the array, translating each of the items to their new values
  8793. if ( isArrayLike( elems ) ) {
  8794. length = elems.length;
  8795. for ( ; i < length; i++ ) {
  8796. value = callback( elems[ i ], i, arg );
  8797. if ( value != null ) {
  8798. ret.push( value );
  8799. }
  8800. }
  8801. // Go through every key on the object,
  8802. } else {
  8803. for ( i in elems ) {
  8804. value = callback( elems[ i ], i, arg );
  8805. if ( value != null ) {
  8806. ret.push( value );
  8807. }
  8808. }
  8809. }
  8810. // Flatten any nested arrays
  8811. return concat.apply( [], ret );
  8812. },
  8813. // A global GUID counter for objects
  8814. guid: 1,
  8815. // jQuery.support is not used in Core but other projects attach their
  8816. // properties to it so it needs to exist.
  8817. support: support
  8818. } );
  8819. if ( typeof Symbol === "function" ) {
  8820. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8821. }
  8822. // Populate the class2type map
  8823. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8824. function( i, name ) {
  8825. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8826. } );
  8827. function isArrayLike( obj ) {
  8828. // Support: real iOS 8.2 only (not reproducible in simulator)
  8829. // `in` check used to prevent JIT error (gh-2145)
  8830. // hasOwn isn't used here due to false negatives
  8831. // regarding Nodelist length in IE
  8832. var length = !!obj && "length" in obj && obj.length,
  8833. type = toType( obj );
  8834. if ( isFunction( obj ) || isWindow( obj ) ) {
  8835. return false;
  8836. }
  8837. return type === "array" || length === 0 ||
  8838. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8839. }
  8840. var Sizzle =
  8841. /*!
  8842. * Sizzle CSS Selector Engine v2.3.4
  8843. * https://sizzlejs.com/
  8844. *
  8845. * Copyright JS Foundation and other contributors
  8846. * Released under the MIT license
  8847. * https://js.foundation/
  8848. *
  8849. * Date: 2019-04-08
  8850. */
  8851. (function( window ) {
  8852. var i,
  8853. support,
  8854. Expr,
  8855. getText,
  8856. isXML,
  8857. tokenize,
  8858. compile,
  8859. select,
  8860. outermostContext,
  8861. sortInput,
  8862. hasDuplicate,
  8863. // Local document vars
  8864. setDocument,
  8865. document,
  8866. docElem,
  8867. documentIsHTML,
  8868. rbuggyQSA,
  8869. rbuggyMatches,
  8870. matches,
  8871. contains,
  8872. // Instance-specific data
  8873. expando = "sizzle" + 1 * new Date(),
  8874. preferredDoc = window.document,
  8875. dirruns = 0,
  8876. done = 0,
  8877. classCache = createCache(),
  8878. tokenCache = createCache(),
  8879. compilerCache = createCache(),
  8880. nonnativeSelectorCache = createCache(),
  8881. sortOrder = function( a, b ) {
  8882. if ( a === b ) {
  8883. hasDuplicate = true;
  8884. }
  8885. return 0;
  8886. },
  8887. // Instance methods
  8888. hasOwn = ({}).hasOwnProperty,
  8889. arr = [],
  8890. pop = arr.pop,
  8891. push_native = arr.push,
  8892. push = arr.push,
  8893. slice = arr.slice,
  8894. // Use a stripped-down indexOf as it's faster than native
  8895. // https://jsperf.com/thor-indexof-vs-for/5
  8896. indexOf = function( list, elem ) {
  8897. var i = 0,
  8898. len = list.length;
  8899. for ( ; i < len; i++ ) {
  8900. if ( list[i] === elem ) {
  8901. return i;
  8902. }
  8903. }
  8904. return -1;
  8905. },
  8906. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8907. // Regular expressions
  8908. // http://www.w3.org/TR/css3-selectors/#whitespace
  8909. whitespace = "[\\x20\\t\\r\\n\\f]",
  8910. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  8911. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  8912. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  8913. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  8914. // Operator (capture 2)
  8915. "*([*^$|!~]?=)" + whitespace +
  8916. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  8917. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  8918. "*\\]",
  8919. pseudos = ":(" + identifier + ")(?:\\((" +
  8920. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  8921. // 1. quoted (capture 3; capture 4 or capture 5)
  8922. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  8923. // 2. simple (capture 6)
  8924. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  8925. // 3. anything else (capture 2)
  8926. ".*" +
  8927. ")\\)|)",
  8928. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  8929. rwhitespace = new RegExp( whitespace + "+", "g" ),
  8930. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  8931. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  8932. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  8933. rdescend = new RegExp( whitespace + "|>" ),
  8934. rpseudo = new RegExp( pseudos ),
  8935. ridentifier = new RegExp( "^" + identifier + "$" ),
  8936. matchExpr = {
  8937. "ID": new RegExp( "^#(" + identifier + ")" ),
  8938. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  8939. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  8940. "ATTR": new RegExp( "^" + attributes ),
  8941. "PSEUDO": new RegExp( "^" + pseudos ),
  8942. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  8943. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  8944. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  8945. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  8946. // For use in libraries implementing .is()
  8947. // We use this for POS matching in `select`
  8948. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  8949. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  8950. },
  8951. rhtml = /HTML$/i,
  8952. rinputs = /^(?:input|select|textarea|button)$/i,
  8953. rheader = /^h\d$/i,
  8954. rnative = /^[^{]+\{\s*\[native \w/,
  8955. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  8956. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  8957. rsibling = /[+~]/,
  8958. // CSS escapes
  8959. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  8960. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  8961. funescape = function( _, escaped, escapedWhitespace ) {
  8962. var high = "0x" + escaped - 0x10000;
  8963. // NaN means non-codepoint
  8964. // Support: Firefox<24
  8965. // Workaround erroneous numeric interpretation of +"0x"
  8966. return high !== high || escapedWhitespace ?
  8967. escaped :
  8968. high < 0 ?
  8969. // BMP codepoint
  8970. String.fromCharCode( high + 0x10000 ) :
  8971. // Supplemental Plane codepoint (surrogate pair)
  8972. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  8973. },
  8974. // CSS string/identifier serialization
  8975. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  8976. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  8977. fcssescape = function( ch, asCodePoint ) {
  8978. if ( asCodePoint ) {
  8979. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  8980. if ( ch === "\0" ) {
  8981. return "\uFFFD";
  8982. }
  8983. // Control characters and (dependent upon position) numbers get escaped as code points
  8984. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  8985. }
  8986. // Other potentially-special ASCII characters get backslash-escaped
  8987. return "\\" + ch;
  8988. },
  8989. // Used for iframes
  8990. // See setDocument()
  8991. // Removing the function wrapper causes a "Permission Denied"
  8992. // error in IE
  8993. unloadHandler = function() {
  8994. setDocument();
  8995. },
  8996. inDisabledFieldset = addCombinator(
  8997. function( elem ) {
  8998. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  8999. },
  9000. { dir: "parentNode", next: "legend" }
  9001. );
  9002. // Optimize for push.apply( _, NodeList )
  9003. try {
  9004. push.apply(
  9005. (arr = slice.call( preferredDoc.childNodes )),
  9006. preferredDoc.childNodes
  9007. );
  9008. // Support: Android<4.0
  9009. // Detect silently failing push.apply
  9010. arr[ preferredDoc.childNodes.length ].nodeType;
  9011. } catch ( e ) {
  9012. push = { apply: arr.length ?
  9013. // Leverage slice if possible
  9014. function( target, els ) {
  9015. push_native.apply( target, slice.call(els) );
  9016. } :
  9017. // Support: IE<9
  9018. // Otherwise append directly
  9019. function( target, els ) {
  9020. var j = target.length,
  9021. i = 0;
  9022. // Can't trust NodeList.length
  9023. while ( (target[j++] = els[i++]) ) {}
  9024. target.length = j - 1;
  9025. }
  9026. };
  9027. }
  9028. function Sizzle( selector, context, results, seed ) {
  9029. var m, i, elem, nid, match, groups, newSelector,
  9030. newContext = context && context.ownerDocument,
  9031. // nodeType defaults to 9, since context defaults to document
  9032. nodeType = context ? context.nodeType : 9;
  9033. results = results || [];
  9034. // Return early from calls with invalid selector or context
  9035. if ( typeof selector !== "string" || !selector ||
  9036. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9037. return results;
  9038. }
  9039. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9040. if ( !seed ) {
  9041. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9042. setDocument( context );
  9043. }
  9044. context = context || document;
  9045. if ( documentIsHTML ) {
  9046. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9047. // (excepting DocumentFragment context, where the methods don't exist)
  9048. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9049. // ID selector
  9050. if ( (m = match[1]) ) {
  9051. // Document context
  9052. if ( nodeType === 9 ) {
  9053. if ( (elem = context.getElementById( m )) ) {
  9054. // Support: IE, Opera, Webkit
  9055. // TODO: identify versions
  9056. // getElementById can match elements by name instead of ID
  9057. if ( elem.id === m ) {
  9058. results.push( elem );
  9059. return results;
  9060. }
  9061. } else {
  9062. return results;
  9063. }
  9064. // Element context
  9065. } else {
  9066. // Support: IE, Opera, Webkit
  9067. // TODO: identify versions
  9068. // getElementById can match elements by name instead of ID
  9069. if ( newContext && (elem = newContext.getElementById( m )) &&
  9070. contains( context, elem ) &&
  9071. elem.id === m ) {
  9072. results.push( elem );
  9073. return results;
  9074. }
  9075. }
  9076. // Type selector
  9077. } else if ( match[2] ) {
  9078. push.apply( results, context.getElementsByTagName( selector ) );
  9079. return results;
  9080. // Class selector
  9081. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9082. context.getElementsByClassName ) {
  9083. push.apply( results, context.getElementsByClassName( m ) );
  9084. return results;
  9085. }
  9086. }
  9087. // Take advantage of querySelectorAll
  9088. if ( support.qsa &&
  9089. !nonnativeSelectorCache[ selector + " " ] &&
  9090. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9091. // Support: IE 8 only
  9092. // Exclude object elements
  9093. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9094. newSelector = selector;
  9095. newContext = context;
  9096. // qSA considers elements outside a scoping root when evaluating child or
  9097. // descendant combinators, which is not what we want.
  9098. // In such cases, we work around the behavior by prefixing every selector in the
  9099. // list with an ID selector referencing the scope context.
  9100. // Thanks to Andrew Dupont for this technique.
  9101. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9102. // Capture the context ID, setting it first if necessary
  9103. if ( (nid = context.getAttribute( "id" )) ) {
  9104. nid = nid.replace( rcssescape, fcssescape );
  9105. } else {
  9106. context.setAttribute( "id", (nid = expando) );
  9107. }
  9108. // Prefix every selector in the list
  9109. groups = tokenize( selector );
  9110. i = groups.length;
  9111. while ( i-- ) {
  9112. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9113. }
  9114. newSelector = groups.join( "," );
  9115. // Expand context for sibling selectors
  9116. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9117. context;
  9118. }
  9119. try {
  9120. push.apply( results,
  9121. newContext.querySelectorAll( newSelector )
  9122. );
  9123. return results;
  9124. } catch ( qsaError ) {
  9125. nonnativeSelectorCache( selector, true );
  9126. } finally {
  9127. if ( nid === expando ) {
  9128. context.removeAttribute( "id" );
  9129. }
  9130. }
  9131. }
  9132. }
  9133. }
  9134. // All others
  9135. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9136. }
  9137. /**
  9138. * Create key-value caches of limited size
  9139. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9140. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9141. * deleting the oldest entry
  9142. */
  9143. function createCache() {
  9144. var keys = [];
  9145. function cache( key, value ) {
  9146. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9147. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9148. // Only keep the most recent entries
  9149. delete cache[ keys.shift() ];
  9150. }
  9151. return (cache[ key + " " ] = value);
  9152. }
  9153. return cache;
  9154. }
  9155. /**
  9156. * Mark a function for special use by Sizzle
  9157. * @param {Function} fn The function to mark
  9158. */
  9159. function markFunction( fn ) {
  9160. fn[ expando ] = true;
  9161. return fn;
  9162. }
  9163. /**
  9164. * Support testing using an element
  9165. * @param {Function} fn Passed the created element and returns a boolean result
  9166. */
  9167. function assert( fn ) {
  9168. var el = document.createElement("fieldset");
  9169. try {
  9170. return !!fn( el );
  9171. } catch (e) {
  9172. return false;
  9173. } finally {
  9174. // Remove from its parent by default
  9175. if ( el.parentNode ) {
  9176. el.parentNode.removeChild( el );
  9177. }
  9178. // release memory in IE
  9179. el = null;
  9180. }
  9181. }
  9182. /**
  9183. * Adds the same handler for all of the specified attrs
  9184. * @param {String} attrs Pipe-separated list of attributes
  9185. * @param {Function} handler The method that will be applied
  9186. */
  9187. function addHandle( attrs, handler ) {
  9188. var arr = attrs.split("|"),
  9189. i = arr.length;
  9190. while ( i-- ) {
  9191. Expr.attrHandle[ arr[i] ] = handler;
  9192. }
  9193. }
  9194. /**
  9195. * Checks document order of two siblings
  9196. * @param {Element} a
  9197. * @param {Element} b
  9198. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9199. */
  9200. function siblingCheck( a, b ) {
  9201. var cur = b && a,
  9202. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9203. a.sourceIndex - b.sourceIndex;
  9204. // Use IE sourceIndex if available on both nodes
  9205. if ( diff ) {
  9206. return diff;
  9207. }
  9208. // Check if b follows a
  9209. if ( cur ) {
  9210. while ( (cur = cur.nextSibling) ) {
  9211. if ( cur === b ) {
  9212. return -1;
  9213. }
  9214. }
  9215. }
  9216. return a ? 1 : -1;
  9217. }
  9218. /**
  9219. * Returns a function to use in pseudos for input types
  9220. * @param {String} type
  9221. */
  9222. function createInputPseudo( type ) {
  9223. return function( elem ) {
  9224. var name = elem.nodeName.toLowerCase();
  9225. return name === "input" && elem.type === type;
  9226. };
  9227. }
  9228. /**
  9229. * Returns a function to use in pseudos for buttons
  9230. * @param {String} type
  9231. */
  9232. function createButtonPseudo( type ) {
  9233. return function( elem ) {
  9234. var name = elem.nodeName.toLowerCase();
  9235. return (name === "input" || name === "button") && elem.type === type;
  9236. };
  9237. }
  9238. /**
  9239. * Returns a function to use in pseudos for :enabled/:disabled
  9240. * @param {Boolean} disabled true for :disabled; false for :enabled
  9241. */
  9242. function createDisabledPseudo( disabled ) {
  9243. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9244. return function( elem ) {
  9245. // Only certain elements can match :enabled or :disabled
  9246. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9247. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9248. if ( "form" in elem ) {
  9249. // Check for inherited disabledness on relevant non-disabled elements:
  9250. // * listed form-associated elements in a disabled fieldset
  9251. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9252. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9253. // * option elements in a disabled optgroup
  9254. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9255. // All such elements have a "form" property.
  9256. if ( elem.parentNode && elem.disabled === false ) {
  9257. // Option elements defer to a parent optgroup if present
  9258. if ( "label" in elem ) {
  9259. if ( "label" in elem.parentNode ) {
  9260. return elem.parentNode.disabled === disabled;
  9261. } else {
  9262. return elem.disabled === disabled;
  9263. }
  9264. }
  9265. // Support: IE 6 - 11
  9266. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9267. return elem.isDisabled === disabled ||
  9268. // Where there is no isDisabled, check manually
  9269. /* jshint -W018 */
  9270. elem.isDisabled !== !disabled &&
  9271. inDisabledFieldset( elem ) === disabled;
  9272. }
  9273. return elem.disabled === disabled;
  9274. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9275. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9276. // even exist on them, let alone have a boolean value.
  9277. } else if ( "label" in elem ) {
  9278. return elem.disabled === disabled;
  9279. }
  9280. // Remaining elements are neither :enabled nor :disabled
  9281. return false;
  9282. };
  9283. }
  9284. /**
  9285. * Returns a function to use in pseudos for positionals
  9286. * @param {Function} fn
  9287. */
  9288. function createPositionalPseudo( fn ) {
  9289. return markFunction(function( argument ) {
  9290. argument = +argument;
  9291. return markFunction(function( seed, matches ) {
  9292. var j,
  9293. matchIndexes = fn( [], seed.length, argument ),
  9294. i = matchIndexes.length;
  9295. // Match elements found at the specified indexes
  9296. while ( i-- ) {
  9297. if ( seed[ (j = matchIndexes[i]) ] ) {
  9298. seed[j] = !(matches[j] = seed[j]);
  9299. }
  9300. }
  9301. });
  9302. });
  9303. }
  9304. /**
  9305. * Checks a node for validity as a Sizzle context
  9306. * @param {Element|Object=} context
  9307. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9308. */
  9309. function testContext( context ) {
  9310. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9311. }
  9312. // Expose support vars for convenience
  9313. support = Sizzle.support = {};
  9314. /**
  9315. * Detects XML nodes
  9316. * @param {Element|Object} elem An element or a document
  9317. * @returns {Boolean} True iff elem is a non-HTML XML node
  9318. */
  9319. isXML = Sizzle.isXML = function( elem ) {
  9320. var namespace = elem.namespaceURI,
  9321. docElem = (elem.ownerDocument || elem).documentElement;
  9322. // Support: IE <=8
  9323. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9324. // https://bugs.jquery.com/ticket/4833
  9325. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9326. };
  9327. /**
  9328. * Sets document-related variables once based on the current document
  9329. * @param {Element|Object} [doc] An element or document object to use to set the document
  9330. * @returns {Object} Returns the current document
  9331. */
  9332. setDocument = Sizzle.setDocument = function( node ) {
  9333. var hasCompare, subWindow,
  9334. doc = node ? node.ownerDocument || node : preferredDoc;
  9335. // Return early if doc is invalid or already selected
  9336. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9337. return document;
  9338. }
  9339. // Update global variables
  9340. document = doc;
  9341. docElem = document.documentElement;
  9342. documentIsHTML = !isXML( document );
  9343. // Support: IE 9-11, Edge
  9344. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9345. if ( preferredDoc !== document &&
  9346. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9347. // Support: IE 11, Edge
  9348. if ( subWindow.addEventListener ) {
  9349. subWindow.addEventListener( "unload", unloadHandler, false );
  9350. // Support: IE 9 - 10 only
  9351. } else if ( subWindow.attachEvent ) {
  9352. subWindow.attachEvent( "onunload", unloadHandler );
  9353. }
  9354. }
  9355. /* Attributes
  9356. ---------------------------------------------------------------------- */
  9357. // Support: IE<8
  9358. // Verify that getAttribute really returns attributes and not properties
  9359. // (excepting IE8 booleans)
  9360. support.attributes = assert(function( el ) {
  9361. el.className = "i";
  9362. return !el.getAttribute("className");
  9363. });
  9364. /* getElement(s)By*
  9365. ---------------------------------------------------------------------- */
  9366. // Check if getElementsByTagName("*") returns only elements
  9367. support.getElementsByTagName = assert(function( el ) {
  9368. el.appendChild( document.createComment("") );
  9369. return !el.getElementsByTagName("*").length;
  9370. });
  9371. // Support: IE<9
  9372. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9373. // Support: IE<10
  9374. // Check if getElementById returns elements by name
  9375. // The broken getElementById methods don't pick up programmatically-set names,
  9376. // so use a roundabout getElementsByName test
  9377. support.getById = assert(function( el ) {
  9378. docElem.appendChild( el ).id = expando;
  9379. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9380. });
  9381. // ID filter and find
  9382. if ( support.getById ) {
  9383. Expr.filter["ID"] = function( id ) {
  9384. var attrId = id.replace( runescape, funescape );
  9385. return function( elem ) {
  9386. return elem.getAttribute("id") === attrId;
  9387. };
  9388. };
  9389. Expr.find["ID"] = function( id, context ) {
  9390. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9391. var elem = context.getElementById( id );
  9392. return elem ? [ elem ] : [];
  9393. }
  9394. };
  9395. } else {
  9396. Expr.filter["ID"] = function( id ) {
  9397. var attrId = id.replace( runescape, funescape );
  9398. return function( elem ) {
  9399. var node = typeof elem.getAttributeNode !== "undefined" &&
  9400. elem.getAttributeNode("id");
  9401. return node && node.value === attrId;
  9402. };
  9403. };
  9404. // Support: IE 6 - 7 only
  9405. // getElementById is not reliable as a find shortcut
  9406. Expr.find["ID"] = function( id, context ) {
  9407. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9408. var node, i, elems,
  9409. elem = context.getElementById( id );
  9410. if ( elem ) {
  9411. // Verify the id attribute
  9412. node = elem.getAttributeNode("id");
  9413. if ( node && node.value === id ) {
  9414. return [ elem ];
  9415. }
  9416. // Fall back on getElementsByName
  9417. elems = context.getElementsByName( id );
  9418. i = 0;
  9419. while ( (elem = elems[i++]) ) {
  9420. node = elem.getAttributeNode("id");
  9421. if ( node && node.value === id ) {
  9422. return [ elem ];
  9423. }
  9424. }
  9425. }
  9426. return [];
  9427. }
  9428. };
  9429. }
  9430. // Tag
  9431. Expr.find["TAG"] = support.getElementsByTagName ?
  9432. function( tag, context ) {
  9433. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9434. return context.getElementsByTagName( tag );
  9435. // DocumentFragment nodes don't have gEBTN
  9436. } else if ( support.qsa ) {
  9437. return context.querySelectorAll( tag );
  9438. }
  9439. } :
  9440. function( tag, context ) {
  9441. var elem,
  9442. tmp = [],
  9443. i = 0,
  9444. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9445. results = context.getElementsByTagName( tag );
  9446. // Filter out possible comments
  9447. if ( tag === "*" ) {
  9448. while ( (elem = results[i++]) ) {
  9449. if ( elem.nodeType === 1 ) {
  9450. tmp.push( elem );
  9451. }
  9452. }
  9453. return tmp;
  9454. }
  9455. return results;
  9456. };
  9457. // Class
  9458. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9459. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9460. return context.getElementsByClassName( className );
  9461. }
  9462. };
  9463. /* QSA/matchesSelector
  9464. ---------------------------------------------------------------------- */
  9465. // QSA and matchesSelector support
  9466. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9467. rbuggyMatches = [];
  9468. // qSa(:focus) reports false when true (Chrome 21)
  9469. // We allow this because of a bug in IE8/9 that throws an error
  9470. // whenever `document.activeElement` is accessed on an iframe
  9471. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9472. // See https://bugs.jquery.com/ticket/13378
  9473. rbuggyQSA = [];
  9474. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9475. // Build QSA regex
  9476. // Regex strategy adopted from Diego Perini
  9477. assert(function( el ) {
  9478. // Select is set to empty string on purpose
  9479. // This is to test IE's treatment of not explicitly
  9480. // setting a boolean content attribute,
  9481. // since its presence should be enough
  9482. // https://bugs.jquery.com/ticket/12359
  9483. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9484. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9485. "<option selected=''></option></select>";
  9486. // Support: IE8, Opera 11-12.16
  9487. // Nothing should be selected when empty strings follow ^= or $= or *=
  9488. // The test attribute must be unknown in Opera but "safe" for WinRT
  9489. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9490. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9491. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9492. }
  9493. // Support: IE8
  9494. // Boolean attributes and "value" are not treated correctly
  9495. if ( !el.querySelectorAll("[selected]").length ) {
  9496. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9497. }
  9498. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9499. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9500. rbuggyQSA.push("~=");
  9501. }
  9502. // Webkit/Opera - :checked should return selected option elements
  9503. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9504. // IE8 throws error here and will not see later tests
  9505. if ( !el.querySelectorAll(":checked").length ) {
  9506. rbuggyQSA.push(":checked");
  9507. }
  9508. // Support: Safari 8+, iOS 8+
  9509. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9510. // In-page `selector#id sibling-combinator selector` fails
  9511. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9512. rbuggyQSA.push(".#.+[+~]");
  9513. }
  9514. });
  9515. assert(function( el ) {
  9516. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9517. "<select disabled='disabled'><option/></select>";
  9518. // Support: Windows 8 Native Apps
  9519. // The type and name attributes are restricted during .innerHTML assignment
  9520. var input = document.createElement("input");
  9521. input.setAttribute( "type", "hidden" );
  9522. el.appendChild( input ).setAttribute( "name", "D" );
  9523. // Support: IE8
  9524. // Enforce case-sensitivity of name attribute
  9525. if ( el.querySelectorAll("[name=d]").length ) {
  9526. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9527. }
  9528. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9529. // IE8 throws error here and will not see later tests
  9530. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9531. rbuggyQSA.push( ":enabled", ":disabled" );
  9532. }
  9533. // Support: IE9-11+
  9534. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9535. docElem.appendChild( el ).disabled = true;
  9536. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9537. rbuggyQSA.push( ":enabled", ":disabled" );
  9538. }
  9539. // Opera 10-11 does not throw on post-comma invalid pseudos
  9540. el.querySelectorAll("*,:x");
  9541. rbuggyQSA.push(",.*:");
  9542. });
  9543. }
  9544. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9545. docElem.webkitMatchesSelector ||
  9546. docElem.mozMatchesSelector ||
  9547. docElem.oMatchesSelector ||
  9548. docElem.msMatchesSelector) )) ) {
  9549. assert(function( el ) {
  9550. // Check to see if it's possible to do matchesSelector
  9551. // on a disconnected node (IE 9)
  9552. support.disconnectedMatch = matches.call( el, "*" );
  9553. // This should fail with an exception
  9554. // Gecko does not error, returns false instead
  9555. matches.call( el, "[s!='']:x" );
  9556. rbuggyMatches.push( "!=", pseudos );
  9557. });
  9558. }
  9559. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9560. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9561. /* Contains
  9562. ---------------------------------------------------------------------- */
  9563. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9564. // Element contains another
  9565. // Purposefully self-exclusive
  9566. // As in, an element does not contain itself
  9567. contains = hasCompare || rnative.test( docElem.contains ) ?
  9568. function( a, b ) {
  9569. var adown = a.nodeType === 9 ? a.documentElement : a,
  9570. bup = b && b.parentNode;
  9571. return a === bup || !!( bup && bup.nodeType === 1 && (
  9572. adown.contains ?
  9573. adown.contains( bup ) :
  9574. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9575. ));
  9576. } :
  9577. function( a, b ) {
  9578. if ( b ) {
  9579. while ( (b = b.parentNode) ) {
  9580. if ( b === a ) {
  9581. return true;
  9582. }
  9583. }
  9584. }
  9585. return false;
  9586. };
  9587. /* Sorting
  9588. ---------------------------------------------------------------------- */
  9589. // Document order sorting
  9590. sortOrder = hasCompare ?
  9591. function( a, b ) {
  9592. // Flag for duplicate removal
  9593. if ( a === b ) {
  9594. hasDuplicate = true;
  9595. return 0;
  9596. }
  9597. // Sort on method existence if only one input has compareDocumentPosition
  9598. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9599. if ( compare ) {
  9600. return compare;
  9601. }
  9602. // Calculate position if both inputs belong to the same document
  9603. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9604. a.compareDocumentPosition( b ) :
  9605. // Otherwise we know they are disconnected
  9606. 1;
  9607. // Disconnected nodes
  9608. if ( compare & 1 ||
  9609. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9610. // Choose the first element that is related to our preferred document
  9611. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9612. return -1;
  9613. }
  9614. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9615. return 1;
  9616. }
  9617. // Maintain original order
  9618. return sortInput ?
  9619. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9620. 0;
  9621. }
  9622. return compare & 4 ? -1 : 1;
  9623. } :
  9624. function( a, b ) {
  9625. // Exit early if the nodes are identical
  9626. if ( a === b ) {
  9627. hasDuplicate = true;
  9628. return 0;
  9629. }
  9630. var cur,
  9631. i = 0,
  9632. aup = a.parentNode,
  9633. bup = b.parentNode,
  9634. ap = [ a ],
  9635. bp = [ b ];
  9636. // Parentless nodes are either documents or disconnected
  9637. if ( !aup || !bup ) {
  9638. return a === document ? -1 :
  9639. b === document ? 1 :
  9640. aup ? -1 :
  9641. bup ? 1 :
  9642. sortInput ?
  9643. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9644. 0;
  9645. // If the nodes are siblings, we can do a quick check
  9646. } else if ( aup === bup ) {
  9647. return siblingCheck( a, b );
  9648. }
  9649. // Otherwise we need full lists of their ancestors for comparison
  9650. cur = a;
  9651. while ( (cur = cur.parentNode) ) {
  9652. ap.unshift( cur );
  9653. }
  9654. cur = b;
  9655. while ( (cur = cur.parentNode) ) {
  9656. bp.unshift( cur );
  9657. }
  9658. // Walk down the tree looking for a discrepancy
  9659. while ( ap[i] === bp[i] ) {
  9660. i++;
  9661. }
  9662. return i ?
  9663. // Do a sibling check if the nodes have a common ancestor
  9664. siblingCheck( ap[i], bp[i] ) :
  9665. // Otherwise nodes in our document sort first
  9666. ap[i] === preferredDoc ? -1 :
  9667. bp[i] === preferredDoc ? 1 :
  9668. 0;
  9669. };
  9670. return document;
  9671. };
  9672. Sizzle.matches = function( expr, elements ) {
  9673. return Sizzle( expr, null, null, elements );
  9674. };
  9675. Sizzle.matchesSelector = function( elem, expr ) {
  9676. // Set document vars if needed
  9677. if ( ( elem.ownerDocument || elem ) !== document ) {
  9678. setDocument( elem );
  9679. }
  9680. if ( support.matchesSelector && documentIsHTML &&
  9681. !nonnativeSelectorCache[ expr + " " ] &&
  9682. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9683. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9684. try {
  9685. var ret = matches.call( elem, expr );
  9686. // IE 9's matchesSelector returns false on disconnected nodes
  9687. if ( ret || support.disconnectedMatch ||
  9688. // As well, disconnected nodes are said to be in a document
  9689. // fragment in IE 9
  9690. elem.document && elem.document.nodeType !== 11 ) {
  9691. return ret;
  9692. }
  9693. } catch (e) {
  9694. nonnativeSelectorCache( expr, true );
  9695. }
  9696. }
  9697. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9698. };
  9699. Sizzle.contains = function( context, elem ) {
  9700. // Set document vars if needed
  9701. if ( ( context.ownerDocument || context ) !== document ) {
  9702. setDocument( context );
  9703. }
  9704. return contains( context, elem );
  9705. };
  9706. Sizzle.attr = function( elem, name ) {
  9707. // Set document vars if needed
  9708. if ( ( elem.ownerDocument || elem ) !== document ) {
  9709. setDocument( elem );
  9710. }
  9711. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9712. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9713. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9714. fn( elem, name, !documentIsHTML ) :
  9715. undefined;
  9716. return val !== undefined ?
  9717. val :
  9718. support.attributes || !documentIsHTML ?
  9719. elem.getAttribute( name ) :
  9720. (val = elem.getAttributeNode(name)) && val.specified ?
  9721. val.value :
  9722. null;
  9723. };
  9724. Sizzle.escape = function( sel ) {
  9725. return (sel + "").replace( rcssescape, fcssescape );
  9726. };
  9727. Sizzle.error = function( msg ) {
  9728. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9729. };
  9730. /**
  9731. * Document sorting and removing duplicates
  9732. * @param {ArrayLike} results
  9733. */
  9734. Sizzle.uniqueSort = function( results ) {
  9735. var elem,
  9736. duplicates = [],
  9737. j = 0,
  9738. i = 0;
  9739. // Unless we *know* we can detect duplicates, assume their presence
  9740. hasDuplicate = !support.detectDuplicates;
  9741. sortInput = !support.sortStable && results.slice( 0 );
  9742. results.sort( sortOrder );
  9743. if ( hasDuplicate ) {
  9744. while ( (elem = results[i++]) ) {
  9745. if ( elem === results[ i ] ) {
  9746. j = duplicates.push( i );
  9747. }
  9748. }
  9749. while ( j-- ) {
  9750. results.splice( duplicates[ j ], 1 );
  9751. }
  9752. }
  9753. // Clear input after sorting to release objects
  9754. // See https://github.com/jquery/sizzle/pull/225
  9755. sortInput = null;
  9756. return results;
  9757. };
  9758. /**
  9759. * Utility function for retrieving the text value of an array of DOM nodes
  9760. * @param {Array|Element} elem
  9761. */
  9762. getText = Sizzle.getText = function( elem ) {
  9763. var node,
  9764. ret = "",
  9765. i = 0,
  9766. nodeType = elem.nodeType;
  9767. if ( !nodeType ) {
  9768. // If no nodeType, this is expected to be an array
  9769. while ( (node = elem[i++]) ) {
  9770. // Do not traverse comment nodes
  9771. ret += getText( node );
  9772. }
  9773. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9774. // Use textContent for elements
  9775. // innerText usage removed for consistency of new lines (jQuery #11153)
  9776. if ( typeof elem.textContent === "string" ) {
  9777. return elem.textContent;
  9778. } else {
  9779. // Traverse its children
  9780. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9781. ret += getText( elem );
  9782. }
  9783. }
  9784. } else if ( nodeType === 3 || nodeType === 4 ) {
  9785. return elem.nodeValue;
  9786. }
  9787. // Do not include comment or processing instruction nodes
  9788. return ret;
  9789. };
  9790. Expr = Sizzle.selectors = {
  9791. // Can be adjusted by the user
  9792. cacheLength: 50,
  9793. createPseudo: markFunction,
  9794. match: matchExpr,
  9795. attrHandle: {},
  9796. find: {},
  9797. relative: {
  9798. ">": { dir: "parentNode", first: true },
  9799. " ": { dir: "parentNode" },
  9800. "+": { dir: "previousSibling", first: true },
  9801. "~": { dir: "previousSibling" }
  9802. },
  9803. preFilter: {
  9804. "ATTR": function( match ) {
  9805. match[1] = match[1].replace( runescape, funescape );
  9806. // Move the given value to match[3] whether quoted or unquoted
  9807. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9808. if ( match[2] === "~=" ) {
  9809. match[3] = " " + match[3] + " ";
  9810. }
  9811. return match.slice( 0, 4 );
  9812. },
  9813. "CHILD": function( match ) {
  9814. /* matches from matchExpr["CHILD"]
  9815. 1 type (only|nth|...)
  9816. 2 what (child|of-type)
  9817. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9818. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9819. 5 sign of xn-component
  9820. 6 x of xn-component
  9821. 7 sign of y-component
  9822. 8 y of y-component
  9823. */
  9824. match[1] = match[1].toLowerCase();
  9825. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9826. // nth-* requires argument
  9827. if ( !match[3] ) {
  9828. Sizzle.error( match[0] );
  9829. }
  9830. // numeric x and y parameters for Expr.filter.CHILD
  9831. // remember that false/true cast respectively to 0/1
  9832. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9833. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9834. // other types prohibit arguments
  9835. } else if ( match[3] ) {
  9836. Sizzle.error( match[0] );
  9837. }
  9838. return match;
  9839. },
  9840. "PSEUDO": function( match ) {
  9841. var excess,
  9842. unquoted = !match[6] && match[2];
  9843. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9844. return null;
  9845. }
  9846. // Accept quoted arguments as-is
  9847. if ( match[3] ) {
  9848. match[2] = match[4] || match[5] || "";
  9849. // Strip excess characters from unquoted arguments
  9850. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9851. // Get excess from tokenize (recursively)
  9852. (excess = tokenize( unquoted, true )) &&
  9853. // advance to the next closing parenthesis
  9854. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9855. // excess is a negative index
  9856. match[0] = match[0].slice( 0, excess );
  9857. match[2] = unquoted.slice( 0, excess );
  9858. }
  9859. // Return only captures needed by the pseudo filter method (type and argument)
  9860. return match.slice( 0, 3 );
  9861. }
  9862. },
  9863. filter: {
  9864. "TAG": function( nodeNameSelector ) {
  9865. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9866. return nodeNameSelector === "*" ?
  9867. function() { return true; } :
  9868. function( elem ) {
  9869. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9870. };
  9871. },
  9872. "CLASS": function( className ) {
  9873. var pattern = classCache[ className + " " ];
  9874. return pattern ||
  9875. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9876. classCache( className, function( elem ) {
  9877. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9878. });
  9879. },
  9880. "ATTR": function( name, operator, check ) {
  9881. return function( elem ) {
  9882. var result = Sizzle.attr( elem, name );
  9883. if ( result == null ) {
  9884. return operator === "!=";
  9885. }
  9886. if ( !operator ) {
  9887. return true;
  9888. }
  9889. result += "";
  9890. return operator === "=" ? result === check :
  9891. operator === "!=" ? result !== check :
  9892. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9893. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9894. operator === "$=" ? check && result.slice( -check.length ) === check :
  9895. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9896. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9897. false;
  9898. };
  9899. },
  9900. "CHILD": function( type, what, argument, first, last ) {
  9901. var simple = type.slice( 0, 3 ) !== "nth",
  9902. forward = type.slice( -4 ) !== "last",
  9903. ofType = what === "of-type";
  9904. return first === 1 && last === 0 ?
  9905. // Shortcut for :nth-*(n)
  9906. function( elem ) {
  9907. return !!elem.parentNode;
  9908. } :
  9909. function( elem, context, xml ) {
  9910. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  9911. dir = simple !== forward ? "nextSibling" : "previousSibling",
  9912. parent = elem.parentNode,
  9913. name = ofType && elem.nodeName.toLowerCase(),
  9914. useCache = !xml && !ofType,
  9915. diff = false;
  9916. if ( parent ) {
  9917. // :(first|last|only)-(child|of-type)
  9918. if ( simple ) {
  9919. while ( dir ) {
  9920. node = elem;
  9921. while ( (node = node[ dir ]) ) {
  9922. if ( ofType ?
  9923. node.nodeName.toLowerCase() === name :
  9924. node.nodeType === 1 ) {
  9925. return false;
  9926. }
  9927. }
  9928. // Reverse direction for :only-* (if we haven't yet done so)
  9929. start = dir = type === "only" && !start && "nextSibling";
  9930. }
  9931. return true;
  9932. }
  9933. start = [ forward ? parent.firstChild : parent.lastChild ];
  9934. // non-xml :nth-child(...) stores cache data on `parent`
  9935. if ( forward && useCache ) {
  9936. // Seek `elem` from a previously-cached index
  9937. // ...in a gzip-friendly way
  9938. node = parent;
  9939. outerCache = node[ expando ] || (node[ expando ] = {});
  9940. // Support: IE <9 only
  9941. // Defend against cloned attroperties (jQuery gh-1709)
  9942. uniqueCache = outerCache[ node.uniqueID ] ||
  9943. (outerCache[ node.uniqueID ] = {});
  9944. cache = uniqueCache[ type ] || [];
  9945. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9946. diff = nodeIndex && cache[ 2 ];
  9947. node = nodeIndex && parent.childNodes[ nodeIndex ];
  9948. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9949. // Fallback to seeking `elem` from the start
  9950. (diff = nodeIndex = 0) || start.pop()) ) {
  9951. // When found, cache indexes on `parent` and break
  9952. if ( node.nodeType === 1 && ++diff && node === elem ) {
  9953. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  9954. break;
  9955. }
  9956. }
  9957. } else {
  9958. // Use previously-cached element index if available
  9959. if ( useCache ) {
  9960. // ...in a gzip-friendly way
  9961. node = elem;
  9962. outerCache = node[ expando ] || (node[ expando ] = {});
  9963. // Support: IE <9 only
  9964. // Defend against cloned attroperties (jQuery gh-1709)
  9965. uniqueCache = outerCache[ node.uniqueID ] ||
  9966. (outerCache[ node.uniqueID ] = {});
  9967. cache = uniqueCache[ type ] || [];
  9968. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9969. diff = nodeIndex;
  9970. }
  9971. // xml :nth-child(...)
  9972. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  9973. if ( diff === false ) {
  9974. // Use the same loop as above to seek `elem` from the start
  9975. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9976. (diff = nodeIndex = 0) || start.pop()) ) {
  9977. if ( ( ofType ?
  9978. node.nodeName.toLowerCase() === name :
  9979. node.nodeType === 1 ) &&
  9980. ++diff ) {
  9981. // Cache the index of each encountered element
  9982. if ( useCache ) {
  9983. outerCache = node[ expando ] || (node[ expando ] = {});
  9984. // Support: IE <9 only
  9985. // Defend against cloned attroperties (jQuery gh-1709)
  9986. uniqueCache = outerCache[ node.uniqueID ] ||
  9987. (outerCache[ node.uniqueID ] = {});
  9988. uniqueCache[ type ] = [ dirruns, diff ];
  9989. }
  9990. if ( node === elem ) {
  9991. break;
  9992. }
  9993. }
  9994. }
  9995. }
  9996. }
  9997. // Incorporate the offset, then check against cycle size
  9998. diff -= last;
  9999. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10000. }
  10001. };
  10002. },
  10003. "PSEUDO": function( pseudo, argument ) {
  10004. // pseudo-class names are case-insensitive
  10005. // http://www.w3.org/TR/selectors/#pseudo-classes
  10006. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10007. // Remember that setFilters inherits from pseudos
  10008. var args,
  10009. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10010. Sizzle.error( "unsupported pseudo: " + pseudo );
  10011. // The user may use createPseudo to indicate that
  10012. // arguments are needed to create the filter function
  10013. // just as Sizzle does
  10014. if ( fn[ expando ] ) {
  10015. return fn( argument );
  10016. }
  10017. // But maintain support for old signatures
  10018. if ( fn.length > 1 ) {
  10019. args = [ pseudo, pseudo, "", argument ];
  10020. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10021. markFunction(function( seed, matches ) {
  10022. var idx,
  10023. matched = fn( seed, argument ),
  10024. i = matched.length;
  10025. while ( i-- ) {
  10026. idx = indexOf( seed, matched[i] );
  10027. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10028. }
  10029. }) :
  10030. function( elem ) {
  10031. return fn( elem, 0, args );
  10032. };
  10033. }
  10034. return fn;
  10035. }
  10036. },
  10037. pseudos: {
  10038. // Potentially complex pseudos
  10039. "not": markFunction(function( selector ) {
  10040. // Trim the selector passed to compile
  10041. // to avoid treating leading and trailing
  10042. // spaces as combinators
  10043. var input = [],
  10044. results = [],
  10045. matcher = compile( selector.replace( rtrim, "$1" ) );
  10046. return matcher[ expando ] ?
  10047. markFunction(function( seed, matches, context, xml ) {
  10048. var elem,
  10049. unmatched = matcher( seed, null, xml, [] ),
  10050. i = seed.length;
  10051. // Match elements unmatched by `matcher`
  10052. while ( i-- ) {
  10053. if ( (elem = unmatched[i]) ) {
  10054. seed[i] = !(matches[i] = elem);
  10055. }
  10056. }
  10057. }) :
  10058. function( elem, context, xml ) {
  10059. input[0] = elem;
  10060. matcher( input, null, xml, results );
  10061. // Don't keep the element (issue #299)
  10062. input[0] = null;
  10063. return !results.pop();
  10064. };
  10065. }),
  10066. "has": markFunction(function( selector ) {
  10067. return function( elem ) {
  10068. return Sizzle( selector, elem ).length > 0;
  10069. };
  10070. }),
  10071. "contains": markFunction(function( text ) {
  10072. text = text.replace( runescape, funescape );
  10073. return function( elem ) {
  10074. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10075. };
  10076. }),
  10077. // "Whether an element is represented by a :lang() selector
  10078. // is based solely on the element's language value
  10079. // being equal to the identifier C,
  10080. // or beginning with the identifier C immediately followed by "-".
  10081. // The matching of C against the element's language value is performed case-insensitively.
  10082. // The identifier C does not have to be a valid language name."
  10083. // http://www.w3.org/TR/selectors/#lang-pseudo
  10084. "lang": markFunction( function( lang ) {
  10085. // lang value must be a valid identifier
  10086. if ( !ridentifier.test(lang || "") ) {
  10087. Sizzle.error( "unsupported lang: " + lang );
  10088. }
  10089. lang = lang.replace( runescape, funescape ).toLowerCase();
  10090. return function( elem ) {
  10091. var elemLang;
  10092. do {
  10093. if ( (elemLang = documentIsHTML ?
  10094. elem.lang :
  10095. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10096. elemLang = elemLang.toLowerCase();
  10097. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10098. }
  10099. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10100. return false;
  10101. };
  10102. }),
  10103. // Miscellaneous
  10104. "target": function( elem ) {
  10105. var hash = window.location && window.location.hash;
  10106. return hash && hash.slice( 1 ) === elem.id;
  10107. },
  10108. "root": function( elem ) {
  10109. return elem === docElem;
  10110. },
  10111. "focus": function( elem ) {
  10112. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10113. },
  10114. // Boolean properties
  10115. "enabled": createDisabledPseudo( false ),
  10116. "disabled": createDisabledPseudo( true ),
  10117. "checked": function( elem ) {
  10118. // In CSS3, :checked should return both checked and selected elements
  10119. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10120. var nodeName = elem.nodeName.toLowerCase();
  10121. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10122. },
  10123. "selected": function( elem ) {
  10124. // Accessing this property makes selected-by-default
  10125. // options in Safari work properly
  10126. if ( elem.parentNode ) {
  10127. elem.parentNode.selectedIndex;
  10128. }
  10129. return elem.selected === true;
  10130. },
  10131. // Contents
  10132. "empty": function( elem ) {
  10133. // http://www.w3.org/TR/selectors/#empty-pseudo
  10134. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10135. // but not by others (comment: 8; processing instruction: 7; etc.)
  10136. // nodeType < 6 works because attributes (2) do not appear as children
  10137. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10138. if ( elem.nodeType < 6 ) {
  10139. return false;
  10140. }
  10141. }
  10142. return true;
  10143. },
  10144. "parent": function( elem ) {
  10145. return !Expr.pseudos["empty"]( elem );
  10146. },
  10147. // Element/input types
  10148. "header": function( elem ) {
  10149. return rheader.test( elem.nodeName );
  10150. },
  10151. "input": function( elem ) {
  10152. return rinputs.test( elem.nodeName );
  10153. },
  10154. "button": function( elem ) {
  10155. var name = elem.nodeName.toLowerCase();
  10156. return name === "input" && elem.type === "button" || name === "button";
  10157. },
  10158. "text": function( elem ) {
  10159. var attr;
  10160. return elem.nodeName.toLowerCase() === "input" &&
  10161. elem.type === "text" &&
  10162. // Support: IE<8
  10163. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10164. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10165. },
  10166. // Position-in-collection
  10167. "first": createPositionalPseudo(function() {
  10168. return [ 0 ];
  10169. }),
  10170. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10171. return [ length - 1 ];
  10172. }),
  10173. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10174. return [ argument < 0 ? argument + length : argument ];
  10175. }),
  10176. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10177. var i = 0;
  10178. for ( ; i < length; i += 2 ) {
  10179. matchIndexes.push( i );
  10180. }
  10181. return matchIndexes;
  10182. }),
  10183. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10184. var i = 1;
  10185. for ( ; i < length; i += 2 ) {
  10186. matchIndexes.push( i );
  10187. }
  10188. return matchIndexes;
  10189. }),
  10190. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10191. var i = argument < 0 ?
  10192. argument + length :
  10193. argument > length ?
  10194. length :
  10195. argument;
  10196. for ( ; --i >= 0; ) {
  10197. matchIndexes.push( i );
  10198. }
  10199. return matchIndexes;
  10200. }),
  10201. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10202. var i = argument < 0 ? argument + length : argument;
  10203. for ( ; ++i < length; ) {
  10204. matchIndexes.push( i );
  10205. }
  10206. return matchIndexes;
  10207. })
  10208. }
  10209. };
  10210. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10211. // Add button/input type pseudos
  10212. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10213. Expr.pseudos[ i ] = createInputPseudo( i );
  10214. }
  10215. for ( i in { submit: true, reset: true } ) {
  10216. Expr.pseudos[ i ] = createButtonPseudo( i );
  10217. }
  10218. // Easy API for creating new setFilters
  10219. function setFilters() {}
  10220. setFilters.prototype = Expr.filters = Expr.pseudos;
  10221. Expr.setFilters = new setFilters();
  10222. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10223. var matched, match, tokens, type,
  10224. soFar, groups, preFilters,
  10225. cached = tokenCache[ selector + " " ];
  10226. if ( cached ) {
  10227. return parseOnly ? 0 : cached.slice( 0 );
  10228. }
  10229. soFar = selector;
  10230. groups = [];
  10231. preFilters = Expr.preFilter;
  10232. while ( soFar ) {
  10233. // Comma and first run
  10234. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10235. if ( match ) {
  10236. // Don't consume trailing commas as valid
  10237. soFar = soFar.slice( match[0].length ) || soFar;
  10238. }
  10239. groups.push( (tokens = []) );
  10240. }
  10241. matched = false;
  10242. // Combinators
  10243. if ( (match = rcombinators.exec( soFar )) ) {
  10244. matched = match.shift();
  10245. tokens.push({
  10246. value: matched,
  10247. // Cast descendant combinators to space
  10248. type: match[0].replace( rtrim, " " )
  10249. });
  10250. soFar = soFar.slice( matched.length );
  10251. }
  10252. // Filters
  10253. for ( type in Expr.filter ) {
  10254. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10255. (match = preFilters[ type ]( match ))) ) {
  10256. matched = match.shift();
  10257. tokens.push({
  10258. value: matched,
  10259. type: type,
  10260. matches: match
  10261. });
  10262. soFar = soFar.slice( matched.length );
  10263. }
  10264. }
  10265. if ( !matched ) {
  10266. break;
  10267. }
  10268. }
  10269. // Return the length of the invalid excess
  10270. // if we're just parsing
  10271. // Otherwise, throw an error or return tokens
  10272. return parseOnly ?
  10273. soFar.length :
  10274. soFar ?
  10275. Sizzle.error( selector ) :
  10276. // Cache the tokens
  10277. tokenCache( selector, groups ).slice( 0 );
  10278. };
  10279. function toSelector( tokens ) {
  10280. var i = 0,
  10281. len = tokens.length,
  10282. selector = "";
  10283. for ( ; i < len; i++ ) {
  10284. selector += tokens[i].value;
  10285. }
  10286. return selector;
  10287. }
  10288. function addCombinator( matcher, combinator, base ) {
  10289. var dir = combinator.dir,
  10290. skip = combinator.next,
  10291. key = skip || dir,
  10292. checkNonElements = base && key === "parentNode",
  10293. doneName = done++;
  10294. return combinator.first ?
  10295. // Check against closest ancestor/preceding element
  10296. function( elem, context, xml ) {
  10297. while ( (elem = elem[ dir ]) ) {
  10298. if ( elem.nodeType === 1 || checkNonElements ) {
  10299. return matcher( elem, context, xml );
  10300. }
  10301. }
  10302. return false;
  10303. } :
  10304. // Check against all ancestor/preceding elements
  10305. function( elem, context, xml ) {
  10306. var oldCache, uniqueCache, outerCache,
  10307. newCache = [ dirruns, doneName ];
  10308. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10309. if ( xml ) {
  10310. while ( (elem = elem[ dir ]) ) {
  10311. if ( elem.nodeType === 1 || checkNonElements ) {
  10312. if ( matcher( elem, context, xml ) ) {
  10313. return true;
  10314. }
  10315. }
  10316. }
  10317. } else {
  10318. while ( (elem = elem[ dir ]) ) {
  10319. if ( elem.nodeType === 1 || checkNonElements ) {
  10320. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10321. // Support: IE <9 only
  10322. // Defend against cloned attroperties (jQuery gh-1709)
  10323. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10324. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10325. elem = elem[ dir ] || elem;
  10326. } else if ( (oldCache = uniqueCache[ key ]) &&
  10327. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10328. // Assign to newCache so results back-propagate to previous elements
  10329. return (newCache[ 2 ] = oldCache[ 2 ]);
  10330. } else {
  10331. // Reuse newcache so results back-propagate to previous elements
  10332. uniqueCache[ key ] = newCache;
  10333. // A match means we're done; a fail means we have to keep checking
  10334. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10335. return true;
  10336. }
  10337. }
  10338. }
  10339. }
  10340. }
  10341. return false;
  10342. };
  10343. }
  10344. function elementMatcher( matchers ) {
  10345. return matchers.length > 1 ?
  10346. function( elem, context, xml ) {
  10347. var i = matchers.length;
  10348. while ( i-- ) {
  10349. if ( !matchers[i]( elem, context, xml ) ) {
  10350. return false;
  10351. }
  10352. }
  10353. return true;
  10354. } :
  10355. matchers[0];
  10356. }
  10357. function multipleContexts( selector, contexts, results ) {
  10358. var i = 0,
  10359. len = contexts.length;
  10360. for ( ; i < len; i++ ) {
  10361. Sizzle( selector, contexts[i], results );
  10362. }
  10363. return results;
  10364. }
  10365. function condense( unmatched, map, filter, context, xml ) {
  10366. var elem,
  10367. newUnmatched = [],
  10368. i = 0,
  10369. len = unmatched.length,
  10370. mapped = map != null;
  10371. for ( ; i < len; i++ ) {
  10372. if ( (elem = unmatched[i]) ) {
  10373. if ( !filter || filter( elem, context, xml ) ) {
  10374. newUnmatched.push( elem );
  10375. if ( mapped ) {
  10376. map.push( i );
  10377. }
  10378. }
  10379. }
  10380. }
  10381. return newUnmatched;
  10382. }
  10383. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10384. if ( postFilter && !postFilter[ expando ] ) {
  10385. postFilter = setMatcher( postFilter );
  10386. }
  10387. if ( postFinder && !postFinder[ expando ] ) {
  10388. postFinder = setMatcher( postFinder, postSelector );
  10389. }
  10390. return markFunction(function( seed, results, context, xml ) {
  10391. var temp, i, elem,
  10392. preMap = [],
  10393. postMap = [],
  10394. preexisting = results.length,
  10395. // Get initial elements from seed or context
  10396. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10397. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10398. matcherIn = preFilter && ( seed || !selector ) ?
  10399. condense( elems, preMap, preFilter, context, xml ) :
  10400. elems,
  10401. matcherOut = matcher ?
  10402. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10403. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10404. // ...intermediate processing is necessary
  10405. [] :
  10406. // ...otherwise use results directly
  10407. results :
  10408. matcherIn;
  10409. // Find primary matches
  10410. if ( matcher ) {
  10411. matcher( matcherIn, matcherOut, context, xml );
  10412. }
  10413. // Apply postFilter
  10414. if ( postFilter ) {
  10415. temp = condense( matcherOut, postMap );
  10416. postFilter( temp, [], context, xml );
  10417. // Un-match failing elements by moving them back to matcherIn
  10418. i = temp.length;
  10419. while ( i-- ) {
  10420. if ( (elem = temp[i]) ) {
  10421. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10422. }
  10423. }
  10424. }
  10425. if ( seed ) {
  10426. if ( postFinder || preFilter ) {
  10427. if ( postFinder ) {
  10428. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10429. temp = [];
  10430. i = matcherOut.length;
  10431. while ( i-- ) {
  10432. if ( (elem = matcherOut[i]) ) {
  10433. // Restore matcherIn since elem is not yet a final match
  10434. temp.push( (matcherIn[i] = elem) );
  10435. }
  10436. }
  10437. postFinder( null, (matcherOut = []), temp, xml );
  10438. }
  10439. // Move matched elements from seed to results to keep them synchronized
  10440. i = matcherOut.length;
  10441. while ( i-- ) {
  10442. if ( (elem = matcherOut[i]) &&
  10443. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10444. seed[temp] = !(results[temp] = elem);
  10445. }
  10446. }
  10447. }
  10448. // Add elements to results, through postFinder if defined
  10449. } else {
  10450. matcherOut = condense(
  10451. matcherOut === results ?
  10452. matcherOut.splice( preexisting, matcherOut.length ) :
  10453. matcherOut
  10454. );
  10455. if ( postFinder ) {
  10456. postFinder( null, results, matcherOut, xml );
  10457. } else {
  10458. push.apply( results, matcherOut );
  10459. }
  10460. }
  10461. });
  10462. }
  10463. function matcherFromTokens( tokens ) {
  10464. var checkContext, matcher, j,
  10465. len = tokens.length,
  10466. leadingRelative = Expr.relative[ tokens[0].type ],
  10467. implicitRelative = leadingRelative || Expr.relative[" "],
  10468. i = leadingRelative ? 1 : 0,
  10469. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10470. matchContext = addCombinator( function( elem ) {
  10471. return elem === checkContext;
  10472. }, implicitRelative, true ),
  10473. matchAnyContext = addCombinator( function( elem ) {
  10474. return indexOf( checkContext, elem ) > -1;
  10475. }, implicitRelative, true ),
  10476. matchers = [ function( elem, context, xml ) {
  10477. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10478. (checkContext = context).nodeType ?
  10479. matchContext( elem, context, xml ) :
  10480. matchAnyContext( elem, context, xml ) );
  10481. // Avoid hanging onto element (issue #299)
  10482. checkContext = null;
  10483. return ret;
  10484. } ];
  10485. for ( ; i < len; i++ ) {
  10486. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10487. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10488. } else {
  10489. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10490. // Return special upon seeing a positional matcher
  10491. if ( matcher[ expando ] ) {
  10492. // Find the next relative operator (if any) for proper handling
  10493. j = ++i;
  10494. for ( ; j < len; j++ ) {
  10495. if ( Expr.relative[ tokens[j].type ] ) {
  10496. break;
  10497. }
  10498. }
  10499. return setMatcher(
  10500. i > 1 && elementMatcher( matchers ),
  10501. i > 1 && toSelector(
  10502. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10503. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10504. ).replace( rtrim, "$1" ),
  10505. matcher,
  10506. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10507. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10508. j < len && toSelector( tokens )
  10509. );
  10510. }
  10511. matchers.push( matcher );
  10512. }
  10513. }
  10514. return elementMatcher( matchers );
  10515. }
  10516. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10517. var bySet = setMatchers.length > 0,
  10518. byElement = elementMatchers.length > 0,
  10519. superMatcher = function( seed, context, xml, results, outermost ) {
  10520. var elem, j, matcher,
  10521. matchedCount = 0,
  10522. i = "0",
  10523. unmatched = seed && [],
  10524. setMatched = [],
  10525. contextBackup = outermostContext,
  10526. // We must always have either seed elements or outermost context
  10527. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10528. // Use integer dirruns iff this is the outermost matcher
  10529. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10530. len = elems.length;
  10531. if ( outermost ) {
  10532. outermostContext = context === document || context || outermost;
  10533. }
  10534. // Add elements passing elementMatchers directly to results
  10535. // Support: IE<9, Safari
  10536. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10537. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10538. if ( byElement && elem ) {
  10539. j = 0;
  10540. if ( !context && elem.ownerDocument !== document ) {
  10541. setDocument( elem );
  10542. xml = !documentIsHTML;
  10543. }
  10544. while ( (matcher = elementMatchers[j++]) ) {
  10545. if ( matcher( elem, context || document, xml) ) {
  10546. results.push( elem );
  10547. break;
  10548. }
  10549. }
  10550. if ( outermost ) {
  10551. dirruns = dirrunsUnique;
  10552. }
  10553. }
  10554. // Track unmatched elements for set filters
  10555. if ( bySet ) {
  10556. // They will have gone through all possible matchers
  10557. if ( (elem = !matcher && elem) ) {
  10558. matchedCount--;
  10559. }
  10560. // Lengthen the array for every element, matched or not
  10561. if ( seed ) {
  10562. unmatched.push( elem );
  10563. }
  10564. }
  10565. }
  10566. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10567. // makes the latter nonnegative.
  10568. matchedCount += i;
  10569. // Apply set filters to unmatched elements
  10570. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10571. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10572. // no element matchers and no seed.
  10573. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10574. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10575. // numerically zero.
  10576. if ( bySet && i !== matchedCount ) {
  10577. j = 0;
  10578. while ( (matcher = setMatchers[j++]) ) {
  10579. matcher( unmatched, setMatched, context, xml );
  10580. }
  10581. if ( seed ) {
  10582. // Reintegrate element matches to eliminate the need for sorting
  10583. if ( matchedCount > 0 ) {
  10584. while ( i-- ) {
  10585. if ( !(unmatched[i] || setMatched[i]) ) {
  10586. setMatched[i] = pop.call( results );
  10587. }
  10588. }
  10589. }
  10590. // Discard index placeholder values to get only actual matches
  10591. setMatched = condense( setMatched );
  10592. }
  10593. // Add matches to results
  10594. push.apply( results, setMatched );
  10595. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10596. if ( outermost && !seed && setMatched.length > 0 &&
  10597. ( matchedCount + setMatchers.length ) > 1 ) {
  10598. Sizzle.uniqueSort( results );
  10599. }
  10600. }
  10601. // Override manipulation of globals by nested matchers
  10602. if ( outermost ) {
  10603. dirruns = dirrunsUnique;
  10604. outermostContext = contextBackup;
  10605. }
  10606. return unmatched;
  10607. };
  10608. return bySet ?
  10609. markFunction( superMatcher ) :
  10610. superMatcher;
  10611. }
  10612. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10613. var i,
  10614. setMatchers = [],
  10615. elementMatchers = [],
  10616. cached = compilerCache[ selector + " " ];
  10617. if ( !cached ) {
  10618. // Generate a function of recursive functions that can be used to check each element
  10619. if ( !match ) {
  10620. match = tokenize( selector );
  10621. }
  10622. i = match.length;
  10623. while ( i-- ) {
  10624. cached = matcherFromTokens( match[i] );
  10625. if ( cached[ expando ] ) {
  10626. setMatchers.push( cached );
  10627. } else {
  10628. elementMatchers.push( cached );
  10629. }
  10630. }
  10631. // Cache the compiled function
  10632. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10633. // Save selector and tokenization
  10634. cached.selector = selector;
  10635. }
  10636. return cached;
  10637. };
  10638. /**
  10639. * A low-level selection function that works with Sizzle's compiled
  10640. * selector functions
  10641. * @param {String|Function} selector A selector or a pre-compiled
  10642. * selector function built with Sizzle.compile
  10643. * @param {Element} context
  10644. * @param {Array} [results]
  10645. * @param {Array} [seed] A set of elements to match against
  10646. */
  10647. select = Sizzle.select = function( selector, context, results, seed ) {
  10648. var i, tokens, token, type, find,
  10649. compiled = typeof selector === "function" && selector,
  10650. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10651. results = results || [];
  10652. // Try to minimize operations if there is only one selector in the list and no seed
  10653. // (the latter of which guarantees us context)
  10654. if ( match.length === 1 ) {
  10655. // Reduce context if the leading compound selector is an ID
  10656. tokens = match[0] = match[0].slice( 0 );
  10657. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10658. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10659. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10660. if ( !context ) {
  10661. return results;
  10662. // Precompiled matchers will still verify ancestry, so step up a level
  10663. } else if ( compiled ) {
  10664. context = context.parentNode;
  10665. }
  10666. selector = selector.slice( tokens.shift().value.length );
  10667. }
  10668. // Fetch a seed set for right-to-left matching
  10669. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10670. while ( i-- ) {
  10671. token = tokens[i];
  10672. // Abort if we hit a combinator
  10673. if ( Expr.relative[ (type = token.type) ] ) {
  10674. break;
  10675. }
  10676. if ( (find = Expr.find[ type ]) ) {
  10677. // Search, expanding context for leading sibling combinators
  10678. if ( (seed = find(
  10679. token.matches[0].replace( runescape, funescape ),
  10680. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10681. )) ) {
  10682. // If seed is empty or no tokens remain, we can return early
  10683. tokens.splice( i, 1 );
  10684. selector = seed.length && toSelector( tokens );
  10685. if ( !selector ) {
  10686. push.apply( results, seed );
  10687. return results;
  10688. }
  10689. break;
  10690. }
  10691. }
  10692. }
  10693. }
  10694. // Compile and execute a filtering function if one is not provided
  10695. // Provide `match` to avoid retokenization if we modified the selector above
  10696. ( compiled || compile( selector, match ) )(
  10697. seed,
  10698. context,
  10699. !documentIsHTML,
  10700. results,
  10701. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10702. );
  10703. return results;
  10704. };
  10705. // One-time assignments
  10706. // Sort stability
  10707. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10708. // Support: Chrome 14-35+
  10709. // Always assume duplicates if they aren't passed to the comparison function
  10710. support.detectDuplicates = !!hasDuplicate;
  10711. // Initialize against the default document
  10712. setDocument();
  10713. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10714. // Detached nodes confoundingly follow *each other*
  10715. support.sortDetached = assert(function( el ) {
  10716. // Should return 1, but returns 4 (following)
  10717. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10718. });
  10719. // Support: IE<8
  10720. // Prevent attribute/property "interpolation"
  10721. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10722. if ( !assert(function( el ) {
  10723. el.innerHTML = "<a href='#'></a>";
  10724. return el.firstChild.getAttribute("href") === "#" ;
  10725. }) ) {
  10726. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10727. if ( !isXML ) {
  10728. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10729. }
  10730. });
  10731. }
  10732. // Support: IE<9
  10733. // Use defaultValue in place of getAttribute("value")
  10734. if ( !support.attributes || !assert(function( el ) {
  10735. el.innerHTML = "<input/>";
  10736. el.firstChild.setAttribute( "value", "" );
  10737. return el.firstChild.getAttribute( "value" ) === "";
  10738. }) ) {
  10739. addHandle( "value", function( elem, name, isXML ) {
  10740. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10741. return elem.defaultValue;
  10742. }
  10743. });
  10744. }
  10745. // Support: IE<9
  10746. // Use getAttributeNode to fetch booleans when getAttribute lies
  10747. if ( !assert(function( el ) {
  10748. return el.getAttribute("disabled") == null;
  10749. }) ) {
  10750. addHandle( booleans, function( elem, name, isXML ) {
  10751. var val;
  10752. if ( !isXML ) {
  10753. return elem[ name ] === true ? name.toLowerCase() :
  10754. (val = elem.getAttributeNode( name )) && val.specified ?
  10755. val.value :
  10756. null;
  10757. }
  10758. });
  10759. }
  10760. return Sizzle;
  10761. })( window );
  10762. jQuery.find = Sizzle;
  10763. jQuery.expr = Sizzle.selectors;
  10764. // Deprecated
  10765. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10766. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10767. jQuery.text = Sizzle.getText;
  10768. jQuery.isXMLDoc = Sizzle.isXML;
  10769. jQuery.contains = Sizzle.contains;
  10770. jQuery.escapeSelector = Sizzle.escape;
  10771. var dir = function( elem, dir, until ) {
  10772. var matched = [],
  10773. truncate = until !== undefined;
  10774. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10775. if ( elem.nodeType === 1 ) {
  10776. if ( truncate && jQuery( elem ).is( until ) ) {
  10777. break;
  10778. }
  10779. matched.push( elem );
  10780. }
  10781. }
  10782. return matched;
  10783. };
  10784. var siblings = function( n, elem ) {
  10785. var matched = [];
  10786. for ( ; n; n = n.nextSibling ) {
  10787. if ( n.nodeType === 1 && n !== elem ) {
  10788. matched.push( n );
  10789. }
  10790. }
  10791. return matched;
  10792. };
  10793. var rneedsContext = jQuery.expr.match.needsContext;
  10794. function nodeName( elem, name ) {
  10795. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10796. };
  10797. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10798. // Implement the identical functionality for filter and not
  10799. function winnow( elements, qualifier, not ) {
  10800. if ( isFunction( qualifier ) ) {
  10801. return jQuery.grep( elements, function( elem, i ) {
  10802. return !!qualifier.call( elem, i, elem ) !== not;
  10803. } );
  10804. }
  10805. // Single element
  10806. if ( qualifier.nodeType ) {
  10807. return jQuery.grep( elements, function( elem ) {
  10808. return ( elem === qualifier ) !== not;
  10809. } );
  10810. }
  10811. // Arraylike of elements (jQuery, arguments, Array)
  10812. if ( typeof qualifier !== "string" ) {
  10813. return jQuery.grep( elements, function( elem ) {
  10814. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10815. } );
  10816. }
  10817. // Filtered directly for both simple and complex selectors
  10818. return jQuery.filter( qualifier, elements, not );
  10819. }
  10820. jQuery.filter = function( expr, elems, not ) {
  10821. var elem = elems[ 0 ];
  10822. if ( not ) {
  10823. expr = ":not(" + expr + ")";
  10824. }
  10825. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10826. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10827. }
  10828. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10829. return elem.nodeType === 1;
  10830. } ) );
  10831. };
  10832. jQuery.fn.extend( {
  10833. find: function( selector ) {
  10834. var i, ret,
  10835. len = this.length,
  10836. self = this;
  10837. if ( typeof selector !== "string" ) {
  10838. return this.pushStack( jQuery( selector ).filter( function() {
  10839. for ( i = 0; i < len; i++ ) {
  10840. if ( jQuery.contains( self[ i ], this ) ) {
  10841. return true;
  10842. }
  10843. }
  10844. } ) );
  10845. }
  10846. ret = this.pushStack( [] );
  10847. for ( i = 0; i < len; i++ ) {
  10848. jQuery.find( selector, self[ i ], ret );
  10849. }
  10850. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10851. },
  10852. filter: function( selector ) {
  10853. return this.pushStack( winnow( this, selector || [], false ) );
  10854. },
  10855. not: function( selector ) {
  10856. return this.pushStack( winnow( this, selector || [], true ) );
  10857. },
  10858. is: function( selector ) {
  10859. return !!winnow(
  10860. this,
  10861. // If this is a positional/relative selector, check membership in the returned set
  10862. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10863. typeof selector === "string" && rneedsContext.test( selector ) ?
  10864. jQuery( selector ) :
  10865. selector || [],
  10866. false
  10867. ).length;
  10868. }
  10869. } );
  10870. // Initialize a jQuery object
  10871. // A central reference to the root jQuery(document)
  10872. var rootjQuery,
  10873. // A simple way to check for HTML strings
  10874. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10875. // Strict HTML recognition (#11290: must start with <)
  10876. // Shortcut simple #id case for speed
  10877. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10878. init = jQuery.fn.init = function( selector, context, root ) {
  10879. var match, elem;
  10880. // HANDLE: $(""), $(null), $(undefined), $(false)
  10881. if ( !selector ) {
  10882. return this;
  10883. }
  10884. // Method init() accepts an alternate rootjQuery
  10885. // so migrate can support jQuery.sub (gh-2101)
  10886. root = root || rootjQuery;
  10887. // Handle HTML strings
  10888. if ( typeof selector === "string" ) {
  10889. if ( selector[ 0 ] === "<" &&
  10890. selector[ selector.length - 1 ] === ">" &&
  10891. selector.length >= 3 ) {
  10892. // Assume that strings that start and end with <> are HTML and skip the regex check
  10893. match = [ null, selector, null ];
  10894. } else {
  10895. match = rquickExpr.exec( selector );
  10896. }
  10897. // Match html or make sure no context is specified for #id
  10898. if ( match && ( match[ 1 ] || !context ) ) {
  10899. // HANDLE: $(html) -> $(array)
  10900. if ( match[ 1 ] ) {
  10901. context = context instanceof jQuery ? context[ 0 ] : context;
  10902. // Option to run scripts is true for back-compat
  10903. // Intentionally let the error be thrown if parseHTML is not present
  10904. jQuery.merge( this, jQuery.parseHTML(
  10905. match[ 1 ],
  10906. context && context.nodeType ? context.ownerDocument || context : document,
  10907. true
  10908. ) );
  10909. // HANDLE: $(html, props)
  10910. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  10911. for ( match in context ) {
  10912. // Properties of context are called as methods if possible
  10913. if ( isFunction( this[ match ] ) ) {
  10914. this[ match ]( context[ match ] );
  10915. // ...and otherwise set as attributes
  10916. } else {
  10917. this.attr( match, context[ match ] );
  10918. }
  10919. }
  10920. }
  10921. return this;
  10922. // HANDLE: $(#id)
  10923. } else {
  10924. elem = document.getElementById( match[ 2 ] );
  10925. if ( elem ) {
  10926. // Inject the element directly into the jQuery object
  10927. this[ 0 ] = elem;
  10928. this.length = 1;
  10929. }
  10930. return this;
  10931. }
  10932. // HANDLE: $(expr, $(...))
  10933. } else if ( !context || context.jquery ) {
  10934. return ( context || root ).find( selector );
  10935. // HANDLE: $(expr, context)
  10936. // (which is just equivalent to: $(context).find(expr)
  10937. } else {
  10938. return this.constructor( context ).find( selector );
  10939. }
  10940. // HANDLE: $(DOMElement)
  10941. } else if ( selector.nodeType ) {
  10942. this[ 0 ] = selector;
  10943. this.length = 1;
  10944. return this;
  10945. // HANDLE: $(function)
  10946. // Shortcut for document ready
  10947. } else if ( isFunction( selector ) ) {
  10948. return root.ready !== undefined ?
  10949. root.ready( selector ) :
  10950. // Execute immediately if ready is not present
  10951. selector( jQuery );
  10952. }
  10953. return jQuery.makeArray( selector, this );
  10954. };
  10955. // Give the init function the jQuery prototype for later instantiation
  10956. init.prototype = jQuery.fn;
  10957. // Initialize central reference
  10958. rootjQuery = jQuery( document );
  10959. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  10960. // Methods guaranteed to produce a unique set when starting from a unique set
  10961. guaranteedUnique = {
  10962. children: true,
  10963. contents: true,
  10964. next: true,
  10965. prev: true
  10966. };
  10967. jQuery.fn.extend( {
  10968. has: function( target ) {
  10969. var targets = jQuery( target, this ),
  10970. l = targets.length;
  10971. return this.filter( function() {
  10972. var i = 0;
  10973. for ( ; i < l; i++ ) {
  10974. if ( jQuery.contains( this, targets[ i ] ) ) {
  10975. return true;
  10976. }
  10977. }
  10978. } );
  10979. },
  10980. closest: function( selectors, context ) {
  10981. var cur,
  10982. i = 0,
  10983. l = this.length,
  10984. matched = [],
  10985. targets = typeof selectors !== "string" && jQuery( selectors );
  10986. // Positional selectors never match, since there's no _selection_ context
  10987. if ( !rneedsContext.test( selectors ) ) {
  10988. for ( ; i < l; i++ ) {
  10989. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  10990. // Always skip document fragments
  10991. if ( cur.nodeType < 11 && ( targets ?
  10992. targets.index( cur ) > -1 :
  10993. // Don't pass non-elements to Sizzle
  10994. cur.nodeType === 1 &&
  10995. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  10996. matched.push( cur );
  10997. break;
  10998. }
  10999. }
  11000. }
  11001. }
  11002. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11003. },
  11004. // Determine the position of an element within the set
  11005. index: function( elem ) {
  11006. // No argument, return index in parent
  11007. if ( !elem ) {
  11008. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11009. }
  11010. // Index in selector
  11011. if ( typeof elem === "string" ) {
  11012. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11013. }
  11014. // Locate the position of the desired element
  11015. return indexOf.call( this,
  11016. // If it receives a jQuery object, the first element is used
  11017. elem.jquery ? elem[ 0 ] : elem
  11018. );
  11019. },
  11020. add: function( selector, context ) {
  11021. return this.pushStack(
  11022. jQuery.uniqueSort(
  11023. jQuery.merge( this.get(), jQuery( selector, context ) )
  11024. )
  11025. );
  11026. },
  11027. addBack: function( selector ) {
  11028. return this.add( selector == null ?
  11029. this.prevObject : this.prevObject.filter( selector )
  11030. );
  11031. }
  11032. } );
  11033. function sibling( cur, dir ) {
  11034. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11035. return cur;
  11036. }
  11037. jQuery.each( {
  11038. parent: function( elem ) {
  11039. var parent = elem.parentNode;
  11040. return parent && parent.nodeType !== 11 ? parent : null;
  11041. },
  11042. parents: function( elem ) {
  11043. return dir( elem, "parentNode" );
  11044. },
  11045. parentsUntil: function( elem, i, until ) {
  11046. return dir( elem, "parentNode", until );
  11047. },
  11048. next: function( elem ) {
  11049. return sibling( elem, "nextSibling" );
  11050. },
  11051. prev: function( elem ) {
  11052. return sibling( elem, "previousSibling" );
  11053. },
  11054. nextAll: function( elem ) {
  11055. return dir( elem, "nextSibling" );
  11056. },
  11057. prevAll: function( elem ) {
  11058. return dir( elem, "previousSibling" );
  11059. },
  11060. nextUntil: function( elem, i, until ) {
  11061. return dir( elem, "nextSibling", until );
  11062. },
  11063. prevUntil: function( elem, i, until ) {
  11064. return dir( elem, "previousSibling", until );
  11065. },
  11066. siblings: function( elem ) {
  11067. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11068. },
  11069. children: function( elem ) {
  11070. return siblings( elem.firstChild );
  11071. },
  11072. contents: function( elem ) {
  11073. if ( typeof elem.contentDocument !== "undefined" ) {
  11074. return elem.contentDocument;
  11075. }
  11076. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11077. // Treat the template element as a regular one in browsers that
  11078. // don't support it.
  11079. if ( nodeName( elem, "template" ) ) {
  11080. elem = elem.content || elem;
  11081. }
  11082. return jQuery.merge( [], elem.childNodes );
  11083. }
  11084. }, function( name, fn ) {
  11085. jQuery.fn[ name ] = function( until, selector ) {
  11086. var matched = jQuery.map( this, fn, until );
  11087. if ( name.slice( -5 ) !== "Until" ) {
  11088. selector = until;
  11089. }
  11090. if ( selector && typeof selector === "string" ) {
  11091. matched = jQuery.filter( selector, matched );
  11092. }
  11093. if ( this.length > 1 ) {
  11094. // Remove duplicates
  11095. if ( !guaranteedUnique[ name ] ) {
  11096. jQuery.uniqueSort( matched );
  11097. }
  11098. // Reverse order for parents* and prev-derivatives
  11099. if ( rparentsprev.test( name ) ) {
  11100. matched.reverse();
  11101. }
  11102. }
  11103. return this.pushStack( matched );
  11104. };
  11105. } );
  11106. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11107. // Convert String-formatted options into Object-formatted ones
  11108. function createOptions( options ) {
  11109. var object = {};
  11110. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11111. object[ flag ] = true;
  11112. } );
  11113. return object;
  11114. }
  11115. /*
  11116. * Create a callback list using the following parameters:
  11117. *
  11118. * options: an optional list of space-separated options that will change how
  11119. * the callback list behaves or a more traditional option object
  11120. *
  11121. * By default a callback list will act like an event callback list and can be
  11122. * "fired" multiple times.
  11123. *
  11124. * Possible options:
  11125. *
  11126. * once: will ensure the callback list can only be fired once (like a Deferred)
  11127. *
  11128. * memory: will keep track of previous values and will call any callback added
  11129. * after the list has been fired right away with the latest "memorized"
  11130. * values (like a Deferred)
  11131. *
  11132. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11133. *
  11134. * stopOnFalse: interrupt callings when a callback returns false
  11135. *
  11136. */
  11137. jQuery.Callbacks = function( options ) {
  11138. // Convert options from String-formatted to Object-formatted if needed
  11139. // (we check in cache first)
  11140. options = typeof options === "string" ?
  11141. createOptions( options ) :
  11142. jQuery.extend( {}, options );
  11143. var // Flag to know if list is currently firing
  11144. firing,
  11145. // Last fire value for non-forgettable lists
  11146. memory,
  11147. // Flag to know if list was already fired
  11148. fired,
  11149. // Flag to prevent firing
  11150. locked,
  11151. // Actual callback list
  11152. list = [],
  11153. // Queue of execution data for repeatable lists
  11154. queue = [],
  11155. // Index of currently firing callback (modified by add/remove as needed)
  11156. firingIndex = -1,
  11157. // Fire callbacks
  11158. fire = function() {
  11159. // Enforce single-firing
  11160. locked = locked || options.once;
  11161. // Execute callbacks for all pending executions,
  11162. // respecting firingIndex overrides and runtime changes
  11163. fired = firing = true;
  11164. for ( ; queue.length; firingIndex = -1 ) {
  11165. memory = queue.shift();
  11166. while ( ++firingIndex < list.length ) {
  11167. // Run callback and check for early termination
  11168. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11169. options.stopOnFalse ) {
  11170. // Jump to end and forget the data so .add doesn't re-fire
  11171. firingIndex = list.length;
  11172. memory = false;
  11173. }
  11174. }
  11175. }
  11176. // Forget the data if we're done with it
  11177. if ( !options.memory ) {
  11178. memory = false;
  11179. }
  11180. firing = false;
  11181. // Clean up if we're done firing for good
  11182. if ( locked ) {
  11183. // Keep an empty list if we have data for future add calls
  11184. if ( memory ) {
  11185. list = [];
  11186. // Otherwise, this object is spent
  11187. } else {
  11188. list = "";
  11189. }
  11190. }
  11191. },
  11192. // Actual Callbacks object
  11193. self = {
  11194. // Add a callback or a collection of callbacks to the list
  11195. add: function() {
  11196. if ( list ) {
  11197. // If we have memory from a past run, we should fire after adding
  11198. if ( memory && !firing ) {
  11199. firingIndex = list.length - 1;
  11200. queue.push( memory );
  11201. }
  11202. ( function add( args ) {
  11203. jQuery.each( args, function( _, arg ) {
  11204. if ( isFunction( arg ) ) {
  11205. if ( !options.unique || !self.has( arg ) ) {
  11206. list.push( arg );
  11207. }
  11208. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11209. // Inspect recursively
  11210. add( arg );
  11211. }
  11212. } );
  11213. } )( arguments );
  11214. if ( memory && !firing ) {
  11215. fire();
  11216. }
  11217. }
  11218. return this;
  11219. },
  11220. // Remove a callback from the list
  11221. remove: function() {
  11222. jQuery.each( arguments, function( _, arg ) {
  11223. var index;
  11224. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11225. list.splice( index, 1 );
  11226. // Handle firing indexes
  11227. if ( index <= firingIndex ) {
  11228. firingIndex--;
  11229. }
  11230. }
  11231. } );
  11232. return this;
  11233. },
  11234. // Check if a given callback is in the list.
  11235. // If no argument is given, return whether or not list has callbacks attached.
  11236. has: function( fn ) {
  11237. return fn ?
  11238. jQuery.inArray( fn, list ) > -1 :
  11239. list.length > 0;
  11240. },
  11241. // Remove all callbacks from the list
  11242. empty: function() {
  11243. if ( list ) {
  11244. list = [];
  11245. }
  11246. return this;
  11247. },
  11248. // Disable .fire and .add
  11249. // Abort any current/pending executions
  11250. // Clear all callbacks and values
  11251. disable: function() {
  11252. locked = queue = [];
  11253. list = memory = "";
  11254. return this;
  11255. },
  11256. disabled: function() {
  11257. return !list;
  11258. },
  11259. // Disable .fire
  11260. // Also disable .add unless we have memory (since it would have no effect)
  11261. // Abort any pending executions
  11262. lock: function() {
  11263. locked = queue = [];
  11264. if ( !memory && !firing ) {
  11265. list = memory = "";
  11266. }
  11267. return this;
  11268. },
  11269. locked: function() {
  11270. return !!locked;
  11271. },
  11272. // Call all callbacks with the given context and arguments
  11273. fireWith: function( context, args ) {
  11274. if ( !locked ) {
  11275. args = args || [];
  11276. args = [ context, args.slice ? args.slice() : args ];
  11277. queue.push( args );
  11278. if ( !firing ) {
  11279. fire();
  11280. }
  11281. }
  11282. return this;
  11283. },
  11284. // Call all the callbacks with the given arguments
  11285. fire: function() {
  11286. self.fireWith( this, arguments );
  11287. return this;
  11288. },
  11289. // To know if the callbacks have already been called at least once
  11290. fired: function() {
  11291. return !!fired;
  11292. }
  11293. };
  11294. return self;
  11295. };
  11296. function Identity( v ) {
  11297. return v;
  11298. }
  11299. function Thrower( ex ) {
  11300. throw ex;
  11301. }
  11302. function adoptValue( value, resolve, reject, noValue ) {
  11303. var method;
  11304. try {
  11305. // Check for promise aspect first to privilege synchronous behavior
  11306. if ( value && isFunction( ( method = value.promise ) ) ) {
  11307. method.call( value ).done( resolve ).fail( reject );
  11308. // Other thenables
  11309. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11310. method.call( value, resolve, reject );
  11311. // Other non-thenables
  11312. } else {
  11313. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11314. // * false: [ value ].slice( 0 ) => resolve( value )
  11315. // * true: [ value ].slice( 1 ) => resolve()
  11316. resolve.apply( undefined, [ value ].slice( noValue ) );
  11317. }
  11318. // For Promises/A+, convert exceptions into rejections
  11319. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11320. // Deferred#then to conditionally suppress rejection.
  11321. } catch ( value ) {
  11322. // Support: Android 4.0 only
  11323. // Strict mode functions invoked without .call/.apply get global-object context
  11324. reject.apply( undefined, [ value ] );
  11325. }
  11326. }
  11327. jQuery.extend( {
  11328. Deferred: function( func ) {
  11329. var tuples = [
  11330. // action, add listener, callbacks,
  11331. // ... .then handlers, argument index, [final state]
  11332. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11333. jQuery.Callbacks( "memory" ), 2 ],
  11334. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11335. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11336. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11337. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11338. ],
  11339. state = "pending",
  11340. promise = {
  11341. state: function() {
  11342. return state;
  11343. },
  11344. always: function() {
  11345. deferred.done( arguments ).fail( arguments );
  11346. return this;
  11347. },
  11348. "catch": function( fn ) {
  11349. return promise.then( null, fn );
  11350. },
  11351. // Keep pipe for back-compat
  11352. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11353. var fns = arguments;
  11354. return jQuery.Deferred( function( newDefer ) {
  11355. jQuery.each( tuples, function( i, tuple ) {
  11356. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11357. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11358. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11359. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11360. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11361. deferred[ tuple[ 1 ] ]( function() {
  11362. var returned = fn && fn.apply( this, arguments );
  11363. if ( returned && isFunction( returned.promise ) ) {
  11364. returned.promise()
  11365. .progress( newDefer.notify )
  11366. .done( newDefer.resolve )
  11367. .fail( newDefer.reject );
  11368. } else {
  11369. newDefer[ tuple[ 0 ] + "With" ](
  11370. this,
  11371. fn ? [ returned ] : arguments
  11372. );
  11373. }
  11374. } );
  11375. } );
  11376. fns = null;
  11377. } ).promise();
  11378. },
  11379. then: function( onFulfilled, onRejected, onProgress ) {
  11380. var maxDepth = 0;
  11381. function resolve( depth, deferred, handler, special ) {
  11382. return function() {
  11383. var that = this,
  11384. args = arguments,
  11385. mightThrow = function() {
  11386. var returned, then;
  11387. // Support: Promises/A+ section 2.3.3.3.3
  11388. // https://promisesaplus.com/#point-59
  11389. // Ignore double-resolution attempts
  11390. if ( depth < maxDepth ) {
  11391. return;
  11392. }
  11393. returned = handler.apply( that, args );
  11394. // Support: Promises/A+ section 2.3.1
  11395. // https://promisesaplus.com/#point-48
  11396. if ( returned === deferred.promise() ) {
  11397. throw new TypeError( "Thenable self-resolution" );
  11398. }
  11399. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11400. // https://promisesaplus.com/#point-54
  11401. // https://promisesaplus.com/#point-75
  11402. // Retrieve `then` only once
  11403. then = returned &&
  11404. // Support: Promises/A+ section 2.3.4
  11405. // https://promisesaplus.com/#point-64
  11406. // Only check objects and functions for thenability
  11407. ( typeof returned === "object" ||
  11408. typeof returned === "function" ) &&
  11409. returned.then;
  11410. // Handle a returned thenable
  11411. if ( isFunction( then ) ) {
  11412. // Special processors (notify) just wait for resolution
  11413. if ( special ) {
  11414. then.call(
  11415. returned,
  11416. resolve( maxDepth, deferred, Identity, special ),
  11417. resolve( maxDepth, deferred, Thrower, special )
  11418. );
  11419. // Normal processors (resolve) also hook into progress
  11420. } else {
  11421. // ...and disregard older resolution values
  11422. maxDepth++;
  11423. then.call(
  11424. returned,
  11425. resolve( maxDepth, deferred, Identity, special ),
  11426. resolve( maxDepth, deferred, Thrower, special ),
  11427. resolve( maxDepth, deferred, Identity,
  11428. deferred.notifyWith )
  11429. );
  11430. }
  11431. // Handle all other returned values
  11432. } else {
  11433. // Only substitute handlers pass on context
  11434. // and multiple values (non-spec behavior)
  11435. if ( handler !== Identity ) {
  11436. that = undefined;
  11437. args = [ returned ];
  11438. }
  11439. // Process the value(s)
  11440. // Default process is resolve
  11441. ( special || deferred.resolveWith )( that, args );
  11442. }
  11443. },
  11444. // Only normal processors (resolve) catch and reject exceptions
  11445. process = special ?
  11446. mightThrow :
  11447. function() {
  11448. try {
  11449. mightThrow();
  11450. } catch ( e ) {
  11451. if ( jQuery.Deferred.exceptionHook ) {
  11452. jQuery.Deferred.exceptionHook( e,
  11453. process.stackTrace );
  11454. }
  11455. // Support: Promises/A+ section 2.3.3.3.4.1
  11456. // https://promisesaplus.com/#point-61
  11457. // Ignore post-resolution exceptions
  11458. if ( depth + 1 >= maxDepth ) {
  11459. // Only substitute handlers pass on context
  11460. // and multiple values (non-spec behavior)
  11461. if ( handler !== Thrower ) {
  11462. that = undefined;
  11463. args = [ e ];
  11464. }
  11465. deferred.rejectWith( that, args );
  11466. }
  11467. }
  11468. };
  11469. // Support: Promises/A+ section 2.3.3.3.1
  11470. // https://promisesaplus.com/#point-57
  11471. // Re-resolve promises immediately to dodge false rejection from
  11472. // subsequent errors
  11473. if ( depth ) {
  11474. process();
  11475. } else {
  11476. // Call an optional hook to record the stack, in case of exception
  11477. // since it's otherwise lost when execution goes async
  11478. if ( jQuery.Deferred.getStackHook ) {
  11479. process.stackTrace = jQuery.Deferred.getStackHook();
  11480. }
  11481. window.setTimeout( process );
  11482. }
  11483. };
  11484. }
  11485. return jQuery.Deferred( function( newDefer ) {
  11486. // progress_handlers.add( ... )
  11487. tuples[ 0 ][ 3 ].add(
  11488. resolve(
  11489. 0,
  11490. newDefer,
  11491. isFunction( onProgress ) ?
  11492. onProgress :
  11493. Identity,
  11494. newDefer.notifyWith
  11495. )
  11496. );
  11497. // fulfilled_handlers.add( ... )
  11498. tuples[ 1 ][ 3 ].add(
  11499. resolve(
  11500. 0,
  11501. newDefer,
  11502. isFunction( onFulfilled ) ?
  11503. onFulfilled :
  11504. Identity
  11505. )
  11506. );
  11507. // rejected_handlers.add( ... )
  11508. tuples[ 2 ][ 3 ].add(
  11509. resolve(
  11510. 0,
  11511. newDefer,
  11512. isFunction( onRejected ) ?
  11513. onRejected :
  11514. Thrower
  11515. )
  11516. );
  11517. } ).promise();
  11518. },
  11519. // Get a promise for this deferred
  11520. // If obj is provided, the promise aspect is added to the object
  11521. promise: function( obj ) {
  11522. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11523. }
  11524. },
  11525. deferred = {};
  11526. // Add list-specific methods
  11527. jQuery.each( tuples, function( i, tuple ) {
  11528. var list = tuple[ 2 ],
  11529. stateString = tuple[ 5 ];
  11530. // promise.progress = list.add
  11531. // promise.done = list.add
  11532. // promise.fail = list.add
  11533. promise[ tuple[ 1 ] ] = list.add;
  11534. // Handle state
  11535. if ( stateString ) {
  11536. list.add(
  11537. function() {
  11538. // state = "resolved" (i.e., fulfilled)
  11539. // state = "rejected"
  11540. state = stateString;
  11541. },
  11542. // rejected_callbacks.disable
  11543. // fulfilled_callbacks.disable
  11544. tuples[ 3 - i ][ 2 ].disable,
  11545. // rejected_handlers.disable
  11546. // fulfilled_handlers.disable
  11547. tuples[ 3 - i ][ 3 ].disable,
  11548. // progress_callbacks.lock
  11549. tuples[ 0 ][ 2 ].lock,
  11550. // progress_handlers.lock
  11551. tuples[ 0 ][ 3 ].lock
  11552. );
  11553. }
  11554. // progress_handlers.fire
  11555. // fulfilled_handlers.fire
  11556. // rejected_handlers.fire
  11557. list.add( tuple[ 3 ].fire );
  11558. // deferred.notify = function() { deferred.notifyWith(...) }
  11559. // deferred.resolve = function() { deferred.resolveWith(...) }
  11560. // deferred.reject = function() { deferred.rejectWith(...) }
  11561. deferred[ tuple[ 0 ] ] = function() {
  11562. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11563. return this;
  11564. };
  11565. // deferred.notifyWith = list.fireWith
  11566. // deferred.resolveWith = list.fireWith
  11567. // deferred.rejectWith = list.fireWith
  11568. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11569. } );
  11570. // Make the deferred a promise
  11571. promise.promise( deferred );
  11572. // Call given func if any
  11573. if ( func ) {
  11574. func.call( deferred, deferred );
  11575. }
  11576. // All done!
  11577. return deferred;
  11578. },
  11579. // Deferred helper
  11580. when: function( singleValue ) {
  11581. var
  11582. // count of uncompleted subordinates
  11583. remaining = arguments.length,
  11584. // count of unprocessed arguments
  11585. i = remaining,
  11586. // subordinate fulfillment data
  11587. resolveContexts = Array( i ),
  11588. resolveValues = slice.call( arguments ),
  11589. // the master Deferred
  11590. master = jQuery.Deferred(),
  11591. // subordinate callback factory
  11592. updateFunc = function( i ) {
  11593. return function( value ) {
  11594. resolveContexts[ i ] = this;
  11595. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11596. if ( !( --remaining ) ) {
  11597. master.resolveWith( resolveContexts, resolveValues );
  11598. }
  11599. };
  11600. };
  11601. // Single- and empty arguments are adopted like Promise.resolve
  11602. if ( remaining <= 1 ) {
  11603. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11604. !remaining );
  11605. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11606. if ( master.state() === "pending" ||
  11607. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11608. return master.then();
  11609. }
  11610. }
  11611. // Multiple arguments are aggregated like Promise.all array elements
  11612. while ( i-- ) {
  11613. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11614. }
  11615. return master.promise();
  11616. }
  11617. } );
  11618. // These usually indicate a programmer mistake during development,
  11619. // warn about them ASAP rather than swallowing them by default.
  11620. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11621. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11622. // Support: IE 8 - 9 only
  11623. // Console exists when dev tools are open, which can happen at any time
  11624. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11625. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11626. }
  11627. };
  11628. jQuery.readyException = function( error ) {
  11629. window.setTimeout( function() {
  11630. throw error;
  11631. } );
  11632. };
  11633. // The deferred used on DOM ready
  11634. var readyList = jQuery.Deferred();
  11635. jQuery.fn.ready = function( fn ) {
  11636. readyList
  11637. .then( fn )
  11638. // Wrap jQuery.readyException in a function so that the lookup
  11639. // happens at the time of error handling instead of callback
  11640. // registration.
  11641. .catch( function( error ) {
  11642. jQuery.readyException( error );
  11643. } );
  11644. return this;
  11645. };
  11646. jQuery.extend( {
  11647. // Is the DOM ready to be used? Set to true once it occurs.
  11648. isReady: false,
  11649. // A counter to track how many items to wait for before
  11650. // the ready event fires. See #6781
  11651. readyWait: 1,
  11652. // Handle when the DOM is ready
  11653. ready: function( wait ) {
  11654. // Abort if there are pending holds or we're already ready
  11655. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11656. return;
  11657. }
  11658. // Remember that the DOM is ready
  11659. jQuery.isReady = true;
  11660. // If a normal DOM Ready event fired, decrement, and wait if need be
  11661. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11662. return;
  11663. }
  11664. // If there are functions bound, to execute
  11665. readyList.resolveWith( document, [ jQuery ] );
  11666. }
  11667. } );
  11668. jQuery.ready.then = readyList.then;
  11669. // The ready event handler and self cleanup method
  11670. function completed() {
  11671. document.removeEventListener( "DOMContentLoaded", completed );
  11672. window.removeEventListener( "load", completed );
  11673. jQuery.ready();
  11674. }
  11675. // Catch cases where $(document).ready() is called
  11676. // after the browser event has already occurred.
  11677. // Support: IE <=9 - 10 only
  11678. // Older IE sometimes signals "interactive" too soon
  11679. if ( document.readyState === "complete" ||
  11680. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11681. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11682. window.setTimeout( jQuery.ready );
  11683. } else {
  11684. // Use the handy event callback
  11685. document.addEventListener( "DOMContentLoaded", completed );
  11686. // A fallback to window.onload, that will always work
  11687. window.addEventListener( "load", completed );
  11688. }
  11689. // Multifunctional method to get and set values of a collection
  11690. // The value/s can optionally be executed if it's a function
  11691. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11692. var i = 0,
  11693. len = elems.length,
  11694. bulk = key == null;
  11695. // Sets many values
  11696. if ( toType( key ) === "object" ) {
  11697. chainable = true;
  11698. for ( i in key ) {
  11699. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11700. }
  11701. // Sets one value
  11702. } else if ( value !== undefined ) {
  11703. chainable = true;
  11704. if ( !isFunction( value ) ) {
  11705. raw = true;
  11706. }
  11707. if ( bulk ) {
  11708. // Bulk operations run against the entire set
  11709. if ( raw ) {
  11710. fn.call( elems, value );
  11711. fn = null;
  11712. // ...except when executing function values
  11713. } else {
  11714. bulk = fn;
  11715. fn = function( elem, key, value ) {
  11716. return bulk.call( jQuery( elem ), value );
  11717. };
  11718. }
  11719. }
  11720. if ( fn ) {
  11721. for ( ; i < len; i++ ) {
  11722. fn(
  11723. elems[ i ], key, raw ?
  11724. value :
  11725. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11726. );
  11727. }
  11728. }
  11729. }
  11730. if ( chainable ) {
  11731. return elems;
  11732. }
  11733. // Gets
  11734. if ( bulk ) {
  11735. return fn.call( elems );
  11736. }
  11737. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11738. };
  11739. // Matches dashed string for camelizing
  11740. var rmsPrefix = /^-ms-/,
  11741. rdashAlpha = /-([a-z])/g;
  11742. // Used by camelCase as callback to replace()
  11743. function fcamelCase( all, letter ) {
  11744. return letter.toUpperCase();
  11745. }
  11746. // Convert dashed to camelCase; used by the css and data modules
  11747. // Support: IE <=9 - 11, Edge 12 - 15
  11748. // Microsoft forgot to hump their vendor prefix (#9572)
  11749. function camelCase( string ) {
  11750. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11751. }
  11752. var acceptData = function( owner ) {
  11753. // Accepts only:
  11754. // - Node
  11755. // - Node.ELEMENT_NODE
  11756. // - Node.DOCUMENT_NODE
  11757. // - Object
  11758. // - Any
  11759. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11760. };
  11761. function Data() {
  11762. this.expando = jQuery.expando + Data.uid++;
  11763. }
  11764. Data.uid = 1;
  11765. Data.prototype = {
  11766. cache: function( owner ) {
  11767. // Check if the owner object already has a cache
  11768. var value = owner[ this.expando ];
  11769. // If not, create one
  11770. if ( !value ) {
  11771. value = {};
  11772. // We can accept data for non-element nodes in modern browsers,
  11773. // but we should not, see #8335.
  11774. // Always return an empty object.
  11775. if ( acceptData( owner ) ) {
  11776. // If it is a node unlikely to be stringify-ed or looped over
  11777. // use plain assignment
  11778. if ( owner.nodeType ) {
  11779. owner[ this.expando ] = value;
  11780. // Otherwise secure it in a non-enumerable property
  11781. // configurable must be true to allow the property to be
  11782. // deleted when data is removed
  11783. } else {
  11784. Object.defineProperty( owner, this.expando, {
  11785. value: value,
  11786. configurable: true
  11787. } );
  11788. }
  11789. }
  11790. }
  11791. return value;
  11792. },
  11793. set: function( owner, data, value ) {
  11794. var prop,
  11795. cache = this.cache( owner );
  11796. // Handle: [ owner, key, value ] args
  11797. // Always use camelCase key (gh-2257)
  11798. if ( typeof data === "string" ) {
  11799. cache[ camelCase( data ) ] = value;
  11800. // Handle: [ owner, { properties } ] args
  11801. } else {
  11802. // Copy the properties one-by-one to the cache object
  11803. for ( prop in data ) {
  11804. cache[ camelCase( prop ) ] = data[ prop ];
  11805. }
  11806. }
  11807. return cache;
  11808. },
  11809. get: function( owner, key ) {
  11810. return key === undefined ?
  11811. this.cache( owner ) :
  11812. // Always use camelCase key (gh-2257)
  11813. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11814. },
  11815. access: function( owner, key, value ) {
  11816. // In cases where either:
  11817. //
  11818. // 1. No key was specified
  11819. // 2. A string key was specified, but no value provided
  11820. //
  11821. // Take the "read" path and allow the get method to determine
  11822. // which value to return, respectively either:
  11823. //
  11824. // 1. The entire cache object
  11825. // 2. The data stored at the key
  11826. //
  11827. if ( key === undefined ||
  11828. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11829. return this.get( owner, key );
  11830. }
  11831. // When the key is not a string, or both a key and value
  11832. // are specified, set or extend (existing objects) with either:
  11833. //
  11834. // 1. An object of properties
  11835. // 2. A key and value
  11836. //
  11837. this.set( owner, key, value );
  11838. // Since the "set" path can have two possible entry points
  11839. // return the expected data based on which path was taken[*]
  11840. return value !== undefined ? value : key;
  11841. },
  11842. remove: function( owner, key ) {
  11843. var i,
  11844. cache = owner[ this.expando ];
  11845. if ( cache === undefined ) {
  11846. return;
  11847. }
  11848. if ( key !== undefined ) {
  11849. // Support array or space separated string of keys
  11850. if ( Array.isArray( key ) ) {
  11851. // If key is an array of keys...
  11852. // We always set camelCase keys, so remove that.
  11853. key = key.map( camelCase );
  11854. } else {
  11855. key = camelCase( key );
  11856. // If a key with the spaces exists, use it.
  11857. // Otherwise, create an array by matching non-whitespace
  11858. key = key in cache ?
  11859. [ key ] :
  11860. ( key.match( rnothtmlwhite ) || [] );
  11861. }
  11862. i = key.length;
  11863. while ( i-- ) {
  11864. delete cache[ key[ i ] ];
  11865. }
  11866. }
  11867. // Remove the expando if there's no more data
  11868. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11869. // Support: Chrome <=35 - 45
  11870. // Webkit & Blink performance suffers when deleting properties
  11871. // from DOM nodes, so set to undefined instead
  11872. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11873. if ( owner.nodeType ) {
  11874. owner[ this.expando ] = undefined;
  11875. } else {
  11876. delete owner[ this.expando ];
  11877. }
  11878. }
  11879. },
  11880. hasData: function( owner ) {
  11881. var cache = owner[ this.expando ];
  11882. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11883. }
  11884. };
  11885. var dataPriv = new Data();
  11886. var dataUser = new Data();
  11887. // Implementation Summary
  11888. //
  11889. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11890. // 2. Improve the module's maintainability by reducing the storage
  11891. // paths to a single mechanism.
  11892. // 3. Use the same single mechanism to support "private" and "user" data.
  11893. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11894. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11895. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11896. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11897. rmultiDash = /[A-Z]/g;
  11898. function getData( data ) {
  11899. if ( data === "true" ) {
  11900. return true;
  11901. }
  11902. if ( data === "false" ) {
  11903. return false;
  11904. }
  11905. if ( data === "null" ) {
  11906. return null;
  11907. }
  11908. // Only convert to a number if it doesn't change the string
  11909. if ( data === +data + "" ) {
  11910. return +data;
  11911. }
  11912. if ( rbrace.test( data ) ) {
  11913. return JSON.parse( data );
  11914. }
  11915. return data;
  11916. }
  11917. function dataAttr( elem, key, data ) {
  11918. var name;
  11919. // If nothing was found internally, try to fetch any
  11920. // data from the HTML5 data-* attribute
  11921. if ( data === undefined && elem.nodeType === 1 ) {
  11922. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  11923. data = elem.getAttribute( name );
  11924. if ( typeof data === "string" ) {
  11925. try {
  11926. data = getData( data );
  11927. } catch ( e ) {}
  11928. // Make sure we set the data so it isn't changed later
  11929. dataUser.set( elem, key, data );
  11930. } else {
  11931. data = undefined;
  11932. }
  11933. }
  11934. return data;
  11935. }
  11936. jQuery.extend( {
  11937. hasData: function( elem ) {
  11938. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  11939. },
  11940. data: function( elem, name, data ) {
  11941. return dataUser.access( elem, name, data );
  11942. },
  11943. removeData: function( elem, name ) {
  11944. dataUser.remove( elem, name );
  11945. },
  11946. // TODO: Now that all calls to _data and _removeData have been replaced
  11947. // with direct calls to dataPriv methods, these can be deprecated.
  11948. _data: function( elem, name, data ) {
  11949. return dataPriv.access( elem, name, data );
  11950. },
  11951. _removeData: function( elem, name ) {
  11952. dataPriv.remove( elem, name );
  11953. }
  11954. } );
  11955. jQuery.fn.extend( {
  11956. data: function( key, value ) {
  11957. var i, name, data,
  11958. elem = this[ 0 ],
  11959. attrs = elem && elem.attributes;
  11960. // Gets all values
  11961. if ( key === undefined ) {
  11962. if ( this.length ) {
  11963. data = dataUser.get( elem );
  11964. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  11965. i = attrs.length;
  11966. while ( i-- ) {
  11967. // Support: IE 11 only
  11968. // The attrs elements can be null (#14894)
  11969. if ( attrs[ i ] ) {
  11970. name = attrs[ i ].name;
  11971. if ( name.indexOf( "data-" ) === 0 ) {
  11972. name = camelCase( name.slice( 5 ) );
  11973. dataAttr( elem, name, data[ name ] );
  11974. }
  11975. }
  11976. }
  11977. dataPriv.set( elem, "hasDataAttrs", true );
  11978. }
  11979. }
  11980. return data;
  11981. }
  11982. // Sets multiple values
  11983. if ( typeof key === "object" ) {
  11984. return this.each( function() {
  11985. dataUser.set( this, key );
  11986. } );
  11987. }
  11988. return access( this, function( value ) {
  11989. var data;
  11990. // The calling jQuery object (element matches) is not empty
  11991. // (and therefore has an element appears at this[ 0 ]) and the
  11992. // `value` parameter was not undefined. An empty jQuery object
  11993. // will result in `undefined` for elem = this[ 0 ] which will
  11994. // throw an exception if an attempt to read a data cache is made.
  11995. if ( elem && value === undefined ) {
  11996. // Attempt to get data from the cache
  11997. // The key will always be camelCased in Data
  11998. data = dataUser.get( elem, key );
  11999. if ( data !== undefined ) {
  12000. return data;
  12001. }
  12002. // Attempt to "discover" the data in
  12003. // HTML5 custom data-* attrs
  12004. data = dataAttr( elem, key );
  12005. if ( data !== undefined ) {
  12006. return data;
  12007. }
  12008. // We tried really hard, but the data doesn't exist.
  12009. return;
  12010. }
  12011. // Set the data...
  12012. this.each( function() {
  12013. // We always store the camelCased key
  12014. dataUser.set( this, key, value );
  12015. } );
  12016. }, null, value, arguments.length > 1, null, true );
  12017. },
  12018. removeData: function( key ) {
  12019. return this.each( function() {
  12020. dataUser.remove( this, key );
  12021. } );
  12022. }
  12023. } );
  12024. jQuery.extend( {
  12025. queue: function( elem, type, data ) {
  12026. var queue;
  12027. if ( elem ) {
  12028. type = ( type || "fx" ) + "queue";
  12029. queue = dataPriv.get( elem, type );
  12030. // Speed up dequeue by getting out quickly if this is just a lookup
  12031. if ( data ) {
  12032. if ( !queue || Array.isArray( data ) ) {
  12033. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12034. } else {
  12035. queue.push( data );
  12036. }
  12037. }
  12038. return queue || [];
  12039. }
  12040. },
  12041. dequeue: function( elem, type ) {
  12042. type = type || "fx";
  12043. var queue = jQuery.queue( elem, type ),
  12044. startLength = queue.length,
  12045. fn = queue.shift(),
  12046. hooks = jQuery._queueHooks( elem, type ),
  12047. next = function() {
  12048. jQuery.dequeue( elem, type );
  12049. };
  12050. // If the fx queue is dequeued, always remove the progress sentinel
  12051. if ( fn === "inprogress" ) {
  12052. fn = queue.shift();
  12053. startLength--;
  12054. }
  12055. if ( fn ) {
  12056. // Add a progress sentinel to prevent the fx queue from being
  12057. // automatically dequeued
  12058. if ( type === "fx" ) {
  12059. queue.unshift( "inprogress" );
  12060. }
  12061. // Clear up the last queue stop function
  12062. delete hooks.stop;
  12063. fn.call( elem, next, hooks );
  12064. }
  12065. if ( !startLength && hooks ) {
  12066. hooks.empty.fire();
  12067. }
  12068. },
  12069. // Not public - generate a queueHooks object, or return the current one
  12070. _queueHooks: function( elem, type ) {
  12071. var key = type + "queueHooks";
  12072. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12073. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12074. dataPriv.remove( elem, [ type + "queue", key ] );
  12075. } )
  12076. } );
  12077. }
  12078. } );
  12079. jQuery.fn.extend( {
  12080. queue: function( type, data ) {
  12081. var setter = 2;
  12082. if ( typeof type !== "string" ) {
  12083. data = type;
  12084. type = "fx";
  12085. setter--;
  12086. }
  12087. if ( arguments.length < setter ) {
  12088. return jQuery.queue( this[ 0 ], type );
  12089. }
  12090. return data === undefined ?
  12091. this :
  12092. this.each( function() {
  12093. var queue = jQuery.queue( this, type, data );
  12094. // Ensure a hooks for this queue
  12095. jQuery._queueHooks( this, type );
  12096. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12097. jQuery.dequeue( this, type );
  12098. }
  12099. } );
  12100. },
  12101. dequeue: function( type ) {
  12102. return this.each( function() {
  12103. jQuery.dequeue( this, type );
  12104. } );
  12105. },
  12106. clearQueue: function( type ) {
  12107. return this.queue( type || "fx", [] );
  12108. },
  12109. // Get a promise resolved when queues of a certain type
  12110. // are emptied (fx is the type by default)
  12111. promise: function( type, obj ) {
  12112. var tmp,
  12113. count = 1,
  12114. defer = jQuery.Deferred(),
  12115. elements = this,
  12116. i = this.length,
  12117. resolve = function() {
  12118. if ( !( --count ) ) {
  12119. defer.resolveWith( elements, [ elements ] );
  12120. }
  12121. };
  12122. if ( typeof type !== "string" ) {
  12123. obj = type;
  12124. type = undefined;
  12125. }
  12126. type = type || "fx";
  12127. while ( i-- ) {
  12128. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12129. if ( tmp && tmp.empty ) {
  12130. count++;
  12131. tmp.empty.add( resolve );
  12132. }
  12133. }
  12134. resolve();
  12135. return defer.promise( obj );
  12136. }
  12137. } );
  12138. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12139. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12140. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12141. var documentElement = document.documentElement;
  12142. var isAttached = function( elem ) {
  12143. return jQuery.contains( elem.ownerDocument, elem );
  12144. },
  12145. composed = { composed: true };
  12146. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12147. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12148. // Support: iOS 10.0-10.2 only
  12149. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12150. // leading to errors. We need to check for `getRootNode`.
  12151. if ( documentElement.getRootNode ) {
  12152. isAttached = function( elem ) {
  12153. return jQuery.contains( elem.ownerDocument, elem ) ||
  12154. elem.getRootNode( composed ) === elem.ownerDocument;
  12155. };
  12156. }
  12157. var isHiddenWithinTree = function( elem, el ) {
  12158. // isHiddenWithinTree might be called from jQuery#filter function;
  12159. // in that case, element will be second argument
  12160. elem = el || elem;
  12161. // Inline style trumps all
  12162. return elem.style.display === "none" ||
  12163. elem.style.display === "" &&
  12164. // Otherwise, check computed style
  12165. // Support: Firefox <=43 - 45
  12166. // Disconnected elements can have computed display: none, so first confirm that elem is
  12167. // in the document.
  12168. isAttached( elem ) &&
  12169. jQuery.css( elem, "display" ) === "none";
  12170. };
  12171. var swap = function( elem, options, callback, args ) {
  12172. var ret, name,
  12173. old = {};
  12174. // Remember the old values, and insert the new ones
  12175. for ( name in options ) {
  12176. old[ name ] = elem.style[ name ];
  12177. elem.style[ name ] = options[ name ];
  12178. }
  12179. ret = callback.apply( elem, args || [] );
  12180. // Revert the old values
  12181. for ( name in options ) {
  12182. elem.style[ name ] = old[ name ];
  12183. }
  12184. return ret;
  12185. };
  12186. function adjustCSS( elem, prop, valueParts, tween ) {
  12187. var adjusted, scale,
  12188. maxIterations = 20,
  12189. currentValue = tween ?
  12190. function() {
  12191. return tween.cur();
  12192. } :
  12193. function() {
  12194. return jQuery.css( elem, prop, "" );
  12195. },
  12196. initial = currentValue(),
  12197. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12198. // Starting value computation is required for potential unit mismatches
  12199. initialInUnit = elem.nodeType &&
  12200. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12201. rcssNum.exec( jQuery.css( elem, prop ) );
  12202. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12203. // Support: Firefox <=54
  12204. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12205. initial = initial / 2;
  12206. // Trust units reported by jQuery.css
  12207. unit = unit || initialInUnit[ 3 ];
  12208. // Iteratively approximate from a nonzero starting point
  12209. initialInUnit = +initial || 1;
  12210. while ( maxIterations-- ) {
  12211. // Evaluate and update our best guess (doubling guesses that zero out).
  12212. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12213. jQuery.style( elem, prop, initialInUnit + unit );
  12214. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12215. maxIterations = 0;
  12216. }
  12217. initialInUnit = initialInUnit / scale;
  12218. }
  12219. initialInUnit = initialInUnit * 2;
  12220. jQuery.style( elem, prop, initialInUnit + unit );
  12221. // Make sure we update the tween properties later on
  12222. valueParts = valueParts || [];
  12223. }
  12224. if ( valueParts ) {
  12225. initialInUnit = +initialInUnit || +initial || 0;
  12226. // Apply relative offset (+=/-=) if specified
  12227. adjusted = valueParts[ 1 ] ?
  12228. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12229. +valueParts[ 2 ];
  12230. if ( tween ) {
  12231. tween.unit = unit;
  12232. tween.start = initialInUnit;
  12233. tween.end = adjusted;
  12234. }
  12235. }
  12236. return adjusted;
  12237. }
  12238. var defaultDisplayMap = {};
  12239. function getDefaultDisplay( elem ) {
  12240. var temp,
  12241. doc = elem.ownerDocument,
  12242. nodeName = elem.nodeName,
  12243. display = defaultDisplayMap[ nodeName ];
  12244. if ( display ) {
  12245. return display;
  12246. }
  12247. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12248. display = jQuery.css( temp, "display" );
  12249. temp.parentNode.removeChild( temp );
  12250. if ( display === "none" ) {
  12251. display = "block";
  12252. }
  12253. defaultDisplayMap[ nodeName ] = display;
  12254. return display;
  12255. }
  12256. function showHide( elements, show ) {
  12257. var display, elem,
  12258. values = [],
  12259. index = 0,
  12260. length = elements.length;
  12261. // Determine new display value for elements that need to change
  12262. for ( ; index < length; index++ ) {
  12263. elem = elements[ index ];
  12264. if ( !elem.style ) {
  12265. continue;
  12266. }
  12267. display = elem.style.display;
  12268. if ( show ) {
  12269. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12270. // check is required in this first loop unless we have a nonempty display value (either
  12271. // inline or about-to-be-restored)
  12272. if ( display === "none" ) {
  12273. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12274. if ( !values[ index ] ) {
  12275. elem.style.display = "";
  12276. }
  12277. }
  12278. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12279. values[ index ] = getDefaultDisplay( elem );
  12280. }
  12281. } else {
  12282. if ( display !== "none" ) {
  12283. values[ index ] = "none";
  12284. // Remember what we're overwriting
  12285. dataPriv.set( elem, "display", display );
  12286. }
  12287. }
  12288. }
  12289. // Set the display of the elements in a second loop to avoid constant reflow
  12290. for ( index = 0; index < length; index++ ) {
  12291. if ( values[ index ] != null ) {
  12292. elements[ index ].style.display = values[ index ];
  12293. }
  12294. }
  12295. return elements;
  12296. }
  12297. jQuery.fn.extend( {
  12298. show: function() {
  12299. return showHide( this, true );
  12300. },
  12301. hide: function() {
  12302. return showHide( this );
  12303. },
  12304. toggle: function( state ) {
  12305. if ( typeof state === "boolean" ) {
  12306. return state ? this.show() : this.hide();
  12307. }
  12308. return this.each( function() {
  12309. if ( isHiddenWithinTree( this ) ) {
  12310. jQuery( this ).show();
  12311. } else {
  12312. jQuery( this ).hide();
  12313. }
  12314. } );
  12315. }
  12316. } );
  12317. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12318. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12319. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12320. // We have to close these tags to support XHTML (#13200)
  12321. var wrapMap = {
  12322. // Support: IE <=9 only
  12323. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12324. // XHTML parsers do not magically insert elements in the
  12325. // same way that tag soup parsers do. So we cannot shorten
  12326. // this by omitting <tbody> or other required elements.
  12327. thead: [ 1, "<table>", "</table>" ],
  12328. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12329. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12330. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12331. _default: [ 0, "", "" ]
  12332. };
  12333. // Support: IE <=9 only
  12334. wrapMap.optgroup = wrapMap.option;
  12335. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12336. wrapMap.th = wrapMap.td;
  12337. function getAll( context, tag ) {
  12338. // Support: IE <=9 - 11 only
  12339. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12340. var ret;
  12341. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12342. ret = context.getElementsByTagName( tag || "*" );
  12343. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12344. ret = context.querySelectorAll( tag || "*" );
  12345. } else {
  12346. ret = [];
  12347. }
  12348. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12349. return jQuery.merge( [ context ], ret );
  12350. }
  12351. return ret;
  12352. }
  12353. // Mark scripts as having already been evaluated
  12354. function setGlobalEval( elems, refElements ) {
  12355. var i = 0,
  12356. l = elems.length;
  12357. for ( ; i < l; i++ ) {
  12358. dataPriv.set(
  12359. elems[ i ],
  12360. "globalEval",
  12361. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12362. );
  12363. }
  12364. }
  12365. var rhtml = /<|&#?\w+;/;
  12366. function buildFragment( elems, context, scripts, selection, ignored ) {
  12367. var elem, tmp, tag, wrap, attached, j,
  12368. fragment = context.createDocumentFragment(),
  12369. nodes = [],
  12370. i = 0,
  12371. l = elems.length;
  12372. for ( ; i < l; i++ ) {
  12373. elem = elems[ i ];
  12374. if ( elem || elem === 0 ) {
  12375. // Add nodes directly
  12376. if ( toType( elem ) === "object" ) {
  12377. // Support: Android <=4.0 only, PhantomJS 1 only
  12378. // push.apply(_, arraylike) throws on ancient WebKit
  12379. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12380. // Convert non-html into a text node
  12381. } else if ( !rhtml.test( elem ) ) {
  12382. nodes.push( context.createTextNode( elem ) );
  12383. // Convert html into DOM nodes
  12384. } else {
  12385. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12386. // Deserialize a standard representation
  12387. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12388. wrap = wrapMap[ tag ] || wrapMap._default;
  12389. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12390. // Descend through wrappers to the right content
  12391. j = wrap[ 0 ];
  12392. while ( j-- ) {
  12393. tmp = tmp.lastChild;
  12394. }
  12395. // Support: Android <=4.0 only, PhantomJS 1 only
  12396. // push.apply(_, arraylike) throws on ancient WebKit
  12397. jQuery.merge( nodes, tmp.childNodes );
  12398. // Remember the top-level container
  12399. tmp = fragment.firstChild;
  12400. // Ensure the created nodes are orphaned (#12392)
  12401. tmp.textContent = "";
  12402. }
  12403. }
  12404. }
  12405. // Remove wrapper from fragment
  12406. fragment.textContent = "";
  12407. i = 0;
  12408. while ( ( elem = nodes[ i++ ] ) ) {
  12409. // Skip elements already in the context collection (trac-4087)
  12410. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12411. if ( ignored ) {
  12412. ignored.push( elem );
  12413. }
  12414. continue;
  12415. }
  12416. attached = isAttached( elem );
  12417. // Append to fragment
  12418. tmp = getAll( fragment.appendChild( elem ), "script" );
  12419. // Preserve script evaluation history
  12420. if ( attached ) {
  12421. setGlobalEval( tmp );
  12422. }
  12423. // Capture executables
  12424. if ( scripts ) {
  12425. j = 0;
  12426. while ( ( elem = tmp[ j++ ] ) ) {
  12427. if ( rscriptType.test( elem.type || "" ) ) {
  12428. scripts.push( elem );
  12429. }
  12430. }
  12431. }
  12432. }
  12433. return fragment;
  12434. }
  12435. ( function() {
  12436. var fragment = document.createDocumentFragment(),
  12437. div = fragment.appendChild( document.createElement( "div" ) ),
  12438. input = document.createElement( "input" );
  12439. // Support: Android 4.0 - 4.3 only
  12440. // Check state lost if the name is set (#11217)
  12441. // Support: Windows Web Apps (WWA)
  12442. // `name` and `type` must use .setAttribute for WWA (#14901)
  12443. input.setAttribute( "type", "radio" );
  12444. input.setAttribute( "checked", "checked" );
  12445. input.setAttribute( "name", "t" );
  12446. div.appendChild( input );
  12447. // Support: Android <=4.1 only
  12448. // Older WebKit doesn't clone checked state correctly in fragments
  12449. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12450. // Support: IE <=11 only
  12451. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12452. div.innerHTML = "<textarea>x</textarea>";
  12453. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12454. } )();
  12455. var
  12456. rkeyEvent = /^key/,
  12457. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12458. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12459. function returnTrue() {
  12460. return true;
  12461. }
  12462. function returnFalse() {
  12463. return false;
  12464. }
  12465. // Support: IE <=9 - 11+
  12466. // focus() and blur() are asynchronous, except when they are no-op.
  12467. // So expect focus to be synchronous when the element is already active,
  12468. // and blur to be synchronous when the element is not already active.
  12469. // (focus and blur are always synchronous in other supported browsers,
  12470. // this just defines when we can count on it).
  12471. function expectSync( elem, type ) {
  12472. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12473. }
  12474. // Support: IE <=9 only
  12475. // Accessing document.activeElement can throw unexpectedly
  12476. // https://bugs.jquery.com/ticket/13393
  12477. function safeActiveElement() {
  12478. try {
  12479. return document.activeElement;
  12480. } catch ( err ) { }
  12481. }
  12482. function on( elem, types, selector, data, fn, one ) {
  12483. var origFn, type;
  12484. // Types can be a map of types/handlers
  12485. if ( typeof types === "object" ) {
  12486. // ( types-Object, selector, data )
  12487. if ( typeof selector !== "string" ) {
  12488. // ( types-Object, data )
  12489. data = data || selector;
  12490. selector = undefined;
  12491. }
  12492. for ( type in types ) {
  12493. on( elem, type, selector, data, types[ type ], one );
  12494. }
  12495. return elem;
  12496. }
  12497. if ( data == null && fn == null ) {
  12498. // ( types, fn )
  12499. fn = selector;
  12500. data = selector = undefined;
  12501. } else if ( fn == null ) {
  12502. if ( typeof selector === "string" ) {
  12503. // ( types, selector, fn )
  12504. fn = data;
  12505. data = undefined;
  12506. } else {
  12507. // ( types, data, fn )
  12508. fn = data;
  12509. data = selector;
  12510. selector = undefined;
  12511. }
  12512. }
  12513. if ( fn === false ) {
  12514. fn = returnFalse;
  12515. } else if ( !fn ) {
  12516. return elem;
  12517. }
  12518. if ( one === 1 ) {
  12519. origFn = fn;
  12520. fn = function( event ) {
  12521. // Can use an empty set, since event contains the info
  12522. jQuery().off( event );
  12523. return origFn.apply( this, arguments );
  12524. };
  12525. // Use same guid so caller can remove using origFn
  12526. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12527. }
  12528. return elem.each( function() {
  12529. jQuery.event.add( this, types, fn, data, selector );
  12530. } );
  12531. }
  12532. /*
  12533. * Helper functions for managing events -- not part of the public interface.
  12534. * Props to Dean Edwards' addEvent library for many of the ideas.
  12535. */
  12536. jQuery.event = {
  12537. global: {},
  12538. add: function( elem, types, handler, data, selector ) {
  12539. var handleObjIn, eventHandle, tmp,
  12540. events, t, handleObj,
  12541. special, handlers, type, namespaces, origType,
  12542. elemData = dataPriv.get( elem );
  12543. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12544. if ( !elemData ) {
  12545. return;
  12546. }
  12547. // Caller can pass in an object of custom data in lieu of the handler
  12548. if ( handler.handler ) {
  12549. handleObjIn = handler;
  12550. handler = handleObjIn.handler;
  12551. selector = handleObjIn.selector;
  12552. }
  12553. // Ensure that invalid selectors throw exceptions at attach time
  12554. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12555. if ( selector ) {
  12556. jQuery.find.matchesSelector( documentElement, selector );
  12557. }
  12558. // Make sure that the handler has a unique ID, used to find/remove it later
  12559. if ( !handler.guid ) {
  12560. handler.guid = jQuery.guid++;
  12561. }
  12562. // Init the element's event structure and main handler, if this is the first
  12563. if ( !( events = elemData.events ) ) {
  12564. events = elemData.events = {};
  12565. }
  12566. if ( !( eventHandle = elemData.handle ) ) {
  12567. eventHandle = elemData.handle = function( e ) {
  12568. // Discard the second event of a jQuery.event.trigger() and
  12569. // when an event is called after a page has unloaded
  12570. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12571. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12572. };
  12573. }
  12574. // Handle multiple events separated by a space
  12575. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12576. t = types.length;
  12577. while ( t-- ) {
  12578. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12579. type = origType = tmp[ 1 ];
  12580. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12581. // There *must* be a type, no attaching namespace-only handlers
  12582. if ( !type ) {
  12583. continue;
  12584. }
  12585. // If event changes its type, use the special event handlers for the changed type
  12586. special = jQuery.event.special[ type ] || {};
  12587. // If selector defined, determine special event api type, otherwise given type
  12588. type = ( selector ? special.delegateType : special.bindType ) || type;
  12589. // Update special based on newly reset type
  12590. special = jQuery.event.special[ type ] || {};
  12591. // handleObj is passed to all event handlers
  12592. handleObj = jQuery.extend( {
  12593. type: type,
  12594. origType: origType,
  12595. data: data,
  12596. handler: handler,
  12597. guid: handler.guid,
  12598. selector: selector,
  12599. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12600. namespace: namespaces.join( "." )
  12601. }, handleObjIn );
  12602. // Init the event handler queue if we're the first
  12603. if ( !( handlers = events[ type ] ) ) {
  12604. handlers = events[ type ] = [];
  12605. handlers.delegateCount = 0;
  12606. // Only use addEventListener if the special events handler returns false
  12607. if ( !special.setup ||
  12608. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12609. if ( elem.addEventListener ) {
  12610. elem.addEventListener( type, eventHandle );
  12611. }
  12612. }
  12613. }
  12614. if ( special.add ) {
  12615. special.add.call( elem, handleObj );
  12616. if ( !handleObj.handler.guid ) {
  12617. handleObj.handler.guid = handler.guid;
  12618. }
  12619. }
  12620. // Add to the element's handler list, delegates in front
  12621. if ( selector ) {
  12622. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12623. } else {
  12624. handlers.push( handleObj );
  12625. }
  12626. // Keep track of which events have ever been used, for event optimization
  12627. jQuery.event.global[ type ] = true;
  12628. }
  12629. },
  12630. // Detach an event or set of events from an element
  12631. remove: function( elem, types, handler, selector, mappedTypes ) {
  12632. var j, origCount, tmp,
  12633. events, t, handleObj,
  12634. special, handlers, type, namespaces, origType,
  12635. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12636. if ( !elemData || !( events = elemData.events ) ) {
  12637. return;
  12638. }
  12639. // Once for each type.namespace in types; type may be omitted
  12640. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12641. t = types.length;
  12642. while ( t-- ) {
  12643. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12644. type = origType = tmp[ 1 ];
  12645. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12646. // Unbind all events (on this namespace, if provided) for the element
  12647. if ( !type ) {
  12648. for ( type in events ) {
  12649. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12650. }
  12651. continue;
  12652. }
  12653. special = jQuery.event.special[ type ] || {};
  12654. type = ( selector ? special.delegateType : special.bindType ) || type;
  12655. handlers = events[ type ] || [];
  12656. tmp = tmp[ 2 ] &&
  12657. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12658. // Remove matching events
  12659. origCount = j = handlers.length;
  12660. while ( j-- ) {
  12661. handleObj = handlers[ j ];
  12662. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12663. ( !handler || handler.guid === handleObj.guid ) &&
  12664. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12665. ( !selector || selector === handleObj.selector ||
  12666. selector === "**" && handleObj.selector ) ) {
  12667. handlers.splice( j, 1 );
  12668. if ( handleObj.selector ) {
  12669. handlers.delegateCount--;
  12670. }
  12671. if ( special.remove ) {
  12672. special.remove.call( elem, handleObj );
  12673. }
  12674. }
  12675. }
  12676. // Remove generic event handler if we removed something and no more handlers exist
  12677. // (avoids potential for endless recursion during removal of special event handlers)
  12678. if ( origCount && !handlers.length ) {
  12679. if ( !special.teardown ||
  12680. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12681. jQuery.removeEvent( elem, type, elemData.handle );
  12682. }
  12683. delete events[ type ];
  12684. }
  12685. }
  12686. // Remove data and the expando if it's no longer used
  12687. if ( jQuery.isEmptyObject( events ) ) {
  12688. dataPriv.remove( elem, "handle events" );
  12689. }
  12690. },
  12691. dispatch: function( nativeEvent ) {
  12692. // Make a writable jQuery.Event from the native event object
  12693. var event = jQuery.event.fix( nativeEvent );
  12694. var i, j, ret, matched, handleObj, handlerQueue,
  12695. args = new Array( arguments.length ),
  12696. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12697. special = jQuery.event.special[ event.type ] || {};
  12698. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12699. args[ 0 ] = event;
  12700. for ( i = 1; i < arguments.length; i++ ) {
  12701. args[ i ] = arguments[ i ];
  12702. }
  12703. event.delegateTarget = this;
  12704. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12705. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12706. return;
  12707. }
  12708. // Determine handlers
  12709. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12710. // Run delegates first; they may want to stop propagation beneath us
  12711. i = 0;
  12712. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12713. event.currentTarget = matched.elem;
  12714. j = 0;
  12715. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12716. !event.isImmediatePropagationStopped() ) {
  12717. // If the event is namespaced, then each handler is only invoked if it is
  12718. // specially universal or its namespaces are a superset of the event's.
  12719. if ( !event.rnamespace || handleObj.namespace === false ||
  12720. event.rnamespace.test( handleObj.namespace ) ) {
  12721. event.handleObj = handleObj;
  12722. event.data = handleObj.data;
  12723. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12724. handleObj.handler ).apply( matched.elem, args );
  12725. if ( ret !== undefined ) {
  12726. if ( ( event.result = ret ) === false ) {
  12727. event.preventDefault();
  12728. event.stopPropagation();
  12729. }
  12730. }
  12731. }
  12732. }
  12733. }
  12734. // Call the postDispatch hook for the mapped type
  12735. if ( special.postDispatch ) {
  12736. special.postDispatch.call( this, event );
  12737. }
  12738. return event.result;
  12739. },
  12740. handlers: function( event, handlers ) {
  12741. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12742. handlerQueue = [],
  12743. delegateCount = handlers.delegateCount,
  12744. cur = event.target;
  12745. // Find delegate handlers
  12746. if ( delegateCount &&
  12747. // Support: IE <=9
  12748. // Black-hole SVG <use> instance trees (trac-13180)
  12749. cur.nodeType &&
  12750. // Support: Firefox <=42
  12751. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12752. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12753. // Support: IE 11 only
  12754. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12755. !( event.type === "click" && event.button >= 1 ) ) {
  12756. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12757. // Don't check non-elements (#13208)
  12758. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12759. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12760. matchedHandlers = [];
  12761. matchedSelectors = {};
  12762. for ( i = 0; i < delegateCount; i++ ) {
  12763. handleObj = handlers[ i ];
  12764. // Don't conflict with Object.prototype properties (#13203)
  12765. sel = handleObj.selector + " ";
  12766. if ( matchedSelectors[ sel ] === undefined ) {
  12767. matchedSelectors[ sel ] = handleObj.needsContext ?
  12768. jQuery( sel, this ).index( cur ) > -1 :
  12769. jQuery.find( sel, this, null, [ cur ] ).length;
  12770. }
  12771. if ( matchedSelectors[ sel ] ) {
  12772. matchedHandlers.push( handleObj );
  12773. }
  12774. }
  12775. if ( matchedHandlers.length ) {
  12776. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12777. }
  12778. }
  12779. }
  12780. }
  12781. // Add the remaining (directly-bound) handlers
  12782. cur = this;
  12783. if ( delegateCount < handlers.length ) {
  12784. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12785. }
  12786. return handlerQueue;
  12787. },
  12788. addProp: function( name, hook ) {
  12789. Object.defineProperty( jQuery.Event.prototype, name, {
  12790. enumerable: true,
  12791. configurable: true,
  12792. get: isFunction( hook ) ?
  12793. function() {
  12794. if ( this.originalEvent ) {
  12795. return hook( this.originalEvent );
  12796. }
  12797. } :
  12798. function() {
  12799. if ( this.originalEvent ) {
  12800. return this.originalEvent[ name ];
  12801. }
  12802. },
  12803. set: function( value ) {
  12804. Object.defineProperty( this, name, {
  12805. enumerable: true,
  12806. configurable: true,
  12807. writable: true,
  12808. value: value
  12809. } );
  12810. }
  12811. } );
  12812. },
  12813. fix: function( originalEvent ) {
  12814. return originalEvent[ jQuery.expando ] ?
  12815. originalEvent :
  12816. new jQuery.Event( originalEvent );
  12817. },
  12818. special: {
  12819. load: {
  12820. // Prevent triggered image.load events from bubbling to window.load
  12821. noBubble: true
  12822. },
  12823. click: {
  12824. // Utilize native event to ensure correct state for checkable inputs
  12825. setup: function( data ) {
  12826. // For mutual compressibility with _default, replace `this` access with a local var.
  12827. // `|| data` is dead code meant only to preserve the variable through minification.
  12828. var el = this || data;
  12829. // Claim the first handler
  12830. if ( rcheckableType.test( el.type ) &&
  12831. el.click && nodeName( el, "input" ) ) {
  12832. // dataPriv.set( el, "click", ... )
  12833. leverageNative( el, "click", returnTrue );
  12834. }
  12835. // Return false to allow normal processing in the caller
  12836. return false;
  12837. },
  12838. trigger: function( data ) {
  12839. // For mutual compressibility with _default, replace `this` access with a local var.
  12840. // `|| data` is dead code meant only to preserve the variable through minification.
  12841. var el = this || data;
  12842. // Force setup before triggering a click
  12843. if ( rcheckableType.test( el.type ) &&
  12844. el.click && nodeName( el, "input" ) ) {
  12845. leverageNative( el, "click" );
  12846. }
  12847. // Return non-false to allow normal event-path propagation
  12848. return true;
  12849. },
  12850. // For cross-browser consistency, suppress native .click() on links
  12851. // Also prevent it if we're currently inside a leveraged native-event stack
  12852. _default: function( event ) {
  12853. var target = event.target;
  12854. return rcheckableType.test( target.type ) &&
  12855. target.click && nodeName( target, "input" ) &&
  12856. dataPriv.get( target, "click" ) ||
  12857. nodeName( target, "a" );
  12858. }
  12859. },
  12860. beforeunload: {
  12861. postDispatch: function( event ) {
  12862. // Support: Firefox 20+
  12863. // Firefox doesn't alert if the returnValue field is not set.
  12864. if ( event.result !== undefined && event.originalEvent ) {
  12865. event.originalEvent.returnValue = event.result;
  12866. }
  12867. }
  12868. }
  12869. }
  12870. };
  12871. // Ensure the presence of an event listener that handles manually-triggered
  12872. // synthetic events by interrupting progress until reinvoked in response to
  12873. // *native* events that it fires directly, ensuring that state changes have
  12874. // already occurred before other listeners are invoked.
  12875. function leverageNative( el, type, expectSync ) {
  12876. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12877. if ( !expectSync ) {
  12878. if ( dataPriv.get( el, type ) === undefined ) {
  12879. jQuery.event.add( el, type, returnTrue );
  12880. }
  12881. return;
  12882. }
  12883. // Register the controller as a special universal handler for all event namespaces
  12884. dataPriv.set( el, type, false );
  12885. jQuery.event.add( el, type, {
  12886. namespace: false,
  12887. handler: function( event ) {
  12888. var notAsync, result,
  12889. saved = dataPriv.get( this, type );
  12890. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12891. // Interrupt processing of the outer synthetic .trigger()ed event
  12892. // Saved data should be false in such cases, but might be a leftover capture object
  12893. // from an async native handler (gh-4350)
  12894. if ( !saved.length ) {
  12895. // Store arguments for use when handling the inner native event
  12896. // There will always be at least one argument (an event object), so this array
  12897. // will not be confused with a leftover capture object.
  12898. saved = slice.call( arguments );
  12899. dataPriv.set( this, type, saved );
  12900. // Trigger the native event and capture its result
  12901. // Support: IE <=9 - 11+
  12902. // focus() and blur() are asynchronous
  12903. notAsync = expectSync( this, type );
  12904. this[ type ]();
  12905. result = dataPriv.get( this, type );
  12906. if ( saved !== result || notAsync ) {
  12907. dataPriv.set( this, type, false );
  12908. } else {
  12909. result = {};
  12910. }
  12911. if ( saved !== result ) {
  12912. // Cancel the outer synthetic event
  12913. event.stopImmediatePropagation();
  12914. event.preventDefault();
  12915. return result.value;
  12916. }
  12917. // If this is an inner synthetic event for an event with a bubbling surrogate
  12918. // (focus or blur), assume that the surrogate already propagated from triggering the
  12919. // native event and prevent that from happening again here.
  12920. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  12921. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  12922. // less bad than duplication.
  12923. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  12924. event.stopPropagation();
  12925. }
  12926. // If this is a native event triggered above, everything is now in order
  12927. // Fire an inner synthetic event with the original arguments
  12928. } else if ( saved.length ) {
  12929. // ...and capture the result
  12930. dataPriv.set( this, type, {
  12931. value: jQuery.event.trigger(
  12932. // Support: IE <=9 - 11+
  12933. // Extend with the prototype to reset the above stopImmediatePropagation()
  12934. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  12935. saved.slice( 1 ),
  12936. this
  12937. )
  12938. } );
  12939. // Abort handling of the native event
  12940. event.stopImmediatePropagation();
  12941. }
  12942. }
  12943. } );
  12944. }
  12945. jQuery.removeEvent = function( elem, type, handle ) {
  12946. // This "if" is needed for plain objects
  12947. if ( elem.removeEventListener ) {
  12948. elem.removeEventListener( type, handle );
  12949. }
  12950. };
  12951. jQuery.Event = function( src, props ) {
  12952. // Allow instantiation without the 'new' keyword
  12953. if ( !( this instanceof jQuery.Event ) ) {
  12954. return new jQuery.Event( src, props );
  12955. }
  12956. // Event object
  12957. if ( src && src.type ) {
  12958. this.originalEvent = src;
  12959. this.type = src.type;
  12960. // Events bubbling up the document may have been marked as prevented
  12961. // by a handler lower down the tree; reflect the correct value.
  12962. this.isDefaultPrevented = src.defaultPrevented ||
  12963. src.defaultPrevented === undefined &&
  12964. // Support: Android <=2.3 only
  12965. src.returnValue === false ?
  12966. returnTrue :
  12967. returnFalse;
  12968. // Create target properties
  12969. // Support: Safari <=6 - 7 only
  12970. // Target should not be a text node (#504, #13143)
  12971. this.target = ( src.target && src.target.nodeType === 3 ) ?
  12972. src.target.parentNode :
  12973. src.target;
  12974. this.currentTarget = src.currentTarget;
  12975. this.relatedTarget = src.relatedTarget;
  12976. // Event type
  12977. } else {
  12978. this.type = src;
  12979. }
  12980. // Put explicitly provided properties onto the event object
  12981. if ( props ) {
  12982. jQuery.extend( this, props );
  12983. }
  12984. // Create a timestamp if incoming event doesn't have one
  12985. this.timeStamp = src && src.timeStamp || Date.now();
  12986. // Mark it as fixed
  12987. this[ jQuery.expando ] = true;
  12988. };
  12989. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  12990. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  12991. jQuery.Event.prototype = {
  12992. constructor: jQuery.Event,
  12993. isDefaultPrevented: returnFalse,
  12994. isPropagationStopped: returnFalse,
  12995. isImmediatePropagationStopped: returnFalse,
  12996. isSimulated: false,
  12997. preventDefault: function() {
  12998. var e = this.originalEvent;
  12999. this.isDefaultPrevented = returnTrue;
  13000. if ( e && !this.isSimulated ) {
  13001. e.preventDefault();
  13002. }
  13003. },
  13004. stopPropagation: function() {
  13005. var e = this.originalEvent;
  13006. this.isPropagationStopped = returnTrue;
  13007. if ( e && !this.isSimulated ) {
  13008. e.stopPropagation();
  13009. }
  13010. },
  13011. stopImmediatePropagation: function() {
  13012. var e = this.originalEvent;
  13013. this.isImmediatePropagationStopped = returnTrue;
  13014. if ( e && !this.isSimulated ) {
  13015. e.stopImmediatePropagation();
  13016. }
  13017. this.stopPropagation();
  13018. }
  13019. };
  13020. // Includes all common event props including KeyEvent and MouseEvent specific props
  13021. jQuery.each( {
  13022. altKey: true,
  13023. bubbles: true,
  13024. cancelable: true,
  13025. changedTouches: true,
  13026. ctrlKey: true,
  13027. detail: true,
  13028. eventPhase: true,
  13029. metaKey: true,
  13030. pageX: true,
  13031. pageY: true,
  13032. shiftKey: true,
  13033. view: true,
  13034. "char": true,
  13035. code: true,
  13036. charCode: true,
  13037. key: true,
  13038. keyCode: true,
  13039. button: true,
  13040. buttons: true,
  13041. clientX: true,
  13042. clientY: true,
  13043. offsetX: true,
  13044. offsetY: true,
  13045. pointerId: true,
  13046. pointerType: true,
  13047. screenX: true,
  13048. screenY: true,
  13049. targetTouches: true,
  13050. toElement: true,
  13051. touches: true,
  13052. which: function( event ) {
  13053. var button = event.button;
  13054. // Add which for key events
  13055. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13056. return event.charCode != null ? event.charCode : event.keyCode;
  13057. }
  13058. // Add which for click: 1 === left; 2 === middle; 3 === right
  13059. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13060. if ( button & 1 ) {
  13061. return 1;
  13062. }
  13063. if ( button & 2 ) {
  13064. return 3;
  13065. }
  13066. if ( button & 4 ) {
  13067. return 2;
  13068. }
  13069. return 0;
  13070. }
  13071. return event.which;
  13072. }
  13073. }, jQuery.event.addProp );
  13074. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13075. jQuery.event.special[ type ] = {
  13076. // Utilize native event if possible so blur/focus sequence is correct
  13077. setup: function() {
  13078. // Claim the first handler
  13079. // dataPriv.set( this, "focus", ... )
  13080. // dataPriv.set( this, "blur", ... )
  13081. leverageNative( this, type, expectSync );
  13082. // Return false to allow normal processing in the caller
  13083. return false;
  13084. },
  13085. trigger: function() {
  13086. // Force setup before trigger
  13087. leverageNative( this, type );
  13088. // Return non-false to allow normal event-path propagation
  13089. return true;
  13090. },
  13091. delegateType: delegateType
  13092. };
  13093. } );
  13094. // Create mouseenter/leave events using mouseover/out and event-time checks
  13095. // so that event delegation works in jQuery.
  13096. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13097. //
  13098. // Support: Safari 7 only
  13099. // Safari sends mouseenter too often; see:
  13100. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13101. // for the description of the bug (it existed in older Chrome versions as well).
  13102. jQuery.each( {
  13103. mouseenter: "mouseover",
  13104. mouseleave: "mouseout",
  13105. pointerenter: "pointerover",
  13106. pointerleave: "pointerout"
  13107. }, function( orig, fix ) {
  13108. jQuery.event.special[ orig ] = {
  13109. delegateType: fix,
  13110. bindType: fix,
  13111. handle: function( event ) {
  13112. var ret,
  13113. target = this,
  13114. related = event.relatedTarget,
  13115. handleObj = event.handleObj;
  13116. // For mouseenter/leave call the handler if related is outside the target.
  13117. // NB: No relatedTarget if the mouse left/entered the browser window
  13118. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13119. event.type = handleObj.origType;
  13120. ret = handleObj.handler.apply( this, arguments );
  13121. event.type = fix;
  13122. }
  13123. return ret;
  13124. }
  13125. };
  13126. } );
  13127. jQuery.fn.extend( {
  13128. on: function( types, selector, data, fn ) {
  13129. return on( this, types, selector, data, fn );
  13130. },
  13131. one: function( types, selector, data, fn ) {
  13132. return on( this, types, selector, data, fn, 1 );
  13133. },
  13134. off: function( types, selector, fn ) {
  13135. var handleObj, type;
  13136. if ( types && types.preventDefault && types.handleObj ) {
  13137. // ( event ) dispatched jQuery.Event
  13138. handleObj = types.handleObj;
  13139. jQuery( types.delegateTarget ).off(
  13140. handleObj.namespace ?
  13141. handleObj.origType + "." + handleObj.namespace :
  13142. handleObj.origType,
  13143. handleObj.selector,
  13144. handleObj.handler
  13145. );
  13146. return this;
  13147. }
  13148. if ( typeof types === "object" ) {
  13149. // ( types-object [, selector] )
  13150. for ( type in types ) {
  13151. this.off( type, selector, types[ type ] );
  13152. }
  13153. return this;
  13154. }
  13155. if ( selector === false || typeof selector === "function" ) {
  13156. // ( types [, fn] )
  13157. fn = selector;
  13158. selector = undefined;
  13159. }
  13160. if ( fn === false ) {
  13161. fn = returnFalse;
  13162. }
  13163. return this.each( function() {
  13164. jQuery.event.remove( this, types, fn, selector );
  13165. } );
  13166. }
  13167. } );
  13168. var
  13169. /* eslint-disable max-len */
  13170. // See https://github.com/eslint/eslint/issues/3229
  13171. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13172. /* eslint-enable */
  13173. // Support: IE <=10 - 11, Edge 12 - 13 only
  13174. // In IE/Edge using regex groups here causes severe slowdowns.
  13175. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13176. rnoInnerhtml = /<script|<style|<link/i,
  13177. // checked="checked" or checked
  13178. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13179. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13180. // Prefer a tbody over its parent table for containing new rows
  13181. function manipulationTarget( elem, content ) {
  13182. if ( nodeName( elem, "table" ) &&
  13183. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13184. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13185. }
  13186. return elem;
  13187. }
  13188. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13189. function disableScript( elem ) {
  13190. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13191. return elem;
  13192. }
  13193. function restoreScript( elem ) {
  13194. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13195. elem.type = elem.type.slice( 5 );
  13196. } else {
  13197. elem.removeAttribute( "type" );
  13198. }
  13199. return elem;
  13200. }
  13201. function cloneCopyEvent( src, dest ) {
  13202. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13203. if ( dest.nodeType !== 1 ) {
  13204. return;
  13205. }
  13206. // 1. Copy private data: events, handlers, etc.
  13207. if ( dataPriv.hasData( src ) ) {
  13208. pdataOld = dataPriv.access( src );
  13209. pdataCur = dataPriv.set( dest, pdataOld );
  13210. events = pdataOld.events;
  13211. if ( events ) {
  13212. delete pdataCur.handle;
  13213. pdataCur.events = {};
  13214. for ( type in events ) {
  13215. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13216. jQuery.event.add( dest, type, events[ type ][ i ] );
  13217. }
  13218. }
  13219. }
  13220. }
  13221. // 2. Copy user data
  13222. if ( dataUser.hasData( src ) ) {
  13223. udataOld = dataUser.access( src );
  13224. udataCur = jQuery.extend( {}, udataOld );
  13225. dataUser.set( dest, udataCur );
  13226. }
  13227. }
  13228. // Fix IE bugs, see support tests
  13229. function fixInput( src, dest ) {
  13230. var nodeName = dest.nodeName.toLowerCase();
  13231. // Fails to persist the checked state of a cloned checkbox or radio button.
  13232. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13233. dest.checked = src.checked;
  13234. // Fails to return the selected option to the default selected state when cloning options
  13235. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13236. dest.defaultValue = src.defaultValue;
  13237. }
  13238. }
  13239. function domManip( collection, args, callback, ignored ) {
  13240. // Flatten any nested arrays
  13241. args = concat.apply( [], args );
  13242. var fragment, first, scripts, hasScripts, node, doc,
  13243. i = 0,
  13244. l = collection.length,
  13245. iNoClone = l - 1,
  13246. value = args[ 0 ],
  13247. valueIsFunction = isFunction( value );
  13248. // We can't cloneNode fragments that contain checked, in WebKit
  13249. if ( valueIsFunction ||
  13250. ( l > 1 && typeof value === "string" &&
  13251. !support.checkClone && rchecked.test( value ) ) ) {
  13252. return collection.each( function( index ) {
  13253. var self = collection.eq( index );
  13254. if ( valueIsFunction ) {
  13255. args[ 0 ] = value.call( this, index, self.html() );
  13256. }
  13257. domManip( self, args, callback, ignored );
  13258. } );
  13259. }
  13260. if ( l ) {
  13261. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13262. first = fragment.firstChild;
  13263. if ( fragment.childNodes.length === 1 ) {
  13264. fragment = first;
  13265. }
  13266. // Require either new content or an interest in ignored elements to invoke the callback
  13267. if ( first || ignored ) {
  13268. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13269. hasScripts = scripts.length;
  13270. // Use the original fragment for the last item
  13271. // instead of the first because it can end up
  13272. // being emptied incorrectly in certain situations (#8070).
  13273. for ( ; i < l; i++ ) {
  13274. node = fragment;
  13275. if ( i !== iNoClone ) {
  13276. node = jQuery.clone( node, true, true );
  13277. // Keep references to cloned scripts for later restoration
  13278. if ( hasScripts ) {
  13279. // Support: Android <=4.0 only, PhantomJS 1 only
  13280. // push.apply(_, arraylike) throws on ancient WebKit
  13281. jQuery.merge( scripts, getAll( node, "script" ) );
  13282. }
  13283. }
  13284. callback.call( collection[ i ], node, i );
  13285. }
  13286. if ( hasScripts ) {
  13287. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13288. // Reenable scripts
  13289. jQuery.map( scripts, restoreScript );
  13290. // Evaluate executable scripts on first document insertion
  13291. for ( i = 0; i < hasScripts; i++ ) {
  13292. node = scripts[ i ];
  13293. if ( rscriptType.test( node.type || "" ) &&
  13294. !dataPriv.access( node, "globalEval" ) &&
  13295. jQuery.contains( doc, node ) ) {
  13296. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13297. // Optional AJAX dependency, but won't run scripts if not present
  13298. if ( jQuery._evalUrl && !node.noModule ) {
  13299. jQuery._evalUrl( node.src, {
  13300. nonce: node.nonce || node.getAttribute( "nonce" )
  13301. } );
  13302. }
  13303. } else {
  13304. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13305. }
  13306. }
  13307. }
  13308. }
  13309. }
  13310. }
  13311. return collection;
  13312. }
  13313. function remove( elem, selector, keepData ) {
  13314. var node,
  13315. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13316. i = 0;
  13317. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13318. if ( !keepData && node.nodeType === 1 ) {
  13319. jQuery.cleanData( getAll( node ) );
  13320. }
  13321. if ( node.parentNode ) {
  13322. if ( keepData && isAttached( node ) ) {
  13323. setGlobalEval( getAll( node, "script" ) );
  13324. }
  13325. node.parentNode.removeChild( node );
  13326. }
  13327. }
  13328. return elem;
  13329. }
  13330. jQuery.extend( {
  13331. htmlPrefilter: function( html ) {
  13332. return html.replace( rxhtmlTag, "<$1></$2>" );
  13333. },
  13334. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13335. var i, l, srcElements, destElements,
  13336. clone = elem.cloneNode( true ),
  13337. inPage = isAttached( elem );
  13338. // Fix IE cloning issues
  13339. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13340. !jQuery.isXMLDoc( elem ) ) {
  13341. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13342. destElements = getAll( clone );
  13343. srcElements = getAll( elem );
  13344. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13345. fixInput( srcElements[ i ], destElements[ i ] );
  13346. }
  13347. }
  13348. // Copy the events from the original to the clone
  13349. if ( dataAndEvents ) {
  13350. if ( deepDataAndEvents ) {
  13351. srcElements = srcElements || getAll( elem );
  13352. destElements = destElements || getAll( clone );
  13353. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13354. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13355. }
  13356. } else {
  13357. cloneCopyEvent( elem, clone );
  13358. }
  13359. }
  13360. // Preserve script evaluation history
  13361. destElements = getAll( clone, "script" );
  13362. if ( destElements.length > 0 ) {
  13363. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13364. }
  13365. // Return the cloned set
  13366. return clone;
  13367. },
  13368. cleanData: function( elems ) {
  13369. var data, elem, type,
  13370. special = jQuery.event.special,
  13371. i = 0;
  13372. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13373. if ( acceptData( elem ) ) {
  13374. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13375. if ( data.events ) {
  13376. for ( type in data.events ) {
  13377. if ( special[ type ] ) {
  13378. jQuery.event.remove( elem, type );
  13379. // This is a shortcut to avoid jQuery.event.remove's overhead
  13380. } else {
  13381. jQuery.removeEvent( elem, type, data.handle );
  13382. }
  13383. }
  13384. }
  13385. // Support: Chrome <=35 - 45+
  13386. // Assign undefined instead of using delete, see Data#remove
  13387. elem[ dataPriv.expando ] = undefined;
  13388. }
  13389. if ( elem[ dataUser.expando ] ) {
  13390. // Support: Chrome <=35 - 45+
  13391. // Assign undefined instead of using delete, see Data#remove
  13392. elem[ dataUser.expando ] = undefined;
  13393. }
  13394. }
  13395. }
  13396. }
  13397. } );
  13398. jQuery.fn.extend( {
  13399. detach: function( selector ) {
  13400. return remove( this, selector, true );
  13401. },
  13402. remove: function( selector ) {
  13403. return remove( this, selector );
  13404. },
  13405. text: function( value ) {
  13406. return access( this, function( value ) {
  13407. return value === undefined ?
  13408. jQuery.text( this ) :
  13409. this.empty().each( function() {
  13410. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13411. this.textContent = value;
  13412. }
  13413. } );
  13414. }, null, value, arguments.length );
  13415. },
  13416. append: function() {
  13417. return domManip( this, arguments, function( elem ) {
  13418. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13419. var target = manipulationTarget( this, elem );
  13420. target.appendChild( elem );
  13421. }
  13422. } );
  13423. },
  13424. prepend: function() {
  13425. return domManip( this, arguments, function( elem ) {
  13426. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13427. var target = manipulationTarget( this, elem );
  13428. target.insertBefore( elem, target.firstChild );
  13429. }
  13430. } );
  13431. },
  13432. before: function() {
  13433. return domManip( this, arguments, function( elem ) {
  13434. if ( this.parentNode ) {
  13435. this.parentNode.insertBefore( elem, this );
  13436. }
  13437. } );
  13438. },
  13439. after: function() {
  13440. return domManip( this, arguments, function( elem ) {
  13441. if ( this.parentNode ) {
  13442. this.parentNode.insertBefore( elem, this.nextSibling );
  13443. }
  13444. } );
  13445. },
  13446. empty: function() {
  13447. var elem,
  13448. i = 0;
  13449. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13450. if ( elem.nodeType === 1 ) {
  13451. // Prevent memory leaks
  13452. jQuery.cleanData( getAll( elem, false ) );
  13453. // Remove any remaining nodes
  13454. elem.textContent = "";
  13455. }
  13456. }
  13457. return this;
  13458. },
  13459. clone: function( dataAndEvents, deepDataAndEvents ) {
  13460. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13461. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13462. return this.map( function() {
  13463. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13464. } );
  13465. },
  13466. html: function( value ) {
  13467. return access( this, function( value ) {
  13468. var elem = this[ 0 ] || {},
  13469. i = 0,
  13470. l = this.length;
  13471. if ( value === undefined && elem.nodeType === 1 ) {
  13472. return elem.innerHTML;
  13473. }
  13474. // See if we can take a shortcut and just use innerHTML
  13475. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13476. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13477. value = jQuery.htmlPrefilter( value );
  13478. try {
  13479. for ( ; i < l; i++ ) {
  13480. elem = this[ i ] || {};
  13481. // Remove element nodes and prevent memory leaks
  13482. if ( elem.nodeType === 1 ) {
  13483. jQuery.cleanData( getAll( elem, false ) );
  13484. elem.innerHTML = value;
  13485. }
  13486. }
  13487. elem = 0;
  13488. // If using innerHTML throws an exception, use the fallback method
  13489. } catch ( e ) {}
  13490. }
  13491. if ( elem ) {
  13492. this.empty().append( value );
  13493. }
  13494. }, null, value, arguments.length );
  13495. },
  13496. replaceWith: function() {
  13497. var ignored = [];
  13498. // Make the changes, replacing each non-ignored context element with the new content
  13499. return domManip( this, arguments, function( elem ) {
  13500. var parent = this.parentNode;
  13501. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13502. jQuery.cleanData( getAll( this ) );
  13503. if ( parent ) {
  13504. parent.replaceChild( elem, this );
  13505. }
  13506. }
  13507. // Force callback invocation
  13508. }, ignored );
  13509. }
  13510. } );
  13511. jQuery.each( {
  13512. appendTo: "append",
  13513. prependTo: "prepend",
  13514. insertBefore: "before",
  13515. insertAfter: "after",
  13516. replaceAll: "replaceWith"
  13517. }, function( name, original ) {
  13518. jQuery.fn[ name ] = function( selector ) {
  13519. var elems,
  13520. ret = [],
  13521. insert = jQuery( selector ),
  13522. last = insert.length - 1,
  13523. i = 0;
  13524. for ( ; i <= last; i++ ) {
  13525. elems = i === last ? this : this.clone( true );
  13526. jQuery( insert[ i ] )[ original ]( elems );
  13527. // Support: Android <=4.0 only, PhantomJS 1 only
  13528. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13529. push.apply( ret, elems.get() );
  13530. }
  13531. return this.pushStack( ret );
  13532. };
  13533. } );
  13534. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13535. var getStyles = function( elem ) {
  13536. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13537. // IE throws on elements created in popups
  13538. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13539. var view = elem.ownerDocument.defaultView;
  13540. if ( !view || !view.opener ) {
  13541. view = window;
  13542. }
  13543. return view.getComputedStyle( elem );
  13544. };
  13545. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13546. ( function() {
  13547. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13548. // so they're executed at the same time to save the second computation.
  13549. function computeStyleTests() {
  13550. // This is a singleton, we need to execute it only once
  13551. if ( !div ) {
  13552. return;
  13553. }
  13554. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13555. "margin-top:1px;padding:0;border:0";
  13556. div.style.cssText =
  13557. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13558. "margin:auto;border:1px;padding:1px;" +
  13559. "width:60%;top:1%";
  13560. documentElement.appendChild( container ).appendChild( div );
  13561. var divStyle = window.getComputedStyle( div );
  13562. pixelPositionVal = divStyle.top !== "1%";
  13563. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13564. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13565. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13566. // Some styles come back with percentage values, even though they shouldn't
  13567. div.style.right = "60%";
  13568. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13569. // Support: IE 9 - 11 only
  13570. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13571. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13572. // Support: IE 9 only
  13573. // Detect overflow:scroll screwiness (gh-3699)
  13574. // Support: Chrome <=64
  13575. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13576. div.style.position = "absolute";
  13577. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13578. documentElement.removeChild( container );
  13579. // Nullify the div so it wouldn't be stored in the memory and
  13580. // it will also be a sign that checks already performed
  13581. div = null;
  13582. }
  13583. function roundPixelMeasures( measure ) {
  13584. return Math.round( parseFloat( measure ) );
  13585. }
  13586. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13587. reliableMarginLeftVal,
  13588. container = document.createElement( "div" ),
  13589. div = document.createElement( "div" );
  13590. // Finish early in limited (non-browser) environments
  13591. if ( !div.style ) {
  13592. return;
  13593. }
  13594. // Support: IE <=9 - 11 only
  13595. // Style of cloned element affects source element cloned (#8908)
  13596. div.style.backgroundClip = "content-box";
  13597. div.cloneNode( true ).style.backgroundClip = "";
  13598. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13599. jQuery.extend( support, {
  13600. boxSizingReliable: function() {
  13601. computeStyleTests();
  13602. return boxSizingReliableVal;
  13603. },
  13604. pixelBoxStyles: function() {
  13605. computeStyleTests();
  13606. return pixelBoxStylesVal;
  13607. },
  13608. pixelPosition: function() {
  13609. computeStyleTests();
  13610. return pixelPositionVal;
  13611. },
  13612. reliableMarginLeft: function() {
  13613. computeStyleTests();
  13614. return reliableMarginLeftVal;
  13615. },
  13616. scrollboxSize: function() {
  13617. computeStyleTests();
  13618. return scrollboxSizeVal;
  13619. }
  13620. } );
  13621. } )();
  13622. function curCSS( elem, name, computed ) {
  13623. var width, minWidth, maxWidth, ret,
  13624. // Support: Firefox 51+
  13625. // Retrieving style before computed somehow
  13626. // fixes an issue with getting wrong values
  13627. // on detached elements
  13628. style = elem.style;
  13629. computed = computed || getStyles( elem );
  13630. // getPropertyValue is needed for:
  13631. // .css('filter') (IE 9 only, #12537)
  13632. // .css('--customProperty) (#3144)
  13633. if ( computed ) {
  13634. ret = computed.getPropertyValue( name ) || computed[ name ];
  13635. if ( ret === "" && !isAttached( elem ) ) {
  13636. ret = jQuery.style( elem, name );
  13637. }
  13638. // A tribute to the "awesome hack by Dean Edwards"
  13639. // Android Browser returns percentage for some values,
  13640. // but width seems to be reliably pixels.
  13641. // This is against the CSSOM draft spec:
  13642. // https://drafts.csswg.org/cssom/#resolved-values
  13643. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13644. // Remember the original values
  13645. width = style.width;
  13646. minWidth = style.minWidth;
  13647. maxWidth = style.maxWidth;
  13648. // Put in the new values to get a computed value out
  13649. style.minWidth = style.maxWidth = style.width = ret;
  13650. ret = computed.width;
  13651. // Revert the changed values
  13652. style.width = width;
  13653. style.minWidth = minWidth;
  13654. style.maxWidth = maxWidth;
  13655. }
  13656. }
  13657. return ret !== undefined ?
  13658. // Support: IE <=9 - 11 only
  13659. // IE returns zIndex value as an integer.
  13660. ret + "" :
  13661. ret;
  13662. }
  13663. function addGetHookIf( conditionFn, hookFn ) {
  13664. // Define the hook, we'll check on the first run if it's really needed.
  13665. return {
  13666. get: function() {
  13667. if ( conditionFn() ) {
  13668. // Hook not needed (or it's not possible to use it due
  13669. // to missing dependency), remove it.
  13670. delete this.get;
  13671. return;
  13672. }
  13673. // Hook needed; redefine it so that the support test is not executed again.
  13674. return ( this.get = hookFn ).apply( this, arguments );
  13675. }
  13676. };
  13677. }
  13678. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13679. emptyStyle = document.createElement( "div" ).style,
  13680. vendorProps = {};
  13681. // Return a vendor-prefixed property or undefined
  13682. function vendorPropName( name ) {
  13683. // Check for vendor prefixed names
  13684. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13685. i = cssPrefixes.length;
  13686. while ( i-- ) {
  13687. name = cssPrefixes[ i ] + capName;
  13688. if ( name in emptyStyle ) {
  13689. return name;
  13690. }
  13691. }
  13692. }
  13693. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13694. function finalPropName( name ) {
  13695. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13696. if ( final ) {
  13697. return final;
  13698. }
  13699. if ( name in emptyStyle ) {
  13700. return name;
  13701. }
  13702. return vendorProps[ name ] = vendorPropName( name ) || name;
  13703. }
  13704. var
  13705. // Swappable if display is none or starts with table
  13706. // except "table", "table-cell", or "table-caption"
  13707. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13708. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13709. rcustomProp = /^--/,
  13710. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13711. cssNormalTransform = {
  13712. letterSpacing: "0",
  13713. fontWeight: "400"
  13714. };
  13715. function setPositiveNumber( elem, value, subtract ) {
  13716. // Any relative (+/-) values have already been
  13717. // normalized at this point
  13718. var matches = rcssNum.exec( value );
  13719. return matches ?
  13720. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13721. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13722. value;
  13723. }
  13724. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13725. var i = dimension === "width" ? 1 : 0,
  13726. extra = 0,
  13727. delta = 0;
  13728. // Adjustment may not be necessary
  13729. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13730. return 0;
  13731. }
  13732. for ( ; i < 4; i += 2 ) {
  13733. // Both box models exclude margin
  13734. if ( box === "margin" ) {
  13735. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13736. }
  13737. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13738. if ( !isBorderBox ) {
  13739. // Add padding
  13740. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13741. // For "border" or "margin", add border
  13742. if ( box !== "padding" ) {
  13743. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13744. // But still keep track of it otherwise
  13745. } else {
  13746. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13747. }
  13748. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13749. // "padding" or "margin"
  13750. } else {
  13751. // For "content", subtract padding
  13752. if ( box === "content" ) {
  13753. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13754. }
  13755. // For "content" or "padding", subtract border
  13756. if ( box !== "margin" ) {
  13757. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13758. }
  13759. }
  13760. }
  13761. // Account for positive content-box scroll gutter when requested by providing computedVal
  13762. if ( !isBorderBox && computedVal >= 0 ) {
  13763. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13764. // Assuming integer scroll gutter, subtract the rest and round down
  13765. delta += Math.max( 0, Math.ceil(
  13766. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13767. computedVal -
  13768. delta -
  13769. extra -
  13770. 0.5
  13771. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13772. // Use an explicit zero to avoid NaN (gh-3964)
  13773. ) ) || 0;
  13774. }
  13775. return delta;
  13776. }
  13777. function getWidthOrHeight( elem, dimension, extra ) {
  13778. // Start with computed style
  13779. var styles = getStyles( elem ),
  13780. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13781. // Fake content-box until we know it's needed to know the true value.
  13782. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13783. isBorderBox = boxSizingNeeded &&
  13784. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13785. valueIsBorderBox = isBorderBox,
  13786. val = curCSS( elem, dimension, styles ),
  13787. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13788. // Support: Firefox <=54
  13789. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13790. if ( rnumnonpx.test( val ) ) {
  13791. if ( !extra ) {
  13792. return val;
  13793. }
  13794. val = "auto";
  13795. }
  13796. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13797. // This happens for inline elements with no explicit setting (gh-3571)
  13798. // Support: Android <=4.1 - 4.3 only
  13799. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13800. // Support: IE 9-11 only
  13801. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13802. // We use getClientRects() to check for hidden/disconnected.
  13803. // In those cases, the computed value can be trusted to be border-box
  13804. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13805. val === "auto" ||
  13806. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13807. elem.getClientRects().length ) {
  13808. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13809. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13810. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13811. // retrieved value as a content box dimension.
  13812. valueIsBorderBox = offsetProp in elem;
  13813. if ( valueIsBorderBox ) {
  13814. val = elem[ offsetProp ];
  13815. }
  13816. }
  13817. // Normalize "" and auto
  13818. val = parseFloat( val ) || 0;
  13819. // Adjust for the element's box model
  13820. return ( val +
  13821. boxModelAdjustment(
  13822. elem,
  13823. dimension,
  13824. extra || ( isBorderBox ? "border" : "content" ),
  13825. valueIsBorderBox,
  13826. styles,
  13827. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13828. val
  13829. )
  13830. ) + "px";
  13831. }
  13832. jQuery.extend( {
  13833. // Add in style property hooks for overriding the default
  13834. // behavior of getting and setting a style property
  13835. cssHooks: {
  13836. opacity: {
  13837. get: function( elem, computed ) {
  13838. if ( computed ) {
  13839. // We should always get a number back from opacity
  13840. var ret = curCSS( elem, "opacity" );
  13841. return ret === "" ? "1" : ret;
  13842. }
  13843. }
  13844. }
  13845. },
  13846. // Don't automatically add "px" to these possibly-unitless properties
  13847. cssNumber: {
  13848. "animationIterationCount": true,
  13849. "columnCount": true,
  13850. "fillOpacity": true,
  13851. "flexGrow": true,
  13852. "flexShrink": true,
  13853. "fontWeight": true,
  13854. "gridArea": true,
  13855. "gridColumn": true,
  13856. "gridColumnEnd": true,
  13857. "gridColumnStart": true,
  13858. "gridRow": true,
  13859. "gridRowEnd": true,
  13860. "gridRowStart": true,
  13861. "lineHeight": true,
  13862. "opacity": true,
  13863. "order": true,
  13864. "orphans": true,
  13865. "widows": true,
  13866. "zIndex": true,
  13867. "zoom": true
  13868. },
  13869. // Add in properties whose names you wish to fix before
  13870. // setting or getting the value
  13871. cssProps: {},
  13872. // Get and set the style property on a DOM Node
  13873. style: function( elem, name, value, extra ) {
  13874. // Don't set styles on text and comment nodes
  13875. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13876. return;
  13877. }
  13878. // Make sure that we're working with the right name
  13879. var ret, type, hooks,
  13880. origName = camelCase( name ),
  13881. isCustomProp = rcustomProp.test( name ),
  13882. style = elem.style;
  13883. // Make sure that we're working with the right name. We don't
  13884. // want to query the value if it is a CSS custom property
  13885. // since they are user-defined.
  13886. if ( !isCustomProp ) {
  13887. name = finalPropName( origName );
  13888. }
  13889. // Gets hook for the prefixed version, then unprefixed version
  13890. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13891. // Check if we're setting a value
  13892. if ( value !== undefined ) {
  13893. type = typeof value;
  13894. // Convert "+=" or "-=" to relative numbers (#7345)
  13895. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13896. value = adjustCSS( elem, name, ret );
  13897. // Fixes bug #9237
  13898. type = "number";
  13899. }
  13900. // Make sure that null and NaN values aren't set (#7116)
  13901. if ( value == null || value !== value ) {
  13902. return;
  13903. }
  13904. // If a number was passed in, add the unit (except for certain CSS properties)
  13905. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13906. // "px" to a few hardcoded values.
  13907. if ( type === "number" && !isCustomProp ) {
  13908. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  13909. }
  13910. // background-* props affect original clone's values
  13911. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  13912. style[ name ] = "inherit";
  13913. }
  13914. // If a hook was provided, use that value, otherwise just set the specified value
  13915. if ( !hooks || !( "set" in hooks ) ||
  13916. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  13917. if ( isCustomProp ) {
  13918. style.setProperty( name, value );
  13919. } else {
  13920. style[ name ] = value;
  13921. }
  13922. }
  13923. } else {
  13924. // If a hook was provided get the non-computed value from there
  13925. if ( hooks && "get" in hooks &&
  13926. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  13927. return ret;
  13928. }
  13929. // Otherwise just get the value from the style object
  13930. return style[ name ];
  13931. }
  13932. },
  13933. css: function( elem, name, extra, styles ) {
  13934. var val, num, hooks,
  13935. origName = camelCase( name ),
  13936. isCustomProp = rcustomProp.test( name );
  13937. // Make sure that we're working with the right name. We don't
  13938. // want to modify the value if it is a CSS custom property
  13939. // since they are user-defined.
  13940. if ( !isCustomProp ) {
  13941. name = finalPropName( origName );
  13942. }
  13943. // Try prefixed name followed by the unprefixed name
  13944. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13945. // If a hook was provided get the computed value from there
  13946. if ( hooks && "get" in hooks ) {
  13947. val = hooks.get( elem, true, extra );
  13948. }
  13949. // Otherwise, if a way to get the computed value exists, use that
  13950. if ( val === undefined ) {
  13951. val = curCSS( elem, name, styles );
  13952. }
  13953. // Convert "normal" to computed value
  13954. if ( val === "normal" && name in cssNormalTransform ) {
  13955. val = cssNormalTransform[ name ];
  13956. }
  13957. // Make numeric if forced or a qualifier was provided and val looks numeric
  13958. if ( extra === "" || extra ) {
  13959. num = parseFloat( val );
  13960. return extra === true || isFinite( num ) ? num || 0 : val;
  13961. }
  13962. return val;
  13963. }
  13964. } );
  13965. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  13966. jQuery.cssHooks[ dimension ] = {
  13967. get: function( elem, computed, extra ) {
  13968. if ( computed ) {
  13969. // Certain elements can have dimension info if we invisibly show them
  13970. // but it must have a current display style that would benefit
  13971. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  13972. // Support: Safari 8+
  13973. // Table columns in Safari have non-zero offsetWidth & zero
  13974. // getBoundingClientRect().width unless display is changed.
  13975. // Support: IE <=11 only
  13976. // Running getBoundingClientRect on a disconnected node
  13977. // in IE throws an error.
  13978. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  13979. swap( elem, cssShow, function() {
  13980. return getWidthOrHeight( elem, dimension, extra );
  13981. } ) :
  13982. getWidthOrHeight( elem, dimension, extra );
  13983. }
  13984. },
  13985. set: function( elem, value, extra ) {
  13986. var matches,
  13987. styles = getStyles( elem ),
  13988. // Only read styles.position if the test has a chance to fail
  13989. // to avoid forcing a reflow.
  13990. scrollboxSizeBuggy = !support.scrollboxSize() &&
  13991. styles.position === "absolute",
  13992. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  13993. boxSizingNeeded = scrollboxSizeBuggy || extra,
  13994. isBorderBox = boxSizingNeeded &&
  13995. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13996. subtract = extra ?
  13997. boxModelAdjustment(
  13998. elem,
  13999. dimension,
  14000. extra,
  14001. isBorderBox,
  14002. styles
  14003. ) :
  14004. 0;
  14005. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14006. // faking a content-box to get border and padding (gh-3699)
  14007. if ( isBorderBox && scrollboxSizeBuggy ) {
  14008. subtract -= Math.ceil(
  14009. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14010. parseFloat( styles[ dimension ] ) -
  14011. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14012. 0.5
  14013. );
  14014. }
  14015. // Convert to pixels if value adjustment is needed
  14016. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14017. ( matches[ 3 ] || "px" ) !== "px" ) {
  14018. elem.style[ dimension ] = value;
  14019. value = jQuery.css( elem, dimension );
  14020. }
  14021. return setPositiveNumber( elem, value, subtract );
  14022. }
  14023. };
  14024. } );
  14025. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14026. function( elem, computed ) {
  14027. if ( computed ) {
  14028. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14029. elem.getBoundingClientRect().left -
  14030. swap( elem, { marginLeft: 0 }, function() {
  14031. return elem.getBoundingClientRect().left;
  14032. } )
  14033. ) + "px";
  14034. }
  14035. }
  14036. );
  14037. // These hooks are used by animate to expand properties
  14038. jQuery.each( {
  14039. margin: "",
  14040. padding: "",
  14041. border: "Width"
  14042. }, function( prefix, suffix ) {
  14043. jQuery.cssHooks[ prefix + suffix ] = {
  14044. expand: function( value ) {
  14045. var i = 0,
  14046. expanded = {},
  14047. // Assumes a single number if not a string
  14048. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14049. for ( ; i < 4; i++ ) {
  14050. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14051. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14052. }
  14053. return expanded;
  14054. }
  14055. };
  14056. if ( prefix !== "margin" ) {
  14057. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14058. }
  14059. } );
  14060. jQuery.fn.extend( {
  14061. css: function( name, value ) {
  14062. return access( this, function( elem, name, value ) {
  14063. var styles, len,
  14064. map = {},
  14065. i = 0;
  14066. if ( Array.isArray( name ) ) {
  14067. styles = getStyles( elem );
  14068. len = name.length;
  14069. for ( ; i < len; i++ ) {
  14070. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14071. }
  14072. return map;
  14073. }
  14074. return value !== undefined ?
  14075. jQuery.style( elem, name, value ) :
  14076. jQuery.css( elem, name );
  14077. }, name, value, arguments.length > 1 );
  14078. }
  14079. } );
  14080. function Tween( elem, options, prop, end, easing ) {
  14081. return new Tween.prototype.init( elem, options, prop, end, easing );
  14082. }
  14083. jQuery.Tween = Tween;
  14084. Tween.prototype = {
  14085. constructor: Tween,
  14086. init: function( elem, options, prop, end, easing, unit ) {
  14087. this.elem = elem;
  14088. this.prop = prop;
  14089. this.easing = easing || jQuery.easing._default;
  14090. this.options = options;
  14091. this.start = this.now = this.cur();
  14092. this.end = end;
  14093. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14094. },
  14095. cur: function() {
  14096. var hooks = Tween.propHooks[ this.prop ];
  14097. return hooks && hooks.get ?
  14098. hooks.get( this ) :
  14099. Tween.propHooks._default.get( this );
  14100. },
  14101. run: function( percent ) {
  14102. var eased,
  14103. hooks = Tween.propHooks[ this.prop ];
  14104. if ( this.options.duration ) {
  14105. this.pos = eased = jQuery.easing[ this.easing ](
  14106. percent, this.options.duration * percent, 0, 1, this.options.duration
  14107. );
  14108. } else {
  14109. this.pos = eased = percent;
  14110. }
  14111. this.now = ( this.end - this.start ) * eased + this.start;
  14112. if ( this.options.step ) {
  14113. this.options.step.call( this.elem, this.now, this );
  14114. }
  14115. if ( hooks && hooks.set ) {
  14116. hooks.set( this );
  14117. } else {
  14118. Tween.propHooks._default.set( this );
  14119. }
  14120. return this;
  14121. }
  14122. };
  14123. Tween.prototype.init.prototype = Tween.prototype;
  14124. Tween.propHooks = {
  14125. _default: {
  14126. get: function( tween ) {
  14127. var result;
  14128. // Use a property on the element directly when it is not a DOM element,
  14129. // or when there is no matching style property that exists.
  14130. if ( tween.elem.nodeType !== 1 ||
  14131. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14132. return tween.elem[ tween.prop ];
  14133. }
  14134. // Passing an empty string as a 3rd parameter to .css will automatically
  14135. // attempt a parseFloat and fallback to a string if the parse fails.
  14136. // Simple values such as "10px" are parsed to Float;
  14137. // complex values such as "rotate(1rad)" are returned as-is.
  14138. result = jQuery.css( tween.elem, tween.prop, "" );
  14139. // Empty strings, null, undefined and "auto" are converted to 0.
  14140. return !result || result === "auto" ? 0 : result;
  14141. },
  14142. set: function( tween ) {
  14143. // Use step hook for back compat.
  14144. // Use cssHook if its there.
  14145. // Use .style if available and use plain properties where available.
  14146. if ( jQuery.fx.step[ tween.prop ] ) {
  14147. jQuery.fx.step[ tween.prop ]( tween );
  14148. } else if ( tween.elem.nodeType === 1 && (
  14149. jQuery.cssHooks[ tween.prop ] ||
  14150. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14151. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14152. } else {
  14153. tween.elem[ tween.prop ] = tween.now;
  14154. }
  14155. }
  14156. }
  14157. };
  14158. // Support: IE <=9 only
  14159. // Panic based approach to setting things on disconnected nodes
  14160. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14161. set: function( tween ) {
  14162. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14163. tween.elem[ tween.prop ] = tween.now;
  14164. }
  14165. }
  14166. };
  14167. jQuery.easing = {
  14168. linear: function( p ) {
  14169. return p;
  14170. },
  14171. swing: function( p ) {
  14172. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14173. },
  14174. _default: "swing"
  14175. };
  14176. jQuery.fx = Tween.prototype.init;
  14177. // Back compat <1.8 extension point
  14178. jQuery.fx.step = {};
  14179. var
  14180. fxNow, inProgress,
  14181. rfxtypes = /^(?:toggle|show|hide)$/,
  14182. rrun = /queueHooks$/;
  14183. function schedule() {
  14184. if ( inProgress ) {
  14185. if ( document.hidden === false && window.requestAnimationFrame ) {
  14186. window.requestAnimationFrame( schedule );
  14187. } else {
  14188. window.setTimeout( schedule, jQuery.fx.interval );
  14189. }
  14190. jQuery.fx.tick();
  14191. }
  14192. }
  14193. // Animations created synchronously will run synchronously
  14194. function createFxNow() {
  14195. window.setTimeout( function() {
  14196. fxNow = undefined;
  14197. } );
  14198. return ( fxNow = Date.now() );
  14199. }
  14200. // Generate parameters to create a standard animation
  14201. function genFx( type, includeWidth ) {
  14202. var which,
  14203. i = 0,
  14204. attrs = { height: type };
  14205. // If we include width, step value is 1 to do all cssExpand values,
  14206. // otherwise step value is 2 to skip over Left and Right
  14207. includeWidth = includeWidth ? 1 : 0;
  14208. for ( ; i < 4; i += 2 - includeWidth ) {
  14209. which = cssExpand[ i ];
  14210. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14211. }
  14212. if ( includeWidth ) {
  14213. attrs.opacity = attrs.width = type;
  14214. }
  14215. return attrs;
  14216. }
  14217. function createTween( value, prop, animation ) {
  14218. var tween,
  14219. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14220. index = 0,
  14221. length = collection.length;
  14222. for ( ; index < length; index++ ) {
  14223. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14224. // We're done with this property
  14225. return tween;
  14226. }
  14227. }
  14228. }
  14229. function defaultPrefilter( elem, props, opts ) {
  14230. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14231. isBox = "width" in props || "height" in props,
  14232. anim = this,
  14233. orig = {},
  14234. style = elem.style,
  14235. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14236. dataShow = dataPriv.get( elem, "fxshow" );
  14237. // Queue-skipping animations hijack the fx hooks
  14238. if ( !opts.queue ) {
  14239. hooks = jQuery._queueHooks( elem, "fx" );
  14240. if ( hooks.unqueued == null ) {
  14241. hooks.unqueued = 0;
  14242. oldfire = hooks.empty.fire;
  14243. hooks.empty.fire = function() {
  14244. if ( !hooks.unqueued ) {
  14245. oldfire();
  14246. }
  14247. };
  14248. }
  14249. hooks.unqueued++;
  14250. anim.always( function() {
  14251. // Ensure the complete handler is called before this completes
  14252. anim.always( function() {
  14253. hooks.unqueued--;
  14254. if ( !jQuery.queue( elem, "fx" ).length ) {
  14255. hooks.empty.fire();
  14256. }
  14257. } );
  14258. } );
  14259. }
  14260. // Detect show/hide animations
  14261. for ( prop in props ) {
  14262. value = props[ prop ];
  14263. if ( rfxtypes.test( value ) ) {
  14264. delete props[ prop ];
  14265. toggle = toggle || value === "toggle";
  14266. if ( value === ( hidden ? "hide" : "show" ) ) {
  14267. // Pretend to be hidden if this is a "show" and
  14268. // there is still data from a stopped show/hide
  14269. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14270. hidden = true;
  14271. // Ignore all other no-op show/hide data
  14272. } else {
  14273. continue;
  14274. }
  14275. }
  14276. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14277. }
  14278. }
  14279. // Bail out if this is a no-op like .hide().hide()
  14280. propTween = !jQuery.isEmptyObject( props );
  14281. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14282. return;
  14283. }
  14284. // Restrict "overflow" and "display" styles during box animations
  14285. if ( isBox && elem.nodeType === 1 ) {
  14286. // Support: IE <=9 - 11, Edge 12 - 15
  14287. // Record all 3 overflow attributes because IE does not infer the shorthand
  14288. // from identically-valued overflowX and overflowY and Edge just mirrors
  14289. // the overflowX value there.
  14290. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14291. // Identify a display type, preferring old show/hide data over the CSS cascade
  14292. restoreDisplay = dataShow && dataShow.display;
  14293. if ( restoreDisplay == null ) {
  14294. restoreDisplay = dataPriv.get( elem, "display" );
  14295. }
  14296. display = jQuery.css( elem, "display" );
  14297. if ( display === "none" ) {
  14298. if ( restoreDisplay ) {
  14299. display = restoreDisplay;
  14300. } else {
  14301. // Get nonempty value(s) by temporarily forcing visibility
  14302. showHide( [ elem ], true );
  14303. restoreDisplay = elem.style.display || restoreDisplay;
  14304. display = jQuery.css( elem, "display" );
  14305. showHide( [ elem ] );
  14306. }
  14307. }
  14308. // Animate inline elements as inline-block
  14309. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14310. if ( jQuery.css( elem, "float" ) === "none" ) {
  14311. // Restore the original display value at the end of pure show/hide animations
  14312. if ( !propTween ) {
  14313. anim.done( function() {
  14314. style.display = restoreDisplay;
  14315. } );
  14316. if ( restoreDisplay == null ) {
  14317. display = style.display;
  14318. restoreDisplay = display === "none" ? "" : display;
  14319. }
  14320. }
  14321. style.display = "inline-block";
  14322. }
  14323. }
  14324. }
  14325. if ( opts.overflow ) {
  14326. style.overflow = "hidden";
  14327. anim.always( function() {
  14328. style.overflow = opts.overflow[ 0 ];
  14329. style.overflowX = opts.overflow[ 1 ];
  14330. style.overflowY = opts.overflow[ 2 ];
  14331. } );
  14332. }
  14333. // Implement show/hide animations
  14334. propTween = false;
  14335. for ( prop in orig ) {
  14336. // General show/hide setup for this element animation
  14337. if ( !propTween ) {
  14338. if ( dataShow ) {
  14339. if ( "hidden" in dataShow ) {
  14340. hidden = dataShow.hidden;
  14341. }
  14342. } else {
  14343. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14344. }
  14345. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14346. if ( toggle ) {
  14347. dataShow.hidden = !hidden;
  14348. }
  14349. // Show elements before animating them
  14350. if ( hidden ) {
  14351. showHide( [ elem ], true );
  14352. }
  14353. /* eslint-disable no-loop-func */
  14354. anim.done( function() {
  14355. /* eslint-enable no-loop-func */
  14356. // The final step of a "hide" animation is actually hiding the element
  14357. if ( !hidden ) {
  14358. showHide( [ elem ] );
  14359. }
  14360. dataPriv.remove( elem, "fxshow" );
  14361. for ( prop in orig ) {
  14362. jQuery.style( elem, prop, orig[ prop ] );
  14363. }
  14364. } );
  14365. }
  14366. // Per-property setup
  14367. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14368. if ( !( prop in dataShow ) ) {
  14369. dataShow[ prop ] = propTween.start;
  14370. if ( hidden ) {
  14371. propTween.end = propTween.start;
  14372. propTween.start = 0;
  14373. }
  14374. }
  14375. }
  14376. }
  14377. function propFilter( props, specialEasing ) {
  14378. var index, name, easing, value, hooks;
  14379. // camelCase, specialEasing and expand cssHook pass
  14380. for ( index in props ) {
  14381. name = camelCase( index );
  14382. easing = specialEasing[ name ];
  14383. value = props[ index ];
  14384. if ( Array.isArray( value ) ) {
  14385. easing = value[ 1 ];
  14386. value = props[ index ] = value[ 0 ];
  14387. }
  14388. if ( index !== name ) {
  14389. props[ name ] = value;
  14390. delete props[ index ];
  14391. }
  14392. hooks = jQuery.cssHooks[ name ];
  14393. if ( hooks && "expand" in hooks ) {
  14394. value = hooks.expand( value );
  14395. delete props[ name ];
  14396. // Not quite $.extend, this won't overwrite existing keys.
  14397. // Reusing 'index' because we have the correct "name"
  14398. for ( index in value ) {
  14399. if ( !( index in props ) ) {
  14400. props[ index ] = value[ index ];
  14401. specialEasing[ index ] = easing;
  14402. }
  14403. }
  14404. } else {
  14405. specialEasing[ name ] = easing;
  14406. }
  14407. }
  14408. }
  14409. function Animation( elem, properties, options ) {
  14410. var result,
  14411. stopped,
  14412. index = 0,
  14413. length = Animation.prefilters.length,
  14414. deferred = jQuery.Deferred().always( function() {
  14415. // Don't match elem in the :animated selector
  14416. delete tick.elem;
  14417. } ),
  14418. tick = function() {
  14419. if ( stopped ) {
  14420. return false;
  14421. }
  14422. var currentTime = fxNow || createFxNow(),
  14423. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14424. // Support: Android 2.3 only
  14425. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14426. temp = remaining / animation.duration || 0,
  14427. percent = 1 - temp,
  14428. index = 0,
  14429. length = animation.tweens.length;
  14430. for ( ; index < length; index++ ) {
  14431. animation.tweens[ index ].run( percent );
  14432. }
  14433. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14434. // If there's more to do, yield
  14435. if ( percent < 1 && length ) {
  14436. return remaining;
  14437. }
  14438. // If this was an empty animation, synthesize a final progress notification
  14439. if ( !length ) {
  14440. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14441. }
  14442. // Resolve the animation and report its conclusion
  14443. deferred.resolveWith( elem, [ animation ] );
  14444. return false;
  14445. },
  14446. animation = deferred.promise( {
  14447. elem: elem,
  14448. props: jQuery.extend( {}, properties ),
  14449. opts: jQuery.extend( true, {
  14450. specialEasing: {},
  14451. easing: jQuery.easing._default
  14452. }, options ),
  14453. originalProperties: properties,
  14454. originalOptions: options,
  14455. startTime: fxNow || createFxNow(),
  14456. duration: options.duration,
  14457. tweens: [],
  14458. createTween: function( prop, end ) {
  14459. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14460. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14461. animation.tweens.push( tween );
  14462. return tween;
  14463. },
  14464. stop: function( gotoEnd ) {
  14465. var index = 0,
  14466. // If we are going to the end, we want to run all the tweens
  14467. // otherwise we skip this part
  14468. length = gotoEnd ? animation.tweens.length : 0;
  14469. if ( stopped ) {
  14470. return this;
  14471. }
  14472. stopped = true;
  14473. for ( ; index < length; index++ ) {
  14474. animation.tweens[ index ].run( 1 );
  14475. }
  14476. // Resolve when we played the last frame; otherwise, reject
  14477. if ( gotoEnd ) {
  14478. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14479. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14480. } else {
  14481. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14482. }
  14483. return this;
  14484. }
  14485. } ),
  14486. props = animation.props;
  14487. propFilter( props, animation.opts.specialEasing );
  14488. for ( ; index < length; index++ ) {
  14489. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14490. if ( result ) {
  14491. if ( isFunction( result.stop ) ) {
  14492. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14493. result.stop.bind( result );
  14494. }
  14495. return result;
  14496. }
  14497. }
  14498. jQuery.map( props, createTween, animation );
  14499. if ( isFunction( animation.opts.start ) ) {
  14500. animation.opts.start.call( elem, animation );
  14501. }
  14502. // Attach callbacks from options
  14503. animation
  14504. .progress( animation.opts.progress )
  14505. .done( animation.opts.done, animation.opts.complete )
  14506. .fail( animation.opts.fail )
  14507. .always( animation.opts.always );
  14508. jQuery.fx.timer(
  14509. jQuery.extend( tick, {
  14510. elem: elem,
  14511. anim: animation,
  14512. queue: animation.opts.queue
  14513. } )
  14514. );
  14515. return animation;
  14516. }
  14517. jQuery.Animation = jQuery.extend( Animation, {
  14518. tweeners: {
  14519. "*": [ function( prop, value ) {
  14520. var tween = this.createTween( prop, value );
  14521. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14522. return tween;
  14523. } ]
  14524. },
  14525. tweener: function( props, callback ) {
  14526. if ( isFunction( props ) ) {
  14527. callback = props;
  14528. props = [ "*" ];
  14529. } else {
  14530. props = props.match( rnothtmlwhite );
  14531. }
  14532. var prop,
  14533. index = 0,
  14534. length = props.length;
  14535. for ( ; index < length; index++ ) {
  14536. prop = props[ index ];
  14537. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14538. Animation.tweeners[ prop ].unshift( callback );
  14539. }
  14540. },
  14541. prefilters: [ defaultPrefilter ],
  14542. prefilter: function( callback, prepend ) {
  14543. if ( prepend ) {
  14544. Animation.prefilters.unshift( callback );
  14545. } else {
  14546. Animation.prefilters.push( callback );
  14547. }
  14548. }
  14549. } );
  14550. jQuery.speed = function( speed, easing, fn ) {
  14551. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14552. complete: fn || !fn && easing ||
  14553. isFunction( speed ) && speed,
  14554. duration: speed,
  14555. easing: fn && easing || easing && !isFunction( easing ) && easing
  14556. };
  14557. // Go to the end state if fx are off
  14558. if ( jQuery.fx.off ) {
  14559. opt.duration = 0;
  14560. } else {
  14561. if ( typeof opt.duration !== "number" ) {
  14562. if ( opt.duration in jQuery.fx.speeds ) {
  14563. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14564. } else {
  14565. opt.duration = jQuery.fx.speeds._default;
  14566. }
  14567. }
  14568. }
  14569. // Normalize opt.queue - true/undefined/null -> "fx"
  14570. if ( opt.queue == null || opt.queue === true ) {
  14571. opt.queue = "fx";
  14572. }
  14573. // Queueing
  14574. opt.old = opt.complete;
  14575. opt.complete = function() {
  14576. if ( isFunction( opt.old ) ) {
  14577. opt.old.call( this );
  14578. }
  14579. if ( opt.queue ) {
  14580. jQuery.dequeue( this, opt.queue );
  14581. }
  14582. };
  14583. return opt;
  14584. };
  14585. jQuery.fn.extend( {
  14586. fadeTo: function( speed, to, easing, callback ) {
  14587. // Show any hidden elements after setting opacity to 0
  14588. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14589. // Animate to the value specified
  14590. .end().animate( { opacity: to }, speed, easing, callback );
  14591. },
  14592. animate: function( prop, speed, easing, callback ) {
  14593. var empty = jQuery.isEmptyObject( prop ),
  14594. optall = jQuery.speed( speed, easing, callback ),
  14595. doAnimation = function() {
  14596. // Operate on a copy of prop so per-property easing won't be lost
  14597. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14598. // Empty animations, or finishing resolves immediately
  14599. if ( empty || dataPriv.get( this, "finish" ) ) {
  14600. anim.stop( true );
  14601. }
  14602. };
  14603. doAnimation.finish = doAnimation;
  14604. return empty || optall.queue === false ?
  14605. this.each( doAnimation ) :
  14606. this.queue( optall.queue, doAnimation );
  14607. },
  14608. stop: function( type, clearQueue, gotoEnd ) {
  14609. var stopQueue = function( hooks ) {
  14610. var stop = hooks.stop;
  14611. delete hooks.stop;
  14612. stop( gotoEnd );
  14613. };
  14614. if ( typeof type !== "string" ) {
  14615. gotoEnd = clearQueue;
  14616. clearQueue = type;
  14617. type = undefined;
  14618. }
  14619. if ( clearQueue && type !== false ) {
  14620. this.queue( type || "fx", [] );
  14621. }
  14622. return this.each( function() {
  14623. var dequeue = true,
  14624. index = type != null && type + "queueHooks",
  14625. timers = jQuery.timers,
  14626. data = dataPriv.get( this );
  14627. if ( index ) {
  14628. if ( data[ index ] && data[ index ].stop ) {
  14629. stopQueue( data[ index ] );
  14630. }
  14631. } else {
  14632. for ( index in data ) {
  14633. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14634. stopQueue( data[ index ] );
  14635. }
  14636. }
  14637. }
  14638. for ( index = timers.length; index--; ) {
  14639. if ( timers[ index ].elem === this &&
  14640. ( type == null || timers[ index ].queue === type ) ) {
  14641. timers[ index ].anim.stop( gotoEnd );
  14642. dequeue = false;
  14643. timers.splice( index, 1 );
  14644. }
  14645. }
  14646. // Start the next in the queue if the last step wasn't forced.
  14647. // Timers currently will call their complete callbacks, which
  14648. // will dequeue but only if they were gotoEnd.
  14649. if ( dequeue || !gotoEnd ) {
  14650. jQuery.dequeue( this, type );
  14651. }
  14652. } );
  14653. },
  14654. finish: function( type ) {
  14655. if ( type !== false ) {
  14656. type = type || "fx";
  14657. }
  14658. return this.each( function() {
  14659. var index,
  14660. data = dataPriv.get( this ),
  14661. queue = data[ type + "queue" ],
  14662. hooks = data[ type + "queueHooks" ],
  14663. timers = jQuery.timers,
  14664. length = queue ? queue.length : 0;
  14665. // Enable finishing flag on private data
  14666. data.finish = true;
  14667. // Empty the queue first
  14668. jQuery.queue( this, type, [] );
  14669. if ( hooks && hooks.stop ) {
  14670. hooks.stop.call( this, true );
  14671. }
  14672. // Look for any active animations, and finish them
  14673. for ( index = timers.length; index--; ) {
  14674. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14675. timers[ index ].anim.stop( true );
  14676. timers.splice( index, 1 );
  14677. }
  14678. }
  14679. // Look for any animations in the old queue and finish them
  14680. for ( index = 0; index < length; index++ ) {
  14681. if ( queue[ index ] && queue[ index ].finish ) {
  14682. queue[ index ].finish.call( this );
  14683. }
  14684. }
  14685. // Turn off finishing flag
  14686. delete data.finish;
  14687. } );
  14688. }
  14689. } );
  14690. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14691. var cssFn = jQuery.fn[ name ];
  14692. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14693. return speed == null || typeof speed === "boolean" ?
  14694. cssFn.apply( this, arguments ) :
  14695. this.animate( genFx( name, true ), speed, easing, callback );
  14696. };
  14697. } );
  14698. // Generate shortcuts for custom animations
  14699. jQuery.each( {
  14700. slideDown: genFx( "show" ),
  14701. slideUp: genFx( "hide" ),
  14702. slideToggle: genFx( "toggle" ),
  14703. fadeIn: { opacity: "show" },
  14704. fadeOut: { opacity: "hide" },
  14705. fadeToggle: { opacity: "toggle" }
  14706. }, function( name, props ) {
  14707. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14708. return this.animate( props, speed, easing, callback );
  14709. };
  14710. } );
  14711. jQuery.timers = [];
  14712. jQuery.fx.tick = function() {
  14713. var timer,
  14714. i = 0,
  14715. timers = jQuery.timers;
  14716. fxNow = Date.now();
  14717. for ( ; i < timers.length; i++ ) {
  14718. timer = timers[ i ];
  14719. // Run the timer and safely remove it when done (allowing for external removal)
  14720. if ( !timer() && timers[ i ] === timer ) {
  14721. timers.splice( i--, 1 );
  14722. }
  14723. }
  14724. if ( !timers.length ) {
  14725. jQuery.fx.stop();
  14726. }
  14727. fxNow = undefined;
  14728. };
  14729. jQuery.fx.timer = function( timer ) {
  14730. jQuery.timers.push( timer );
  14731. jQuery.fx.start();
  14732. };
  14733. jQuery.fx.interval = 13;
  14734. jQuery.fx.start = function() {
  14735. if ( inProgress ) {
  14736. return;
  14737. }
  14738. inProgress = true;
  14739. schedule();
  14740. };
  14741. jQuery.fx.stop = function() {
  14742. inProgress = null;
  14743. };
  14744. jQuery.fx.speeds = {
  14745. slow: 600,
  14746. fast: 200,
  14747. // Default speed
  14748. _default: 400
  14749. };
  14750. // Based off of the plugin by Clint Helfers, with permission.
  14751. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14752. jQuery.fn.delay = function( time, type ) {
  14753. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14754. type = type || "fx";
  14755. return this.queue( type, function( next, hooks ) {
  14756. var timeout = window.setTimeout( next, time );
  14757. hooks.stop = function() {
  14758. window.clearTimeout( timeout );
  14759. };
  14760. } );
  14761. };
  14762. ( function() {
  14763. var input = document.createElement( "input" ),
  14764. select = document.createElement( "select" ),
  14765. opt = select.appendChild( document.createElement( "option" ) );
  14766. input.type = "checkbox";
  14767. // Support: Android <=4.3 only
  14768. // Default value for a checkbox should be "on"
  14769. support.checkOn = input.value !== "";
  14770. // Support: IE <=11 only
  14771. // Must access selectedIndex to make default options select
  14772. support.optSelected = opt.selected;
  14773. // Support: IE <=11 only
  14774. // An input loses its value after becoming a radio
  14775. input = document.createElement( "input" );
  14776. input.value = "t";
  14777. input.type = "radio";
  14778. support.radioValue = input.value === "t";
  14779. } )();
  14780. var boolHook,
  14781. attrHandle = jQuery.expr.attrHandle;
  14782. jQuery.fn.extend( {
  14783. attr: function( name, value ) {
  14784. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14785. },
  14786. removeAttr: function( name ) {
  14787. return this.each( function() {
  14788. jQuery.removeAttr( this, name );
  14789. } );
  14790. }
  14791. } );
  14792. jQuery.extend( {
  14793. attr: function( elem, name, value ) {
  14794. var ret, hooks,
  14795. nType = elem.nodeType;
  14796. // Don't get/set attributes on text, comment and attribute nodes
  14797. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14798. return;
  14799. }
  14800. // Fallback to prop when attributes are not supported
  14801. if ( typeof elem.getAttribute === "undefined" ) {
  14802. return jQuery.prop( elem, name, value );
  14803. }
  14804. // Attribute hooks are determined by the lowercase version
  14805. // Grab necessary hook if one is defined
  14806. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14807. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14808. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14809. }
  14810. if ( value !== undefined ) {
  14811. if ( value === null ) {
  14812. jQuery.removeAttr( elem, name );
  14813. return;
  14814. }
  14815. if ( hooks && "set" in hooks &&
  14816. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14817. return ret;
  14818. }
  14819. elem.setAttribute( name, value + "" );
  14820. return value;
  14821. }
  14822. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14823. return ret;
  14824. }
  14825. ret = jQuery.find.attr( elem, name );
  14826. // Non-existent attributes return null, we normalize to undefined
  14827. return ret == null ? undefined : ret;
  14828. },
  14829. attrHooks: {
  14830. type: {
  14831. set: function( elem, value ) {
  14832. if ( !support.radioValue && value === "radio" &&
  14833. nodeName( elem, "input" ) ) {
  14834. var val = elem.value;
  14835. elem.setAttribute( "type", value );
  14836. if ( val ) {
  14837. elem.value = val;
  14838. }
  14839. return value;
  14840. }
  14841. }
  14842. }
  14843. },
  14844. removeAttr: function( elem, value ) {
  14845. var name,
  14846. i = 0,
  14847. // Attribute names can contain non-HTML whitespace characters
  14848. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14849. attrNames = value && value.match( rnothtmlwhite );
  14850. if ( attrNames && elem.nodeType === 1 ) {
  14851. while ( ( name = attrNames[ i++ ] ) ) {
  14852. elem.removeAttribute( name );
  14853. }
  14854. }
  14855. }
  14856. } );
  14857. // Hooks for boolean attributes
  14858. boolHook = {
  14859. set: function( elem, value, name ) {
  14860. if ( value === false ) {
  14861. // Remove boolean attributes when set to false
  14862. jQuery.removeAttr( elem, name );
  14863. } else {
  14864. elem.setAttribute( name, name );
  14865. }
  14866. return name;
  14867. }
  14868. };
  14869. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14870. var getter = attrHandle[ name ] || jQuery.find.attr;
  14871. attrHandle[ name ] = function( elem, name, isXML ) {
  14872. var ret, handle,
  14873. lowercaseName = name.toLowerCase();
  14874. if ( !isXML ) {
  14875. // Avoid an infinite loop by temporarily removing this function from the getter
  14876. handle = attrHandle[ lowercaseName ];
  14877. attrHandle[ lowercaseName ] = ret;
  14878. ret = getter( elem, name, isXML ) != null ?
  14879. lowercaseName :
  14880. null;
  14881. attrHandle[ lowercaseName ] = handle;
  14882. }
  14883. return ret;
  14884. };
  14885. } );
  14886. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14887. rclickable = /^(?:a|area)$/i;
  14888. jQuery.fn.extend( {
  14889. prop: function( name, value ) {
  14890. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14891. },
  14892. removeProp: function( name ) {
  14893. return this.each( function() {
  14894. delete this[ jQuery.propFix[ name ] || name ];
  14895. } );
  14896. }
  14897. } );
  14898. jQuery.extend( {
  14899. prop: function( elem, name, value ) {
  14900. var ret, hooks,
  14901. nType = elem.nodeType;
  14902. // Don't get/set properties on text, comment and attribute nodes
  14903. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14904. return;
  14905. }
  14906. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14907. // Fix name and attach hooks
  14908. name = jQuery.propFix[ name ] || name;
  14909. hooks = jQuery.propHooks[ name ];
  14910. }
  14911. if ( value !== undefined ) {
  14912. if ( hooks && "set" in hooks &&
  14913. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14914. return ret;
  14915. }
  14916. return ( elem[ name ] = value );
  14917. }
  14918. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14919. return ret;
  14920. }
  14921. return elem[ name ];
  14922. },
  14923. propHooks: {
  14924. tabIndex: {
  14925. get: function( elem ) {
  14926. // Support: IE <=9 - 11 only
  14927. // elem.tabIndex doesn't always return the
  14928. // correct value when it hasn't been explicitly set
  14929. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  14930. // Use proper attribute retrieval(#12072)
  14931. var tabindex = jQuery.find.attr( elem, "tabindex" );
  14932. if ( tabindex ) {
  14933. return parseInt( tabindex, 10 );
  14934. }
  14935. if (
  14936. rfocusable.test( elem.nodeName ) ||
  14937. rclickable.test( elem.nodeName ) &&
  14938. elem.href
  14939. ) {
  14940. return 0;
  14941. }
  14942. return -1;
  14943. }
  14944. }
  14945. },
  14946. propFix: {
  14947. "for": "htmlFor",
  14948. "class": "className"
  14949. }
  14950. } );
  14951. // Support: IE <=11 only
  14952. // Accessing the selectedIndex property
  14953. // forces the browser to respect setting selected
  14954. // on the option
  14955. // The getter ensures a default option is selected
  14956. // when in an optgroup
  14957. // eslint rule "no-unused-expressions" is disabled for this code
  14958. // since it considers such accessions noop
  14959. if ( !support.optSelected ) {
  14960. jQuery.propHooks.selected = {
  14961. get: function( elem ) {
  14962. /* eslint no-unused-expressions: "off" */
  14963. var parent = elem.parentNode;
  14964. if ( parent && parent.parentNode ) {
  14965. parent.parentNode.selectedIndex;
  14966. }
  14967. return null;
  14968. },
  14969. set: function( elem ) {
  14970. /* eslint no-unused-expressions: "off" */
  14971. var parent = elem.parentNode;
  14972. if ( parent ) {
  14973. parent.selectedIndex;
  14974. if ( parent.parentNode ) {
  14975. parent.parentNode.selectedIndex;
  14976. }
  14977. }
  14978. }
  14979. };
  14980. }
  14981. jQuery.each( [
  14982. "tabIndex",
  14983. "readOnly",
  14984. "maxLength",
  14985. "cellSpacing",
  14986. "cellPadding",
  14987. "rowSpan",
  14988. "colSpan",
  14989. "useMap",
  14990. "frameBorder",
  14991. "contentEditable"
  14992. ], function() {
  14993. jQuery.propFix[ this.toLowerCase() ] = this;
  14994. } );
  14995. // Strip and collapse whitespace according to HTML spec
  14996. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  14997. function stripAndCollapse( value ) {
  14998. var tokens = value.match( rnothtmlwhite ) || [];
  14999. return tokens.join( " " );
  15000. }
  15001. function getClass( elem ) {
  15002. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15003. }
  15004. function classesToArray( value ) {
  15005. if ( Array.isArray( value ) ) {
  15006. return value;
  15007. }
  15008. if ( typeof value === "string" ) {
  15009. return value.match( rnothtmlwhite ) || [];
  15010. }
  15011. return [];
  15012. }
  15013. jQuery.fn.extend( {
  15014. addClass: function( value ) {
  15015. var classes, elem, cur, curValue, clazz, j, finalValue,
  15016. i = 0;
  15017. if ( isFunction( value ) ) {
  15018. return this.each( function( j ) {
  15019. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15020. } );
  15021. }
  15022. classes = classesToArray( value );
  15023. if ( classes.length ) {
  15024. while ( ( elem = this[ i++ ] ) ) {
  15025. curValue = getClass( elem );
  15026. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15027. if ( cur ) {
  15028. j = 0;
  15029. while ( ( clazz = classes[ j++ ] ) ) {
  15030. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15031. cur += clazz + " ";
  15032. }
  15033. }
  15034. // Only assign if different to avoid unneeded rendering.
  15035. finalValue = stripAndCollapse( cur );
  15036. if ( curValue !== finalValue ) {
  15037. elem.setAttribute( "class", finalValue );
  15038. }
  15039. }
  15040. }
  15041. }
  15042. return this;
  15043. },
  15044. removeClass: function( value ) {
  15045. var classes, elem, cur, curValue, clazz, j, finalValue,
  15046. i = 0;
  15047. if ( isFunction( value ) ) {
  15048. return this.each( function( j ) {
  15049. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15050. } );
  15051. }
  15052. if ( !arguments.length ) {
  15053. return this.attr( "class", "" );
  15054. }
  15055. classes = classesToArray( value );
  15056. if ( classes.length ) {
  15057. while ( ( elem = this[ i++ ] ) ) {
  15058. curValue = getClass( elem );
  15059. // This expression is here for better compressibility (see addClass)
  15060. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15061. if ( cur ) {
  15062. j = 0;
  15063. while ( ( clazz = classes[ j++ ] ) ) {
  15064. // Remove *all* instances
  15065. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15066. cur = cur.replace( " " + clazz + " ", " " );
  15067. }
  15068. }
  15069. // Only assign if different to avoid unneeded rendering.
  15070. finalValue = stripAndCollapse( cur );
  15071. if ( curValue !== finalValue ) {
  15072. elem.setAttribute( "class", finalValue );
  15073. }
  15074. }
  15075. }
  15076. }
  15077. return this;
  15078. },
  15079. toggleClass: function( value, stateVal ) {
  15080. var type = typeof value,
  15081. isValidValue = type === "string" || Array.isArray( value );
  15082. if ( typeof stateVal === "boolean" && isValidValue ) {
  15083. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15084. }
  15085. if ( isFunction( value ) ) {
  15086. return this.each( function( i ) {
  15087. jQuery( this ).toggleClass(
  15088. value.call( this, i, getClass( this ), stateVal ),
  15089. stateVal
  15090. );
  15091. } );
  15092. }
  15093. return this.each( function() {
  15094. var className, i, self, classNames;
  15095. if ( isValidValue ) {
  15096. // Toggle individual class names
  15097. i = 0;
  15098. self = jQuery( this );
  15099. classNames = classesToArray( value );
  15100. while ( ( className = classNames[ i++ ] ) ) {
  15101. // Check each className given, space separated list
  15102. if ( self.hasClass( className ) ) {
  15103. self.removeClass( className );
  15104. } else {
  15105. self.addClass( className );
  15106. }
  15107. }
  15108. // Toggle whole class name
  15109. } else if ( value === undefined || type === "boolean" ) {
  15110. className = getClass( this );
  15111. if ( className ) {
  15112. // Store className if set
  15113. dataPriv.set( this, "__className__", className );
  15114. }
  15115. // If the element has a class name or if we're passed `false`,
  15116. // then remove the whole classname (if there was one, the above saved it).
  15117. // Otherwise bring back whatever was previously saved (if anything),
  15118. // falling back to the empty string if nothing was stored.
  15119. if ( this.setAttribute ) {
  15120. this.setAttribute( "class",
  15121. className || value === false ?
  15122. "" :
  15123. dataPriv.get( this, "__className__" ) || ""
  15124. );
  15125. }
  15126. }
  15127. } );
  15128. },
  15129. hasClass: function( selector ) {
  15130. var className, elem,
  15131. i = 0;
  15132. className = " " + selector + " ";
  15133. while ( ( elem = this[ i++ ] ) ) {
  15134. if ( elem.nodeType === 1 &&
  15135. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15136. return true;
  15137. }
  15138. }
  15139. return false;
  15140. }
  15141. } );
  15142. var rreturn = /\r/g;
  15143. jQuery.fn.extend( {
  15144. val: function( value ) {
  15145. var hooks, ret, valueIsFunction,
  15146. elem = this[ 0 ];
  15147. if ( !arguments.length ) {
  15148. if ( elem ) {
  15149. hooks = jQuery.valHooks[ elem.type ] ||
  15150. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15151. if ( hooks &&
  15152. "get" in hooks &&
  15153. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15154. ) {
  15155. return ret;
  15156. }
  15157. ret = elem.value;
  15158. // Handle most common string cases
  15159. if ( typeof ret === "string" ) {
  15160. return ret.replace( rreturn, "" );
  15161. }
  15162. // Handle cases where value is null/undef or number
  15163. return ret == null ? "" : ret;
  15164. }
  15165. return;
  15166. }
  15167. valueIsFunction = isFunction( value );
  15168. return this.each( function( i ) {
  15169. var val;
  15170. if ( this.nodeType !== 1 ) {
  15171. return;
  15172. }
  15173. if ( valueIsFunction ) {
  15174. val = value.call( this, i, jQuery( this ).val() );
  15175. } else {
  15176. val = value;
  15177. }
  15178. // Treat null/undefined as ""; convert numbers to string
  15179. if ( val == null ) {
  15180. val = "";
  15181. } else if ( typeof val === "number" ) {
  15182. val += "";
  15183. } else if ( Array.isArray( val ) ) {
  15184. val = jQuery.map( val, function( value ) {
  15185. return value == null ? "" : value + "";
  15186. } );
  15187. }
  15188. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15189. // If set returns undefined, fall back to normal setting
  15190. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15191. this.value = val;
  15192. }
  15193. } );
  15194. }
  15195. } );
  15196. jQuery.extend( {
  15197. valHooks: {
  15198. option: {
  15199. get: function( elem ) {
  15200. var val = jQuery.find.attr( elem, "value" );
  15201. return val != null ?
  15202. val :
  15203. // Support: IE <=10 - 11 only
  15204. // option.text throws exceptions (#14686, #14858)
  15205. // Strip and collapse whitespace
  15206. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15207. stripAndCollapse( jQuery.text( elem ) );
  15208. }
  15209. },
  15210. select: {
  15211. get: function( elem ) {
  15212. var value, option, i,
  15213. options = elem.options,
  15214. index = elem.selectedIndex,
  15215. one = elem.type === "select-one",
  15216. values = one ? null : [],
  15217. max = one ? index + 1 : options.length;
  15218. if ( index < 0 ) {
  15219. i = max;
  15220. } else {
  15221. i = one ? index : 0;
  15222. }
  15223. // Loop through all the selected options
  15224. for ( ; i < max; i++ ) {
  15225. option = options[ i ];
  15226. // Support: IE <=9 only
  15227. // IE8-9 doesn't update selected after form reset (#2551)
  15228. if ( ( option.selected || i === index ) &&
  15229. // Don't return options that are disabled or in a disabled optgroup
  15230. !option.disabled &&
  15231. ( !option.parentNode.disabled ||
  15232. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15233. // Get the specific value for the option
  15234. value = jQuery( option ).val();
  15235. // We don't need an array for one selects
  15236. if ( one ) {
  15237. return value;
  15238. }
  15239. // Multi-Selects return an array
  15240. values.push( value );
  15241. }
  15242. }
  15243. return values;
  15244. },
  15245. set: function( elem, value ) {
  15246. var optionSet, option,
  15247. options = elem.options,
  15248. values = jQuery.makeArray( value ),
  15249. i = options.length;
  15250. while ( i-- ) {
  15251. option = options[ i ];
  15252. /* eslint-disable no-cond-assign */
  15253. if ( option.selected =
  15254. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15255. ) {
  15256. optionSet = true;
  15257. }
  15258. /* eslint-enable no-cond-assign */
  15259. }
  15260. // Force browsers to behave consistently when non-matching value is set
  15261. if ( !optionSet ) {
  15262. elem.selectedIndex = -1;
  15263. }
  15264. return values;
  15265. }
  15266. }
  15267. }
  15268. } );
  15269. // Radios and checkboxes getter/setter
  15270. jQuery.each( [ "radio", "checkbox" ], function() {
  15271. jQuery.valHooks[ this ] = {
  15272. set: function( elem, value ) {
  15273. if ( Array.isArray( value ) ) {
  15274. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15275. }
  15276. }
  15277. };
  15278. if ( !support.checkOn ) {
  15279. jQuery.valHooks[ this ].get = function( elem ) {
  15280. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15281. };
  15282. }
  15283. } );
  15284. // Return jQuery for attributes-only inclusion
  15285. support.focusin = "onfocusin" in window;
  15286. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15287. stopPropagationCallback = function( e ) {
  15288. e.stopPropagation();
  15289. };
  15290. jQuery.extend( jQuery.event, {
  15291. trigger: function( event, data, elem, onlyHandlers ) {
  15292. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15293. eventPath = [ elem || document ],
  15294. type = hasOwn.call( event, "type" ) ? event.type : event,
  15295. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15296. cur = lastElement = tmp = elem = elem || document;
  15297. // Don't do events on text and comment nodes
  15298. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15299. return;
  15300. }
  15301. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15302. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15303. return;
  15304. }
  15305. if ( type.indexOf( "." ) > -1 ) {
  15306. // Namespaced trigger; create a regexp to match event type in handle()
  15307. namespaces = type.split( "." );
  15308. type = namespaces.shift();
  15309. namespaces.sort();
  15310. }
  15311. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15312. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15313. event = event[ jQuery.expando ] ?
  15314. event :
  15315. new jQuery.Event( type, typeof event === "object" && event );
  15316. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15317. event.isTrigger = onlyHandlers ? 2 : 3;
  15318. event.namespace = namespaces.join( "." );
  15319. event.rnamespace = event.namespace ?
  15320. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15321. null;
  15322. // Clean up the event in case it is being reused
  15323. event.result = undefined;
  15324. if ( !event.target ) {
  15325. event.target = elem;
  15326. }
  15327. // Clone any incoming data and prepend the event, creating the handler arg list
  15328. data = data == null ?
  15329. [ event ] :
  15330. jQuery.makeArray( data, [ event ] );
  15331. // Allow special events to draw outside the lines
  15332. special = jQuery.event.special[ type ] || {};
  15333. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15334. return;
  15335. }
  15336. // Determine event propagation path in advance, per W3C events spec (#9951)
  15337. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15338. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15339. bubbleType = special.delegateType || type;
  15340. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15341. cur = cur.parentNode;
  15342. }
  15343. for ( ; cur; cur = cur.parentNode ) {
  15344. eventPath.push( cur );
  15345. tmp = cur;
  15346. }
  15347. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15348. if ( tmp === ( elem.ownerDocument || document ) ) {
  15349. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15350. }
  15351. }
  15352. // Fire handlers on the event path
  15353. i = 0;
  15354. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15355. lastElement = cur;
  15356. event.type = i > 1 ?
  15357. bubbleType :
  15358. special.bindType || type;
  15359. // jQuery handler
  15360. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15361. dataPriv.get( cur, "handle" );
  15362. if ( handle ) {
  15363. handle.apply( cur, data );
  15364. }
  15365. // Native handler
  15366. handle = ontype && cur[ ontype ];
  15367. if ( handle && handle.apply && acceptData( cur ) ) {
  15368. event.result = handle.apply( cur, data );
  15369. if ( event.result === false ) {
  15370. event.preventDefault();
  15371. }
  15372. }
  15373. }
  15374. event.type = type;
  15375. // If nobody prevented the default action, do it now
  15376. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15377. if ( ( !special._default ||
  15378. special._default.apply( eventPath.pop(), data ) === false ) &&
  15379. acceptData( elem ) ) {
  15380. // Call a native DOM method on the target with the same name as the event.
  15381. // Don't do default actions on window, that's where global variables be (#6170)
  15382. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15383. // Don't re-trigger an onFOO event when we call its FOO() method
  15384. tmp = elem[ ontype ];
  15385. if ( tmp ) {
  15386. elem[ ontype ] = null;
  15387. }
  15388. // Prevent re-triggering of the same event, since we already bubbled it above
  15389. jQuery.event.triggered = type;
  15390. if ( event.isPropagationStopped() ) {
  15391. lastElement.addEventListener( type, stopPropagationCallback );
  15392. }
  15393. elem[ type ]();
  15394. if ( event.isPropagationStopped() ) {
  15395. lastElement.removeEventListener( type, stopPropagationCallback );
  15396. }
  15397. jQuery.event.triggered = undefined;
  15398. if ( tmp ) {
  15399. elem[ ontype ] = tmp;
  15400. }
  15401. }
  15402. }
  15403. }
  15404. return event.result;
  15405. },
  15406. // Piggyback on a donor event to simulate a different one
  15407. // Used only for `focus(in | out)` events
  15408. simulate: function( type, elem, event ) {
  15409. var e = jQuery.extend(
  15410. new jQuery.Event(),
  15411. event,
  15412. {
  15413. type: type,
  15414. isSimulated: true
  15415. }
  15416. );
  15417. jQuery.event.trigger( e, null, elem );
  15418. }
  15419. } );
  15420. jQuery.fn.extend( {
  15421. trigger: function( type, data ) {
  15422. return this.each( function() {
  15423. jQuery.event.trigger( type, data, this );
  15424. } );
  15425. },
  15426. triggerHandler: function( type, data ) {
  15427. var elem = this[ 0 ];
  15428. if ( elem ) {
  15429. return jQuery.event.trigger( type, data, elem, true );
  15430. }
  15431. }
  15432. } );
  15433. // Support: Firefox <=44
  15434. // Firefox doesn't have focus(in | out) events
  15435. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15436. //
  15437. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15438. // focus(in | out) events fire after focus & blur events,
  15439. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15440. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15441. if ( !support.focusin ) {
  15442. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15443. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15444. var handler = function( event ) {
  15445. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15446. };
  15447. jQuery.event.special[ fix ] = {
  15448. setup: function() {
  15449. var doc = this.ownerDocument || this,
  15450. attaches = dataPriv.access( doc, fix );
  15451. if ( !attaches ) {
  15452. doc.addEventListener( orig, handler, true );
  15453. }
  15454. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15455. },
  15456. teardown: function() {
  15457. var doc = this.ownerDocument || this,
  15458. attaches = dataPriv.access( doc, fix ) - 1;
  15459. if ( !attaches ) {
  15460. doc.removeEventListener( orig, handler, true );
  15461. dataPriv.remove( doc, fix );
  15462. } else {
  15463. dataPriv.access( doc, fix, attaches );
  15464. }
  15465. }
  15466. };
  15467. } );
  15468. }
  15469. var location = window.location;
  15470. var nonce = Date.now();
  15471. var rquery = ( /\?/ );
  15472. // Cross-browser xml parsing
  15473. jQuery.parseXML = function( data ) {
  15474. var xml;
  15475. if ( !data || typeof data !== "string" ) {
  15476. return null;
  15477. }
  15478. // Support: IE 9 - 11 only
  15479. // IE throws on parseFromString with invalid input.
  15480. try {
  15481. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15482. } catch ( e ) {
  15483. xml = undefined;
  15484. }
  15485. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15486. jQuery.error( "Invalid XML: " + data );
  15487. }
  15488. return xml;
  15489. };
  15490. var
  15491. rbracket = /\[\]$/,
  15492. rCRLF = /\r?\n/g,
  15493. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15494. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15495. function buildParams( prefix, obj, traditional, add ) {
  15496. var name;
  15497. if ( Array.isArray( obj ) ) {
  15498. // Serialize array item.
  15499. jQuery.each( obj, function( i, v ) {
  15500. if ( traditional || rbracket.test( prefix ) ) {
  15501. // Treat each array item as a scalar.
  15502. add( prefix, v );
  15503. } else {
  15504. // Item is non-scalar (array or object), encode its numeric index.
  15505. buildParams(
  15506. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15507. v,
  15508. traditional,
  15509. add
  15510. );
  15511. }
  15512. } );
  15513. } else if ( !traditional && toType( obj ) === "object" ) {
  15514. // Serialize object item.
  15515. for ( name in obj ) {
  15516. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15517. }
  15518. } else {
  15519. // Serialize scalar item.
  15520. add( prefix, obj );
  15521. }
  15522. }
  15523. // Serialize an array of form elements or a set of
  15524. // key/values into a query string
  15525. jQuery.param = function( a, traditional ) {
  15526. var prefix,
  15527. s = [],
  15528. add = function( key, valueOrFunction ) {
  15529. // If value is a function, invoke it and use its return value
  15530. var value = isFunction( valueOrFunction ) ?
  15531. valueOrFunction() :
  15532. valueOrFunction;
  15533. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15534. encodeURIComponent( value == null ? "" : value );
  15535. };
  15536. if ( a == null ) {
  15537. return "";
  15538. }
  15539. // If an array was passed in, assume that it is an array of form elements.
  15540. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15541. // Serialize the form elements
  15542. jQuery.each( a, function() {
  15543. add( this.name, this.value );
  15544. } );
  15545. } else {
  15546. // If traditional, encode the "old" way (the way 1.3.2 or older
  15547. // did it), otherwise encode params recursively.
  15548. for ( prefix in a ) {
  15549. buildParams( prefix, a[ prefix ], traditional, add );
  15550. }
  15551. }
  15552. // Return the resulting serialization
  15553. return s.join( "&" );
  15554. };
  15555. jQuery.fn.extend( {
  15556. serialize: function() {
  15557. return jQuery.param( this.serializeArray() );
  15558. },
  15559. serializeArray: function() {
  15560. return this.map( function() {
  15561. // Can add propHook for "elements" to filter or add form elements
  15562. var elements = jQuery.prop( this, "elements" );
  15563. return elements ? jQuery.makeArray( elements ) : this;
  15564. } )
  15565. .filter( function() {
  15566. var type = this.type;
  15567. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15568. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15569. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15570. ( this.checked || !rcheckableType.test( type ) );
  15571. } )
  15572. .map( function( i, elem ) {
  15573. var val = jQuery( this ).val();
  15574. if ( val == null ) {
  15575. return null;
  15576. }
  15577. if ( Array.isArray( val ) ) {
  15578. return jQuery.map( val, function( val ) {
  15579. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15580. } );
  15581. }
  15582. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15583. } ).get();
  15584. }
  15585. } );
  15586. var
  15587. r20 = /%20/g,
  15588. rhash = /#.*$/,
  15589. rantiCache = /([?&])_=[^&]*/,
  15590. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15591. // #7653, #8125, #8152: local protocol detection
  15592. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15593. rnoContent = /^(?:GET|HEAD)$/,
  15594. rprotocol = /^\/\//,
  15595. /* Prefilters
  15596. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15597. * 2) These are called:
  15598. * - BEFORE asking for a transport
  15599. * - AFTER param serialization (s.data is a string if s.processData is true)
  15600. * 3) key is the dataType
  15601. * 4) the catchall symbol "*" can be used
  15602. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15603. */
  15604. prefilters = {},
  15605. /* Transports bindings
  15606. * 1) key is the dataType
  15607. * 2) the catchall symbol "*" can be used
  15608. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15609. */
  15610. transports = {},
  15611. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15612. allTypes = "*/".concat( "*" ),
  15613. // Anchor tag for parsing the document origin
  15614. originAnchor = document.createElement( "a" );
  15615. originAnchor.href = location.href;
  15616. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15617. function addToPrefiltersOrTransports( structure ) {
  15618. // dataTypeExpression is optional and defaults to "*"
  15619. return function( dataTypeExpression, func ) {
  15620. if ( typeof dataTypeExpression !== "string" ) {
  15621. func = dataTypeExpression;
  15622. dataTypeExpression = "*";
  15623. }
  15624. var dataType,
  15625. i = 0,
  15626. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15627. if ( isFunction( func ) ) {
  15628. // For each dataType in the dataTypeExpression
  15629. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15630. // Prepend if requested
  15631. if ( dataType[ 0 ] === "+" ) {
  15632. dataType = dataType.slice( 1 ) || "*";
  15633. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15634. // Otherwise append
  15635. } else {
  15636. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15637. }
  15638. }
  15639. }
  15640. };
  15641. }
  15642. // Base inspection function for prefilters and transports
  15643. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15644. var inspected = {},
  15645. seekingTransport = ( structure === transports );
  15646. function inspect( dataType ) {
  15647. var selected;
  15648. inspected[ dataType ] = true;
  15649. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15650. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15651. if ( typeof dataTypeOrTransport === "string" &&
  15652. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15653. options.dataTypes.unshift( dataTypeOrTransport );
  15654. inspect( dataTypeOrTransport );
  15655. return false;
  15656. } else if ( seekingTransport ) {
  15657. return !( selected = dataTypeOrTransport );
  15658. }
  15659. } );
  15660. return selected;
  15661. }
  15662. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15663. }
  15664. // A special extend for ajax options
  15665. // that takes "flat" options (not to be deep extended)
  15666. // Fixes #9887
  15667. function ajaxExtend( target, src ) {
  15668. var key, deep,
  15669. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15670. for ( key in src ) {
  15671. if ( src[ key ] !== undefined ) {
  15672. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15673. }
  15674. }
  15675. if ( deep ) {
  15676. jQuery.extend( true, target, deep );
  15677. }
  15678. return target;
  15679. }
  15680. /* Handles responses to an ajax request:
  15681. * - finds the right dataType (mediates between content-type and expected dataType)
  15682. * - returns the corresponding response
  15683. */
  15684. function ajaxHandleResponses( s, jqXHR, responses ) {
  15685. var ct, type, finalDataType, firstDataType,
  15686. contents = s.contents,
  15687. dataTypes = s.dataTypes;
  15688. // Remove auto dataType and get content-type in the process
  15689. while ( dataTypes[ 0 ] === "*" ) {
  15690. dataTypes.shift();
  15691. if ( ct === undefined ) {
  15692. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15693. }
  15694. }
  15695. // Check if we're dealing with a known content-type
  15696. if ( ct ) {
  15697. for ( type in contents ) {
  15698. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15699. dataTypes.unshift( type );
  15700. break;
  15701. }
  15702. }
  15703. }
  15704. // Check to see if we have a response for the expected dataType
  15705. if ( dataTypes[ 0 ] in responses ) {
  15706. finalDataType = dataTypes[ 0 ];
  15707. } else {
  15708. // Try convertible dataTypes
  15709. for ( type in responses ) {
  15710. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15711. finalDataType = type;
  15712. break;
  15713. }
  15714. if ( !firstDataType ) {
  15715. firstDataType = type;
  15716. }
  15717. }
  15718. // Or just use first one
  15719. finalDataType = finalDataType || firstDataType;
  15720. }
  15721. // If we found a dataType
  15722. // We add the dataType to the list if needed
  15723. // and return the corresponding response
  15724. if ( finalDataType ) {
  15725. if ( finalDataType !== dataTypes[ 0 ] ) {
  15726. dataTypes.unshift( finalDataType );
  15727. }
  15728. return responses[ finalDataType ];
  15729. }
  15730. }
  15731. /* Chain conversions given the request and the original response
  15732. * Also sets the responseXXX fields on the jqXHR instance
  15733. */
  15734. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15735. var conv2, current, conv, tmp, prev,
  15736. converters = {},
  15737. // Work with a copy of dataTypes in case we need to modify it for conversion
  15738. dataTypes = s.dataTypes.slice();
  15739. // Create converters map with lowercased keys
  15740. if ( dataTypes[ 1 ] ) {
  15741. for ( conv in s.converters ) {
  15742. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15743. }
  15744. }
  15745. current = dataTypes.shift();
  15746. // Convert to each sequential dataType
  15747. while ( current ) {
  15748. if ( s.responseFields[ current ] ) {
  15749. jqXHR[ s.responseFields[ current ] ] = response;
  15750. }
  15751. // Apply the dataFilter if provided
  15752. if ( !prev && isSuccess && s.dataFilter ) {
  15753. response = s.dataFilter( response, s.dataType );
  15754. }
  15755. prev = current;
  15756. current = dataTypes.shift();
  15757. if ( current ) {
  15758. // There's only work to do if current dataType is non-auto
  15759. if ( current === "*" ) {
  15760. current = prev;
  15761. // Convert response if prev dataType is non-auto and differs from current
  15762. } else if ( prev !== "*" && prev !== current ) {
  15763. // Seek a direct converter
  15764. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15765. // If none found, seek a pair
  15766. if ( !conv ) {
  15767. for ( conv2 in converters ) {
  15768. // If conv2 outputs current
  15769. tmp = conv2.split( " " );
  15770. if ( tmp[ 1 ] === current ) {
  15771. // If prev can be converted to accepted input
  15772. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15773. converters[ "* " + tmp[ 0 ] ];
  15774. if ( conv ) {
  15775. // Condense equivalence converters
  15776. if ( conv === true ) {
  15777. conv = converters[ conv2 ];
  15778. // Otherwise, insert the intermediate dataType
  15779. } else if ( converters[ conv2 ] !== true ) {
  15780. current = tmp[ 0 ];
  15781. dataTypes.unshift( tmp[ 1 ] );
  15782. }
  15783. break;
  15784. }
  15785. }
  15786. }
  15787. }
  15788. // Apply converter (if not an equivalence)
  15789. if ( conv !== true ) {
  15790. // Unless errors are allowed to bubble, catch and return them
  15791. if ( conv && s.throws ) {
  15792. response = conv( response );
  15793. } else {
  15794. try {
  15795. response = conv( response );
  15796. } catch ( e ) {
  15797. return {
  15798. state: "parsererror",
  15799. error: conv ? e : "No conversion from " + prev + " to " + current
  15800. };
  15801. }
  15802. }
  15803. }
  15804. }
  15805. }
  15806. }
  15807. return { state: "success", data: response };
  15808. }
  15809. jQuery.extend( {
  15810. // Counter for holding the number of active queries
  15811. active: 0,
  15812. // Last-Modified header cache for next request
  15813. lastModified: {},
  15814. etag: {},
  15815. ajaxSettings: {
  15816. url: location.href,
  15817. type: "GET",
  15818. isLocal: rlocalProtocol.test( location.protocol ),
  15819. global: true,
  15820. processData: true,
  15821. async: true,
  15822. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15823. /*
  15824. timeout: 0,
  15825. data: null,
  15826. dataType: null,
  15827. username: null,
  15828. password: null,
  15829. cache: null,
  15830. throws: false,
  15831. traditional: false,
  15832. headers: {},
  15833. */
  15834. accepts: {
  15835. "*": allTypes,
  15836. text: "text/plain",
  15837. html: "text/html",
  15838. xml: "application/xml, text/xml",
  15839. json: "application/json, text/javascript"
  15840. },
  15841. contents: {
  15842. xml: /\bxml\b/,
  15843. html: /\bhtml/,
  15844. json: /\bjson\b/
  15845. },
  15846. responseFields: {
  15847. xml: "responseXML",
  15848. text: "responseText",
  15849. json: "responseJSON"
  15850. },
  15851. // Data converters
  15852. // Keys separate source (or catchall "*") and destination types with a single space
  15853. converters: {
  15854. // Convert anything to text
  15855. "* text": String,
  15856. // Text to html (true = no transformation)
  15857. "text html": true,
  15858. // Evaluate text as a json expression
  15859. "text json": JSON.parse,
  15860. // Parse text as xml
  15861. "text xml": jQuery.parseXML
  15862. },
  15863. // For options that shouldn't be deep extended:
  15864. // you can add your own custom options here if
  15865. // and when you create one that shouldn't be
  15866. // deep extended (see ajaxExtend)
  15867. flatOptions: {
  15868. url: true,
  15869. context: true
  15870. }
  15871. },
  15872. // Creates a full fledged settings object into target
  15873. // with both ajaxSettings and settings fields.
  15874. // If target is omitted, writes into ajaxSettings.
  15875. ajaxSetup: function( target, settings ) {
  15876. return settings ?
  15877. // Building a settings object
  15878. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15879. // Extending ajaxSettings
  15880. ajaxExtend( jQuery.ajaxSettings, target );
  15881. },
  15882. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15883. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15884. // Main method
  15885. ajax: function( url, options ) {
  15886. // If url is an object, simulate pre-1.5 signature
  15887. if ( typeof url === "object" ) {
  15888. options = url;
  15889. url = undefined;
  15890. }
  15891. // Force options to be an object
  15892. options = options || {};
  15893. var transport,
  15894. // URL without anti-cache param
  15895. cacheURL,
  15896. // Response headers
  15897. responseHeadersString,
  15898. responseHeaders,
  15899. // timeout handle
  15900. timeoutTimer,
  15901. // Url cleanup var
  15902. urlAnchor,
  15903. // Request state (becomes false upon send and true upon completion)
  15904. completed,
  15905. // To know if global events are to be dispatched
  15906. fireGlobals,
  15907. // Loop variable
  15908. i,
  15909. // uncached part of the url
  15910. uncached,
  15911. // Create the final options object
  15912. s = jQuery.ajaxSetup( {}, options ),
  15913. // Callbacks context
  15914. callbackContext = s.context || s,
  15915. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  15916. globalEventContext = s.context &&
  15917. ( callbackContext.nodeType || callbackContext.jquery ) ?
  15918. jQuery( callbackContext ) :
  15919. jQuery.event,
  15920. // Deferreds
  15921. deferred = jQuery.Deferred(),
  15922. completeDeferred = jQuery.Callbacks( "once memory" ),
  15923. // Status-dependent callbacks
  15924. statusCode = s.statusCode || {},
  15925. // Headers (they are sent all at once)
  15926. requestHeaders = {},
  15927. requestHeadersNames = {},
  15928. // Default abort message
  15929. strAbort = "canceled",
  15930. // Fake xhr
  15931. jqXHR = {
  15932. readyState: 0,
  15933. // Builds headers hashtable if needed
  15934. getResponseHeader: function( key ) {
  15935. var match;
  15936. if ( completed ) {
  15937. if ( !responseHeaders ) {
  15938. responseHeaders = {};
  15939. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  15940. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  15941. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  15942. .concat( match[ 2 ] );
  15943. }
  15944. }
  15945. match = responseHeaders[ key.toLowerCase() + " " ];
  15946. }
  15947. return match == null ? null : match.join( ", " );
  15948. },
  15949. // Raw string
  15950. getAllResponseHeaders: function() {
  15951. return completed ? responseHeadersString : null;
  15952. },
  15953. // Caches the header
  15954. setRequestHeader: function( name, value ) {
  15955. if ( completed == null ) {
  15956. name = requestHeadersNames[ name.toLowerCase() ] =
  15957. requestHeadersNames[ name.toLowerCase() ] || name;
  15958. requestHeaders[ name ] = value;
  15959. }
  15960. return this;
  15961. },
  15962. // Overrides response content-type header
  15963. overrideMimeType: function( type ) {
  15964. if ( completed == null ) {
  15965. s.mimeType = type;
  15966. }
  15967. return this;
  15968. },
  15969. // Status-dependent callbacks
  15970. statusCode: function( map ) {
  15971. var code;
  15972. if ( map ) {
  15973. if ( completed ) {
  15974. // Execute the appropriate callbacks
  15975. jqXHR.always( map[ jqXHR.status ] );
  15976. } else {
  15977. // Lazy-add the new callbacks in a way that preserves old ones
  15978. for ( code in map ) {
  15979. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  15980. }
  15981. }
  15982. }
  15983. return this;
  15984. },
  15985. // Cancel the request
  15986. abort: function( statusText ) {
  15987. var finalText = statusText || strAbort;
  15988. if ( transport ) {
  15989. transport.abort( finalText );
  15990. }
  15991. done( 0, finalText );
  15992. return this;
  15993. }
  15994. };
  15995. // Attach deferreds
  15996. deferred.promise( jqXHR );
  15997. // Add protocol if not provided (prefilters might expect it)
  15998. // Handle falsy url in the settings object (#10093: consistency with old signature)
  15999. // We also use the url parameter if available
  16000. s.url = ( ( url || s.url || location.href ) + "" )
  16001. .replace( rprotocol, location.protocol + "//" );
  16002. // Alias method option to type as per ticket #12004
  16003. s.type = options.method || options.type || s.method || s.type;
  16004. // Extract dataTypes list
  16005. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16006. // A cross-domain request is in order when the origin doesn't match the current origin.
  16007. if ( s.crossDomain == null ) {
  16008. urlAnchor = document.createElement( "a" );
  16009. // Support: IE <=8 - 11, Edge 12 - 15
  16010. // IE throws exception on accessing the href property if url is malformed,
  16011. // e.g. http://example.com:80x/
  16012. try {
  16013. urlAnchor.href = s.url;
  16014. // Support: IE <=8 - 11 only
  16015. // Anchor's host property isn't correctly set when s.url is relative
  16016. urlAnchor.href = urlAnchor.href;
  16017. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16018. urlAnchor.protocol + "//" + urlAnchor.host;
  16019. } catch ( e ) {
  16020. // If there is an error parsing the URL, assume it is crossDomain,
  16021. // it can be rejected by the transport if it is invalid
  16022. s.crossDomain = true;
  16023. }
  16024. }
  16025. // Convert data if not already a string
  16026. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16027. s.data = jQuery.param( s.data, s.traditional );
  16028. }
  16029. // Apply prefilters
  16030. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16031. // If request was aborted inside a prefilter, stop there
  16032. if ( completed ) {
  16033. return jqXHR;
  16034. }
  16035. // We can fire global events as of now if asked to
  16036. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16037. fireGlobals = jQuery.event && s.global;
  16038. // Watch for a new set of requests
  16039. if ( fireGlobals && jQuery.active++ === 0 ) {
  16040. jQuery.event.trigger( "ajaxStart" );
  16041. }
  16042. // Uppercase the type
  16043. s.type = s.type.toUpperCase();
  16044. // Determine if request has content
  16045. s.hasContent = !rnoContent.test( s.type );
  16046. // Save the URL in case we're toying with the If-Modified-Since
  16047. // and/or If-None-Match header later on
  16048. // Remove hash to simplify url manipulation
  16049. cacheURL = s.url.replace( rhash, "" );
  16050. // More options handling for requests with no content
  16051. if ( !s.hasContent ) {
  16052. // Remember the hash so we can put it back
  16053. uncached = s.url.slice( cacheURL.length );
  16054. // If data is available and should be processed, append data to url
  16055. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16056. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16057. // #9682: remove data so that it's not used in an eventual retry
  16058. delete s.data;
  16059. }
  16060. // Add or update anti-cache param if needed
  16061. if ( s.cache === false ) {
  16062. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16063. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16064. }
  16065. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16066. s.url = cacheURL + uncached;
  16067. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16068. } else if ( s.data && s.processData &&
  16069. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16070. s.data = s.data.replace( r20, "+" );
  16071. }
  16072. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16073. if ( s.ifModified ) {
  16074. if ( jQuery.lastModified[ cacheURL ] ) {
  16075. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16076. }
  16077. if ( jQuery.etag[ cacheURL ] ) {
  16078. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16079. }
  16080. }
  16081. // Set the correct header, if data is being sent
  16082. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16083. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16084. }
  16085. // Set the Accepts header for the server, depending on the dataType
  16086. jqXHR.setRequestHeader(
  16087. "Accept",
  16088. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16089. s.accepts[ s.dataTypes[ 0 ] ] +
  16090. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16091. s.accepts[ "*" ]
  16092. );
  16093. // Check for headers option
  16094. for ( i in s.headers ) {
  16095. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16096. }
  16097. // Allow custom headers/mimetypes and early abort
  16098. if ( s.beforeSend &&
  16099. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16100. // Abort if not done already and return
  16101. return jqXHR.abort();
  16102. }
  16103. // Aborting is no longer a cancellation
  16104. strAbort = "abort";
  16105. // Install callbacks on deferreds
  16106. completeDeferred.add( s.complete );
  16107. jqXHR.done( s.success );
  16108. jqXHR.fail( s.error );
  16109. // Get transport
  16110. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16111. // If no transport, we auto-abort
  16112. if ( !transport ) {
  16113. done( -1, "No Transport" );
  16114. } else {
  16115. jqXHR.readyState = 1;
  16116. // Send global event
  16117. if ( fireGlobals ) {
  16118. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16119. }
  16120. // If request was aborted inside ajaxSend, stop there
  16121. if ( completed ) {
  16122. return jqXHR;
  16123. }
  16124. // Timeout
  16125. if ( s.async && s.timeout > 0 ) {
  16126. timeoutTimer = window.setTimeout( function() {
  16127. jqXHR.abort( "timeout" );
  16128. }, s.timeout );
  16129. }
  16130. try {
  16131. completed = false;
  16132. transport.send( requestHeaders, done );
  16133. } catch ( e ) {
  16134. // Rethrow post-completion exceptions
  16135. if ( completed ) {
  16136. throw e;
  16137. }
  16138. // Propagate others as results
  16139. done( -1, e );
  16140. }
  16141. }
  16142. // Callback for when everything is done
  16143. function done( status, nativeStatusText, responses, headers ) {
  16144. var isSuccess, success, error, response, modified,
  16145. statusText = nativeStatusText;
  16146. // Ignore repeat invocations
  16147. if ( completed ) {
  16148. return;
  16149. }
  16150. completed = true;
  16151. // Clear timeout if it exists
  16152. if ( timeoutTimer ) {
  16153. window.clearTimeout( timeoutTimer );
  16154. }
  16155. // Dereference transport for early garbage collection
  16156. // (no matter how long the jqXHR object will be used)
  16157. transport = undefined;
  16158. // Cache response headers
  16159. responseHeadersString = headers || "";
  16160. // Set readyState
  16161. jqXHR.readyState = status > 0 ? 4 : 0;
  16162. // Determine if successful
  16163. isSuccess = status >= 200 && status < 300 || status === 304;
  16164. // Get response data
  16165. if ( responses ) {
  16166. response = ajaxHandleResponses( s, jqXHR, responses );
  16167. }
  16168. // Convert no matter what (that way responseXXX fields are always set)
  16169. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16170. // If successful, handle type chaining
  16171. if ( isSuccess ) {
  16172. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16173. if ( s.ifModified ) {
  16174. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16175. if ( modified ) {
  16176. jQuery.lastModified[ cacheURL ] = modified;
  16177. }
  16178. modified = jqXHR.getResponseHeader( "etag" );
  16179. if ( modified ) {
  16180. jQuery.etag[ cacheURL ] = modified;
  16181. }
  16182. }
  16183. // if no content
  16184. if ( status === 204 || s.type === "HEAD" ) {
  16185. statusText = "nocontent";
  16186. // if not modified
  16187. } else if ( status === 304 ) {
  16188. statusText = "notmodified";
  16189. // If we have data, let's convert it
  16190. } else {
  16191. statusText = response.state;
  16192. success = response.data;
  16193. error = response.error;
  16194. isSuccess = !error;
  16195. }
  16196. } else {
  16197. // Extract error from statusText and normalize for non-aborts
  16198. error = statusText;
  16199. if ( status || !statusText ) {
  16200. statusText = "error";
  16201. if ( status < 0 ) {
  16202. status = 0;
  16203. }
  16204. }
  16205. }
  16206. // Set data for the fake xhr object
  16207. jqXHR.status = status;
  16208. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16209. // Success/Error
  16210. if ( isSuccess ) {
  16211. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16212. } else {
  16213. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16214. }
  16215. // Status-dependent callbacks
  16216. jqXHR.statusCode( statusCode );
  16217. statusCode = undefined;
  16218. if ( fireGlobals ) {
  16219. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16220. [ jqXHR, s, isSuccess ? success : error ] );
  16221. }
  16222. // Complete
  16223. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16224. if ( fireGlobals ) {
  16225. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16226. // Handle the global AJAX counter
  16227. if ( !( --jQuery.active ) ) {
  16228. jQuery.event.trigger( "ajaxStop" );
  16229. }
  16230. }
  16231. }
  16232. return jqXHR;
  16233. },
  16234. getJSON: function( url, data, callback ) {
  16235. return jQuery.get( url, data, callback, "json" );
  16236. },
  16237. getScript: function( url, callback ) {
  16238. return jQuery.get( url, undefined, callback, "script" );
  16239. }
  16240. } );
  16241. jQuery.each( [ "get", "post" ], function( i, method ) {
  16242. jQuery[ method ] = function( url, data, callback, type ) {
  16243. // Shift arguments if data argument was omitted
  16244. if ( isFunction( data ) ) {
  16245. type = type || callback;
  16246. callback = data;
  16247. data = undefined;
  16248. }
  16249. // The url can be an options object (which then must have .url)
  16250. return jQuery.ajax( jQuery.extend( {
  16251. url: url,
  16252. type: method,
  16253. dataType: type,
  16254. data: data,
  16255. success: callback
  16256. }, jQuery.isPlainObject( url ) && url ) );
  16257. };
  16258. } );
  16259. jQuery._evalUrl = function( url, options ) {
  16260. return jQuery.ajax( {
  16261. url: url,
  16262. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16263. type: "GET",
  16264. dataType: "script",
  16265. cache: true,
  16266. async: false,
  16267. global: false,
  16268. // Only evaluate the response if it is successful (gh-4126)
  16269. // dataFilter is not invoked for failure responses, so using it instead
  16270. // of the default converter is kludgy but it works.
  16271. converters: {
  16272. "text script": function() {}
  16273. },
  16274. dataFilter: function( response ) {
  16275. jQuery.globalEval( response, options );
  16276. }
  16277. } );
  16278. };
  16279. jQuery.fn.extend( {
  16280. wrapAll: function( html ) {
  16281. var wrap;
  16282. if ( this[ 0 ] ) {
  16283. if ( isFunction( html ) ) {
  16284. html = html.call( this[ 0 ] );
  16285. }
  16286. // The elements to wrap the target around
  16287. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16288. if ( this[ 0 ].parentNode ) {
  16289. wrap.insertBefore( this[ 0 ] );
  16290. }
  16291. wrap.map( function() {
  16292. var elem = this;
  16293. while ( elem.firstElementChild ) {
  16294. elem = elem.firstElementChild;
  16295. }
  16296. return elem;
  16297. } ).append( this );
  16298. }
  16299. return this;
  16300. },
  16301. wrapInner: function( html ) {
  16302. if ( isFunction( html ) ) {
  16303. return this.each( function( i ) {
  16304. jQuery( this ).wrapInner( html.call( this, i ) );
  16305. } );
  16306. }
  16307. return this.each( function() {
  16308. var self = jQuery( this ),
  16309. contents = self.contents();
  16310. if ( contents.length ) {
  16311. contents.wrapAll( html );
  16312. } else {
  16313. self.append( html );
  16314. }
  16315. } );
  16316. },
  16317. wrap: function( html ) {
  16318. var htmlIsFunction = isFunction( html );
  16319. return this.each( function( i ) {
  16320. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16321. } );
  16322. },
  16323. unwrap: function( selector ) {
  16324. this.parent( selector ).not( "body" ).each( function() {
  16325. jQuery( this ).replaceWith( this.childNodes );
  16326. } );
  16327. return this;
  16328. }
  16329. } );
  16330. jQuery.expr.pseudos.hidden = function( elem ) {
  16331. return !jQuery.expr.pseudos.visible( elem );
  16332. };
  16333. jQuery.expr.pseudos.visible = function( elem ) {
  16334. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16335. };
  16336. jQuery.ajaxSettings.xhr = function() {
  16337. try {
  16338. return new window.XMLHttpRequest();
  16339. } catch ( e ) {}
  16340. };
  16341. var xhrSuccessStatus = {
  16342. // File protocol always yields status code 0, assume 200
  16343. 0: 200,
  16344. // Support: IE <=9 only
  16345. // #1450: sometimes IE returns 1223 when it should be 204
  16346. 1223: 204
  16347. },
  16348. xhrSupported = jQuery.ajaxSettings.xhr();
  16349. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16350. support.ajax = xhrSupported = !!xhrSupported;
  16351. jQuery.ajaxTransport( function( options ) {
  16352. var callback, errorCallback;
  16353. // Cross domain only allowed if supported through XMLHttpRequest
  16354. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16355. return {
  16356. send: function( headers, complete ) {
  16357. var i,
  16358. xhr = options.xhr();
  16359. xhr.open(
  16360. options.type,
  16361. options.url,
  16362. options.async,
  16363. options.username,
  16364. options.password
  16365. );
  16366. // Apply custom fields if provided
  16367. if ( options.xhrFields ) {
  16368. for ( i in options.xhrFields ) {
  16369. xhr[ i ] = options.xhrFields[ i ];
  16370. }
  16371. }
  16372. // Override mime type if needed
  16373. if ( options.mimeType && xhr.overrideMimeType ) {
  16374. xhr.overrideMimeType( options.mimeType );
  16375. }
  16376. // X-Requested-With header
  16377. // For cross-domain requests, seeing as conditions for a preflight are
  16378. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16379. // (it can always be set on a per-request basis or even using ajaxSetup)
  16380. // For same-domain requests, won't change header if already provided.
  16381. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16382. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16383. }
  16384. // Set headers
  16385. for ( i in headers ) {
  16386. xhr.setRequestHeader( i, headers[ i ] );
  16387. }
  16388. // Callback
  16389. callback = function( type ) {
  16390. return function() {
  16391. if ( callback ) {
  16392. callback = errorCallback = xhr.onload =
  16393. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16394. xhr.onreadystatechange = null;
  16395. if ( type === "abort" ) {
  16396. xhr.abort();
  16397. } else if ( type === "error" ) {
  16398. // Support: IE <=9 only
  16399. // On a manual native abort, IE9 throws
  16400. // errors on any property access that is not readyState
  16401. if ( typeof xhr.status !== "number" ) {
  16402. complete( 0, "error" );
  16403. } else {
  16404. complete(
  16405. // File: protocol always yields status 0; see #8605, #14207
  16406. xhr.status,
  16407. xhr.statusText
  16408. );
  16409. }
  16410. } else {
  16411. complete(
  16412. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16413. xhr.statusText,
  16414. // Support: IE <=9 only
  16415. // IE9 has no XHR2 but throws on binary (trac-11426)
  16416. // For XHR2 non-text, let the caller handle it (gh-2498)
  16417. ( xhr.responseType || "text" ) !== "text" ||
  16418. typeof xhr.responseText !== "string" ?
  16419. { binary: xhr.response } :
  16420. { text: xhr.responseText },
  16421. xhr.getAllResponseHeaders()
  16422. );
  16423. }
  16424. }
  16425. };
  16426. };
  16427. // Listen to events
  16428. xhr.onload = callback();
  16429. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16430. // Support: IE 9 only
  16431. // Use onreadystatechange to replace onabort
  16432. // to handle uncaught aborts
  16433. if ( xhr.onabort !== undefined ) {
  16434. xhr.onabort = errorCallback;
  16435. } else {
  16436. xhr.onreadystatechange = function() {
  16437. // Check readyState before timeout as it changes
  16438. if ( xhr.readyState === 4 ) {
  16439. // Allow onerror to be called first,
  16440. // but that will not handle a native abort
  16441. // Also, save errorCallback to a variable
  16442. // as xhr.onerror cannot be accessed
  16443. window.setTimeout( function() {
  16444. if ( callback ) {
  16445. errorCallback();
  16446. }
  16447. } );
  16448. }
  16449. };
  16450. }
  16451. // Create the abort callback
  16452. callback = callback( "abort" );
  16453. try {
  16454. // Do send the request (this may raise an exception)
  16455. xhr.send( options.hasContent && options.data || null );
  16456. } catch ( e ) {
  16457. // #14683: Only rethrow if this hasn't been notified as an error yet
  16458. if ( callback ) {
  16459. throw e;
  16460. }
  16461. }
  16462. },
  16463. abort: function() {
  16464. if ( callback ) {
  16465. callback();
  16466. }
  16467. }
  16468. };
  16469. }
  16470. } );
  16471. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16472. jQuery.ajaxPrefilter( function( s ) {
  16473. if ( s.crossDomain ) {
  16474. s.contents.script = false;
  16475. }
  16476. } );
  16477. // Install script dataType
  16478. jQuery.ajaxSetup( {
  16479. accepts: {
  16480. script: "text/javascript, application/javascript, " +
  16481. "application/ecmascript, application/x-ecmascript"
  16482. },
  16483. contents: {
  16484. script: /\b(?:java|ecma)script\b/
  16485. },
  16486. converters: {
  16487. "text script": function( text ) {
  16488. jQuery.globalEval( text );
  16489. return text;
  16490. }
  16491. }
  16492. } );
  16493. // Handle cache's special case and crossDomain
  16494. jQuery.ajaxPrefilter( "script", function( s ) {
  16495. if ( s.cache === undefined ) {
  16496. s.cache = false;
  16497. }
  16498. if ( s.crossDomain ) {
  16499. s.type = "GET";
  16500. }
  16501. } );
  16502. // Bind script tag hack transport
  16503. jQuery.ajaxTransport( "script", function( s ) {
  16504. // This transport only deals with cross domain or forced-by-attrs requests
  16505. if ( s.crossDomain || s.scriptAttrs ) {
  16506. var script, callback;
  16507. return {
  16508. send: function( _, complete ) {
  16509. script = jQuery( "<script>" )
  16510. .attr( s.scriptAttrs || {} )
  16511. .prop( { charset: s.scriptCharset, src: s.url } )
  16512. .on( "load error", callback = function( evt ) {
  16513. script.remove();
  16514. callback = null;
  16515. if ( evt ) {
  16516. complete( evt.type === "error" ? 404 : 200, evt.type );
  16517. }
  16518. } );
  16519. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16520. document.head.appendChild( script[ 0 ] );
  16521. },
  16522. abort: function() {
  16523. if ( callback ) {
  16524. callback();
  16525. }
  16526. }
  16527. };
  16528. }
  16529. } );
  16530. var oldCallbacks = [],
  16531. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16532. // Default jsonp settings
  16533. jQuery.ajaxSetup( {
  16534. jsonp: "callback",
  16535. jsonpCallback: function() {
  16536. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16537. this[ callback ] = true;
  16538. return callback;
  16539. }
  16540. } );
  16541. // Detect, normalize options and install callbacks for jsonp requests
  16542. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16543. var callbackName, overwritten, responseContainer,
  16544. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16545. "url" :
  16546. typeof s.data === "string" &&
  16547. ( s.contentType || "" )
  16548. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16549. rjsonp.test( s.data ) && "data"
  16550. );
  16551. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16552. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16553. // Get callback name, remembering preexisting value associated with it
  16554. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16555. s.jsonpCallback() :
  16556. s.jsonpCallback;
  16557. // Insert callback into url or form data
  16558. if ( jsonProp ) {
  16559. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16560. } else if ( s.jsonp !== false ) {
  16561. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16562. }
  16563. // Use data converter to retrieve json after script execution
  16564. s.converters[ "script json" ] = function() {
  16565. if ( !responseContainer ) {
  16566. jQuery.error( callbackName + " was not called" );
  16567. }
  16568. return responseContainer[ 0 ];
  16569. };
  16570. // Force json dataType
  16571. s.dataTypes[ 0 ] = "json";
  16572. // Install callback
  16573. overwritten = window[ callbackName ];
  16574. window[ callbackName ] = function() {
  16575. responseContainer = arguments;
  16576. };
  16577. // Clean-up function (fires after converters)
  16578. jqXHR.always( function() {
  16579. // If previous value didn't exist - remove it
  16580. if ( overwritten === undefined ) {
  16581. jQuery( window ).removeProp( callbackName );
  16582. // Otherwise restore preexisting value
  16583. } else {
  16584. window[ callbackName ] = overwritten;
  16585. }
  16586. // Save back as free
  16587. if ( s[ callbackName ] ) {
  16588. // Make sure that re-using the options doesn't screw things around
  16589. s.jsonpCallback = originalSettings.jsonpCallback;
  16590. // Save the callback name for future use
  16591. oldCallbacks.push( callbackName );
  16592. }
  16593. // Call if it was a function and we have a response
  16594. if ( responseContainer && isFunction( overwritten ) ) {
  16595. overwritten( responseContainer[ 0 ] );
  16596. }
  16597. responseContainer = overwritten = undefined;
  16598. } );
  16599. // Delegate to script
  16600. return "script";
  16601. }
  16602. } );
  16603. // Support: Safari 8 only
  16604. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16605. // collapse sibling forms: the second one becomes a child of the first one.
  16606. // Because of that, this security measure has to be disabled in Safari 8.
  16607. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16608. support.createHTMLDocument = ( function() {
  16609. var body = document.implementation.createHTMLDocument( "" ).body;
  16610. body.innerHTML = "<form></form><form></form>";
  16611. return body.childNodes.length === 2;
  16612. } )();
  16613. // Argument "data" should be string of html
  16614. // context (optional): If specified, the fragment will be created in this context,
  16615. // defaults to document
  16616. // keepScripts (optional): If true, will include scripts passed in the html string
  16617. jQuery.parseHTML = function( data, context, keepScripts ) {
  16618. if ( typeof data !== "string" ) {
  16619. return [];
  16620. }
  16621. if ( typeof context === "boolean" ) {
  16622. keepScripts = context;
  16623. context = false;
  16624. }
  16625. var base, parsed, scripts;
  16626. if ( !context ) {
  16627. // Stop scripts or inline event handlers from being executed immediately
  16628. // by using document.implementation
  16629. if ( support.createHTMLDocument ) {
  16630. context = document.implementation.createHTMLDocument( "" );
  16631. // Set the base href for the created document
  16632. // so any parsed elements with URLs
  16633. // are based on the document's URL (gh-2965)
  16634. base = context.createElement( "base" );
  16635. base.href = document.location.href;
  16636. context.head.appendChild( base );
  16637. } else {
  16638. context = document;
  16639. }
  16640. }
  16641. parsed = rsingleTag.exec( data );
  16642. scripts = !keepScripts && [];
  16643. // Single tag
  16644. if ( parsed ) {
  16645. return [ context.createElement( parsed[ 1 ] ) ];
  16646. }
  16647. parsed = buildFragment( [ data ], context, scripts );
  16648. if ( scripts && scripts.length ) {
  16649. jQuery( scripts ).remove();
  16650. }
  16651. return jQuery.merge( [], parsed.childNodes );
  16652. };
  16653. /**
  16654. * Load a url into a page
  16655. */
  16656. jQuery.fn.load = function( url, params, callback ) {
  16657. var selector, type, response,
  16658. self = this,
  16659. off = url.indexOf( " " );
  16660. if ( off > -1 ) {
  16661. selector = stripAndCollapse( url.slice( off ) );
  16662. url = url.slice( 0, off );
  16663. }
  16664. // If it's a function
  16665. if ( isFunction( params ) ) {
  16666. // We assume that it's the callback
  16667. callback = params;
  16668. params = undefined;
  16669. // Otherwise, build a param string
  16670. } else if ( params && typeof params === "object" ) {
  16671. type = "POST";
  16672. }
  16673. // If we have elements to modify, make the request
  16674. if ( self.length > 0 ) {
  16675. jQuery.ajax( {
  16676. url: url,
  16677. // If "type" variable is undefined, then "GET" method will be used.
  16678. // Make value of this field explicit since
  16679. // user can override it through ajaxSetup method
  16680. type: type || "GET",
  16681. dataType: "html",
  16682. data: params
  16683. } ).done( function( responseText ) {
  16684. // Save response for use in complete callback
  16685. response = arguments;
  16686. self.html( selector ?
  16687. // If a selector was specified, locate the right elements in a dummy div
  16688. // Exclude scripts to avoid IE 'Permission Denied' errors
  16689. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16690. // Otherwise use the full result
  16691. responseText );
  16692. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16693. // but they are ignored because response was set above.
  16694. // If it fails, this function gets "jqXHR", "status", "error"
  16695. } ).always( callback && function( jqXHR, status ) {
  16696. self.each( function() {
  16697. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16698. } );
  16699. } );
  16700. }
  16701. return this;
  16702. };
  16703. // Attach a bunch of functions for handling common AJAX events
  16704. jQuery.each( [
  16705. "ajaxStart",
  16706. "ajaxStop",
  16707. "ajaxComplete",
  16708. "ajaxError",
  16709. "ajaxSuccess",
  16710. "ajaxSend"
  16711. ], function( i, type ) {
  16712. jQuery.fn[ type ] = function( fn ) {
  16713. return this.on( type, fn );
  16714. };
  16715. } );
  16716. jQuery.expr.pseudos.animated = function( elem ) {
  16717. return jQuery.grep( jQuery.timers, function( fn ) {
  16718. return elem === fn.elem;
  16719. } ).length;
  16720. };
  16721. jQuery.offset = {
  16722. setOffset: function( elem, options, i ) {
  16723. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16724. position = jQuery.css( elem, "position" ),
  16725. curElem = jQuery( elem ),
  16726. props = {};
  16727. // Set position first, in-case top/left are set even on static elem
  16728. if ( position === "static" ) {
  16729. elem.style.position = "relative";
  16730. }
  16731. curOffset = curElem.offset();
  16732. curCSSTop = jQuery.css( elem, "top" );
  16733. curCSSLeft = jQuery.css( elem, "left" );
  16734. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16735. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16736. // Need to be able to calculate position if either
  16737. // top or left is auto and position is either absolute or fixed
  16738. if ( calculatePosition ) {
  16739. curPosition = curElem.position();
  16740. curTop = curPosition.top;
  16741. curLeft = curPosition.left;
  16742. } else {
  16743. curTop = parseFloat( curCSSTop ) || 0;
  16744. curLeft = parseFloat( curCSSLeft ) || 0;
  16745. }
  16746. if ( isFunction( options ) ) {
  16747. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16748. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16749. }
  16750. if ( options.top != null ) {
  16751. props.top = ( options.top - curOffset.top ) + curTop;
  16752. }
  16753. if ( options.left != null ) {
  16754. props.left = ( options.left - curOffset.left ) + curLeft;
  16755. }
  16756. if ( "using" in options ) {
  16757. options.using.call( elem, props );
  16758. } else {
  16759. curElem.css( props );
  16760. }
  16761. }
  16762. };
  16763. jQuery.fn.extend( {
  16764. // offset() relates an element's border box to the document origin
  16765. offset: function( options ) {
  16766. // Preserve chaining for setter
  16767. if ( arguments.length ) {
  16768. return options === undefined ?
  16769. this :
  16770. this.each( function( i ) {
  16771. jQuery.offset.setOffset( this, options, i );
  16772. } );
  16773. }
  16774. var rect, win,
  16775. elem = this[ 0 ];
  16776. if ( !elem ) {
  16777. return;
  16778. }
  16779. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16780. // Support: IE <=11 only
  16781. // Running getBoundingClientRect on a
  16782. // disconnected node in IE throws an error
  16783. if ( !elem.getClientRects().length ) {
  16784. return { top: 0, left: 0 };
  16785. }
  16786. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16787. rect = elem.getBoundingClientRect();
  16788. win = elem.ownerDocument.defaultView;
  16789. return {
  16790. top: rect.top + win.pageYOffset,
  16791. left: rect.left + win.pageXOffset
  16792. };
  16793. },
  16794. // position() relates an element's margin box to its offset parent's padding box
  16795. // This corresponds to the behavior of CSS absolute positioning
  16796. position: function() {
  16797. if ( !this[ 0 ] ) {
  16798. return;
  16799. }
  16800. var offsetParent, offset, doc,
  16801. elem = this[ 0 ],
  16802. parentOffset = { top: 0, left: 0 };
  16803. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16804. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16805. // Assume position:fixed implies availability of getBoundingClientRect
  16806. offset = elem.getBoundingClientRect();
  16807. } else {
  16808. offset = this.offset();
  16809. // Account for the *real* offset parent, which can be the document or its root element
  16810. // when a statically positioned element is identified
  16811. doc = elem.ownerDocument;
  16812. offsetParent = elem.offsetParent || doc.documentElement;
  16813. while ( offsetParent &&
  16814. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16815. jQuery.css( offsetParent, "position" ) === "static" ) {
  16816. offsetParent = offsetParent.parentNode;
  16817. }
  16818. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16819. // Incorporate borders into its offset, since they are outside its content origin
  16820. parentOffset = jQuery( offsetParent ).offset();
  16821. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16822. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16823. }
  16824. }
  16825. // Subtract parent offsets and element margins
  16826. return {
  16827. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16828. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16829. };
  16830. },
  16831. // This method will return documentElement in the following cases:
  16832. // 1) For the element inside the iframe without offsetParent, this method will return
  16833. // documentElement of the parent window
  16834. // 2) For the hidden or detached element
  16835. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16836. //
  16837. // but those exceptions were never presented as a real life use-cases
  16838. // and might be considered as more preferable results.
  16839. //
  16840. // This logic, however, is not guaranteed and can change at any point in the future
  16841. offsetParent: function() {
  16842. return this.map( function() {
  16843. var offsetParent = this.offsetParent;
  16844. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16845. offsetParent = offsetParent.offsetParent;
  16846. }
  16847. return offsetParent || documentElement;
  16848. } );
  16849. }
  16850. } );
  16851. // Create scrollLeft and scrollTop methods
  16852. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16853. var top = "pageYOffset" === prop;
  16854. jQuery.fn[ method ] = function( val ) {
  16855. return access( this, function( elem, method, val ) {
  16856. // Coalesce documents and windows
  16857. var win;
  16858. if ( isWindow( elem ) ) {
  16859. win = elem;
  16860. } else if ( elem.nodeType === 9 ) {
  16861. win = elem.defaultView;
  16862. }
  16863. if ( val === undefined ) {
  16864. return win ? win[ prop ] : elem[ method ];
  16865. }
  16866. if ( win ) {
  16867. win.scrollTo(
  16868. !top ? val : win.pageXOffset,
  16869. top ? val : win.pageYOffset
  16870. );
  16871. } else {
  16872. elem[ method ] = val;
  16873. }
  16874. }, method, val, arguments.length );
  16875. };
  16876. } );
  16877. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16878. // Add the top/left cssHooks using jQuery.fn.position
  16879. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16880. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16881. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16882. // rather than make the css module depend on the offset module, just check for it here
  16883. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16884. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16885. function( elem, computed ) {
  16886. if ( computed ) {
  16887. computed = curCSS( elem, prop );
  16888. // If curCSS returns percentage, fallback to offset
  16889. return rnumnonpx.test( computed ) ?
  16890. jQuery( elem ).position()[ prop ] + "px" :
  16891. computed;
  16892. }
  16893. }
  16894. );
  16895. } );
  16896. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16897. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16898. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16899. function( defaultExtra, funcName ) {
  16900. // Margin is only for outerHeight, outerWidth
  16901. jQuery.fn[ funcName ] = function( margin, value ) {
  16902. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16903. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16904. return access( this, function( elem, type, value ) {
  16905. var doc;
  16906. if ( isWindow( elem ) ) {
  16907. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  16908. return funcName.indexOf( "outer" ) === 0 ?
  16909. elem[ "inner" + name ] :
  16910. elem.document.documentElement[ "client" + name ];
  16911. }
  16912. // Get document width or height
  16913. if ( elem.nodeType === 9 ) {
  16914. doc = elem.documentElement;
  16915. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  16916. // whichever is greatest
  16917. return Math.max(
  16918. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  16919. elem.body[ "offset" + name ], doc[ "offset" + name ],
  16920. doc[ "client" + name ]
  16921. );
  16922. }
  16923. return value === undefined ?
  16924. // Get width or height on the element, requesting but not forcing parseFloat
  16925. jQuery.css( elem, type, extra ) :
  16926. // Set width or height on the element
  16927. jQuery.style( elem, type, value, extra );
  16928. }, type, chainable ? margin : undefined, chainable );
  16929. };
  16930. } );
  16931. } );
  16932. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  16933. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  16934. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  16935. function( i, name ) {
  16936. // Handle event binding
  16937. jQuery.fn[ name ] = function( data, fn ) {
  16938. return arguments.length > 0 ?
  16939. this.on( name, null, data, fn ) :
  16940. this.trigger( name );
  16941. };
  16942. } );
  16943. jQuery.fn.extend( {
  16944. hover: function( fnOver, fnOut ) {
  16945. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  16946. }
  16947. } );
  16948. jQuery.fn.extend( {
  16949. bind: function( types, data, fn ) {
  16950. return this.on( types, null, data, fn );
  16951. },
  16952. unbind: function( types, fn ) {
  16953. return this.off( types, null, fn );
  16954. },
  16955. delegate: function( selector, types, data, fn ) {
  16956. return this.on( types, selector, data, fn );
  16957. },
  16958. undelegate: function( selector, types, fn ) {
  16959. // ( namespace ) or ( selector, types [, fn] )
  16960. return arguments.length === 1 ?
  16961. this.off( selector, "**" ) :
  16962. this.off( types, selector || "**", fn );
  16963. }
  16964. } );
  16965. // Bind a function to a context, optionally partially applying any
  16966. // arguments.
  16967. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  16968. // However, it is not slated for removal any time soon
  16969. jQuery.proxy = function( fn, context ) {
  16970. var tmp, args, proxy;
  16971. if ( typeof context === "string" ) {
  16972. tmp = fn[ context ];
  16973. context = fn;
  16974. fn = tmp;
  16975. }
  16976. // Quick check to determine if target is callable, in the spec
  16977. // this throws a TypeError, but we will just return undefined.
  16978. if ( !isFunction( fn ) ) {
  16979. return undefined;
  16980. }
  16981. // Simulated bind
  16982. args = slice.call( arguments, 2 );
  16983. proxy = function() {
  16984. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  16985. };
  16986. // Set the guid of unique handler to the same of original handler, so it can be removed
  16987. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  16988. return proxy;
  16989. };
  16990. jQuery.holdReady = function( hold ) {
  16991. if ( hold ) {
  16992. jQuery.readyWait++;
  16993. } else {
  16994. jQuery.ready( true );
  16995. }
  16996. };
  16997. jQuery.isArray = Array.isArray;
  16998. jQuery.parseJSON = JSON.parse;
  16999. jQuery.nodeName = nodeName;
  17000. jQuery.isFunction = isFunction;
  17001. jQuery.isWindow = isWindow;
  17002. jQuery.camelCase = camelCase;
  17003. jQuery.type = toType;
  17004. jQuery.now = Date.now;
  17005. jQuery.isNumeric = function( obj ) {
  17006. // As of jQuery 3.0, isNumeric is limited to
  17007. // strings and numbers (primitives or objects)
  17008. // that can be coerced to finite numbers (gh-2662)
  17009. var type = jQuery.type( obj );
  17010. return ( type === "number" || type === "string" ) &&
  17011. // parseFloat NaNs numeric-cast false positives ("")
  17012. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17013. // subtraction forces infinities to NaN
  17014. !isNaN( obj - parseFloat( obj ) );
  17015. };
  17016. // Register as a named AMD module, since jQuery can be concatenated with other
  17017. // files that may use define, but not via a proper concatenation script that
  17018. // understands anonymous AMD modules. A named AMD is safest and most robust
  17019. // way to register. Lowercase jquery is used because AMD module names are
  17020. // derived from file names, and jQuery is normally delivered in a lowercase
  17021. // file name. Do this after creating the global so that if an AMD module wants
  17022. // to call noConflict to hide this version of jQuery, it will work.
  17023. // Note that for maximum portability, libraries that are not jQuery should
  17024. // declare themselves as anonymous modules, and avoid setting a global if an
  17025. // AMD loader is present. jQuery is a special case. For more information, see
  17026. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17027. if ( true ) {
  17028. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17029. return jQuery;
  17030. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17031. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17032. }
  17033. var
  17034. // Map over jQuery in case of overwrite
  17035. _jQuery = window.jQuery,
  17036. // Map over the $ in case of overwrite
  17037. _$ = window.$;
  17038. jQuery.noConflict = function( deep ) {
  17039. if ( window.$ === jQuery ) {
  17040. window.$ = _$;
  17041. }
  17042. if ( deep && window.jQuery === jQuery ) {
  17043. window.jQuery = _jQuery;
  17044. }
  17045. return jQuery;
  17046. };
  17047. // Expose jQuery and $ identifiers, even in AMD
  17048. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17049. // and CommonJS for browser emulators (#13566)
  17050. if ( !noGlobal ) {
  17051. window.jQuery = window.$ = jQuery;
  17052. }
  17053. return jQuery;
  17054. } );
  17055. /***/ }),
  17056. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17057. /*!************************************************!*\
  17058. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17059. \************************************************/
  17060. /*! exports provided: default */
  17061. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17062. "use strict";
  17063. __webpack_require__.r(__webpack_exports__);
  17064. var classCallCheck = function (instance, Constructor) {
  17065. if (!(instance instanceof Constructor)) {
  17066. throw new TypeError("Cannot call a class as a function");
  17067. }
  17068. };
  17069. var createClass = function () {
  17070. function defineProperties(target, props) {
  17071. for (var i = 0; i < props.length; i++) {
  17072. var descriptor = props[i];
  17073. descriptor.enumerable = descriptor.enumerable || false;
  17074. descriptor.configurable = true;
  17075. if ("value" in descriptor) descriptor.writable = true;
  17076. Object.defineProperty(target, descriptor.key, descriptor);
  17077. }
  17078. }
  17079. return function (Constructor, protoProps, staticProps) {
  17080. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17081. if (staticProps) defineProperties(Constructor, staticProps);
  17082. return Constructor;
  17083. };
  17084. }();
  17085. var _extends = Object.assign || function (target) {
  17086. for (var i = 1; i < arguments.length; i++) {
  17087. var source = arguments[i];
  17088. for (var key in source) {
  17089. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17090. target[key] = source[key];
  17091. }
  17092. }
  17093. }
  17094. return target;
  17095. };
  17096. var inherits = function (subClass, superClass) {
  17097. if (typeof superClass !== "function" && superClass !== null) {
  17098. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17099. }
  17100. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17101. constructor: {
  17102. value: subClass,
  17103. enumerable: false,
  17104. writable: true,
  17105. configurable: true
  17106. }
  17107. });
  17108. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17109. };
  17110. var possibleConstructorReturn = function (self, call) {
  17111. if (!self) {
  17112. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17113. }
  17114. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17115. };
  17116. var Connector = function () {
  17117. /**
  17118. * Create a new class instance.
  17119. */
  17120. function Connector(options) {
  17121. classCallCheck(this, Connector);
  17122. /**
  17123. * Default connector options.
  17124. */
  17125. this._defaultOptions = {
  17126. auth: {
  17127. headers: {}
  17128. },
  17129. authEndpoint: '/broadcasting/auth',
  17130. broadcaster: 'pusher',
  17131. csrfToken: null,
  17132. host: null,
  17133. key: null,
  17134. namespace: 'App.Events'
  17135. };
  17136. this.setOptions(options);
  17137. this.connect();
  17138. }
  17139. /**
  17140. * Merge the custom options with the defaults.
  17141. */
  17142. createClass(Connector, [{
  17143. key: 'setOptions',
  17144. value: function setOptions(options) {
  17145. this.options = _extends(this._defaultOptions, options);
  17146. if (this.csrfToken()) {
  17147. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17148. }
  17149. return options;
  17150. }
  17151. /**
  17152. * Extract the CSRF token from the page.
  17153. */
  17154. }, {
  17155. key: 'csrfToken',
  17156. value: function csrfToken() {
  17157. var selector = void 0;
  17158. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17159. return window['Laravel'].csrfToken;
  17160. } else if (this.options.csrfToken) {
  17161. return this.options.csrfToken;
  17162. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17163. return selector.getAttribute('content');
  17164. }
  17165. return null;
  17166. }
  17167. }]);
  17168. return Connector;
  17169. }();
  17170. /**
  17171. * This class represents a basic channel.
  17172. */
  17173. var Channel = function () {
  17174. function Channel() {
  17175. classCallCheck(this, Channel);
  17176. }
  17177. createClass(Channel, [{
  17178. key: 'listenForWhisper',
  17179. /**
  17180. * Listen for a whisper event on the channel instance.
  17181. */
  17182. value: function listenForWhisper(event, callback) {
  17183. return this.listen('.client-' + event, callback);
  17184. }
  17185. /**
  17186. * Listen for an event on the channel instance.
  17187. */
  17188. }, {
  17189. key: 'notification',
  17190. value: function notification(callback) {
  17191. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17192. }
  17193. /**
  17194. * Stop listening for a whispser event on the channel instance.
  17195. */
  17196. }, {
  17197. key: 'stopListeningForWhisper',
  17198. value: function stopListeningForWhisper(event) {
  17199. return this.stopListening('.client-' + event);
  17200. }
  17201. }]);
  17202. return Channel;
  17203. }();
  17204. /**
  17205. * Event name formatter
  17206. */
  17207. var EventFormatter = function () {
  17208. /**
  17209. * Create a new class instance.
  17210. */
  17211. function EventFormatter(namespace) {
  17212. classCallCheck(this, EventFormatter);
  17213. this.setNamespace(namespace);
  17214. }
  17215. /**
  17216. * Format the given event name.
  17217. */
  17218. createClass(EventFormatter, [{
  17219. key: 'format',
  17220. value: function format(event) {
  17221. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17222. return event.substr(1);
  17223. } else if (this.namespace) {
  17224. event = this.namespace + '.' + event;
  17225. }
  17226. return event.replace(/\./g, '\\');
  17227. }
  17228. /**
  17229. * Set the event namespace.
  17230. */
  17231. }, {
  17232. key: 'setNamespace',
  17233. value: function setNamespace(value) {
  17234. this.namespace = value;
  17235. }
  17236. }]);
  17237. return EventFormatter;
  17238. }();
  17239. /**
  17240. * This class represents a Pusher channel.
  17241. */
  17242. var PusherChannel = function (_Channel) {
  17243. inherits(PusherChannel, _Channel);
  17244. /**
  17245. * Create a new class instance.
  17246. */
  17247. function PusherChannel(pusher, name, options) {
  17248. classCallCheck(this, PusherChannel);
  17249. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17250. _this.name = name;
  17251. _this.pusher = pusher;
  17252. _this.options = options;
  17253. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17254. _this.subscribe();
  17255. return _this;
  17256. }
  17257. /**
  17258. * Subscribe to a Pusher channel.
  17259. */
  17260. createClass(PusherChannel, [{
  17261. key: 'subscribe',
  17262. value: function subscribe() {
  17263. this.subscription = this.pusher.subscribe(this.name);
  17264. }
  17265. /**
  17266. * Unsubscribe from a Pusher channel.
  17267. */
  17268. }, {
  17269. key: 'unsubscribe',
  17270. value: function unsubscribe() {
  17271. this.pusher.unsubscribe(this.name);
  17272. }
  17273. /**
  17274. * Listen for an event on the channel instance.
  17275. */
  17276. }, {
  17277. key: 'listen',
  17278. value: function listen(event, callback) {
  17279. this.on(this.eventFormatter.format(event), callback);
  17280. return this;
  17281. }
  17282. /**
  17283. * Stop listening for an event on the channel instance.
  17284. */
  17285. }, {
  17286. key: 'stopListening',
  17287. value: function stopListening(event) {
  17288. this.subscription.unbind(this.eventFormatter.format(event));
  17289. return this;
  17290. }
  17291. /**
  17292. * Bind a channel to an event.
  17293. */
  17294. }, {
  17295. key: 'on',
  17296. value: function on(event, callback) {
  17297. this.subscription.bind(event, callback);
  17298. return this;
  17299. }
  17300. }]);
  17301. return PusherChannel;
  17302. }(Channel);
  17303. /**
  17304. * This class represents a Pusher private channel.
  17305. */
  17306. var PusherPrivateChannel = function (_PusherChannel) {
  17307. inherits(PusherPrivateChannel, _PusherChannel);
  17308. function PusherPrivateChannel() {
  17309. classCallCheck(this, PusherPrivateChannel);
  17310. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17311. }
  17312. createClass(PusherPrivateChannel, [{
  17313. key: 'whisper',
  17314. /**
  17315. * Trigger client event on the channel.
  17316. */
  17317. value: function whisper(eventName, data) {
  17318. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17319. return this;
  17320. }
  17321. }]);
  17322. return PusherPrivateChannel;
  17323. }(PusherChannel);
  17324. /**
  17325. * This class represents a Pusher presence channel.
  17326. */
  17327. var PusherPresenceChannel = function (_PusherChannel) {
  17328. inherits(PusherPresenceChannel, _PusherChannel);
  17329. function PusherPresenceChannel() {
  17330. classCallCheck(this, PusherPresenceChannel);
  17331. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17332. }
  17333. createClass(PusherPresenceChannel, [{
  17334. key: 'here',
  17335. /**
  17336. * Register a callback to be called anytime the member list changes.
  17337. */
  17338. value: function here(callback) {
  17339. this.on('pusher:subscription_succeeded', function (data) {
  17340. callback(Object.keys(data.members).map(function (k) {
  17341. return data.members[k];
  17342. }));
  17343. });
  17344. return this;
  17345. }
  17346. /**
  17347. * Listen for someone joining the channel.
  17348. */
  17349. }, {
  17350. key: 'joining',
  17351. value: function joining(callback) {
  17352. this.on('pusher:member_added', function (member) {
  17353. callback(member.info);
  17354. });
  17355. return this;
  17356. }
  17357. /**
  17358. * Listen for someone leaving the channel.
  17359. */
  17360. }, {
  17361. key: 'leaving',
  17362. value: function leaving(callback) {
  17363. this.on('pusher:member_removed', function (member) {
  17364. callback(member.info);
  17365. });
  17366. return this;
  17367. }
  17368. /**
  17369. * Trigger client event on the channel.
  17370. */
  17371. }, {
  17372. key: 'whisper',
  17373. value: function whisper(eventName, data) {
  17374. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17375. return this;
  17376. }
  17377. }]);
  17378. return PusherPresenceChannel;
  17379. }(PusherChannel);
  17380. /**
  17381. * This class represents a Socket.io channel.
  17382. */
  17383. var SocketIoChannel = function (_Channel) {
  17384. inherits(SocketIoChannel, _Channel);
  17385. /**
  17386. * Create a new class instance.
  17387. */
  17388. function SocketIoChannel(socket, name, options) {
  17389. classCallCheck(this, SocketIoChannel);
  17390. /**
  17391. * The event callbacks applied to the channel.
  17392. */
  17393. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17394. _this.events = {};
  17395. _this.name = name;
  17396. _this.socket = socket;
  17397. _this.options = options;
  17398. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17399. _this.subscribe();
  17400. _this.configureReconnector();
  17401. return _this;
  17402. }
  17403. /**
  17404. * Subscribe to a Socket.io channel.
  17405. */
  17406. createClass(SocketIoChannel, [{
  17407. key: 'subscribe',
  17408. value: function subscribe() {
  17409. this.socket.emit('subscribe', {
  17410. channel: this.name,
  17411. auth: this.options.auth || {}
  17412. });
  17413. }
  17414. /**
  17415. * Unsubscribe from channel and ubind event callbacks.
  17416. */
  17417. }, {
  17418. key: 'unsubscribe',
  17419. value: function unsubscribe() {
  17420. this.unbind();
  17421. this.socket.emit('unsubscribe', {
  17422. channel: this.name,
  17423. auth: this.options.auth || {}
  17424. });
  17425. }
  17426. /**
  17427. * Listen for an event on the channel instance.
  17428. */
  17429. }, {
  17430. key: 'listen',
  17431. value: function listen(event, callback) {
  17432. this.on(this.eventFormatter.format(event), callback);
  17433. return this;
  17434. }
  17435. /**
  17436. * Stop listening for an event on the channel instance.
  17437. */
  17438. }, {
  17439. key: 'stopListening',
  17440. value: function stopListening(event) {
  17441. var name = this.eventFormatter.format(event);
  17442. this.socket.removeListener(name);
  17443. delete this.events[name];
  17444. return this;
  17445. }
  17446. /**
  17447. * Bind the channel's socket to an event and store the callback.
  17448. */
  17449. }, {
  17450. key: 'on',
  17451. value: function on(event, callback) {
  17452. var _this2 = this;
  17453. var listener = function listener(channel, data) {
  17454. if (_this2.name == channel) {
  17455. callback(data);
  17456. }
  17457. };
  17458. this.socket.on(event, listener);
  17459. this.bind(event, listener);
  17460. }
  17461. /**
  17462. * Attach a 'reconnect' listener and bind the event.
  17463. */
  17464. }, {
  17465. key: 'configureReconnector',
  17466. value: function configureReconnector() {
  17467. var _this3 = this;
  17468. var listener = function listener() {
  17469. _this3.subscribe();
  17470. };
  17471. this.socket.on('reconnect', listener);
  17472. this.bind('reconnect', listener);
  17473. }
  17474. /**
  17475. * Bind the channel's socket to an event and store the callback.
  17476. */
  17477. }, {
  17478. key: 'bind',
  17479. value: function bind(event, callback) {
  17480. this.events[event] = this.events[event] || [];
  17481. this.events[event].push(callback);
  17482. }
  17483. /**
  17484. * Unbind the channel's socket from all stored event callbacks.
  17485. */
  17486. }, {
  17487. key: 'unbind',
  17488. value: function unbind() {
  17489. var _this4 = this;
  17490. Object.keys(this.events).forEach(function (event) {
  17491. _this4.events[event].forEach(function (callback) {
  17492. _this4.socket.removeListener(event, callback);
  17493. });
  17494. delete _this4.events[event];
  17495. });
  17496. }
  17497. }]);
  17498. return SocketIoChannel;
  17499. }(Channel);
  17500. /**
  17501. * This class represents a Socket.io presence channel.
  17502. */
  17503. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17504. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17505. function SocketIoPrivateChannel() {
  17506. classCallCheck(this, SocketIoPrivateChannel);
  17507. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17508. }
  17509. createClass(SocketIoPrivateChannel, [{
  17510. key: 'whisper',
  17511. /**
  17512. * Trigger client event on the channel.
  17513. */
  17514. value: function whisper(eventName, data) {
  17515. this.socket.emit('client event', {
  17516. channel: this.name,
  17517. event: 'client-' + eventName,
  17518. data: data
  17519. });
  17520. return this;
  17521. }
  17522. }]);
  17523. return SocketIoPrivateChannel;
  17524. }(SocketIoChannel);
  17525. /**
  17526. * This class represents a Socket.io presence channel.
  17527. */
  17528. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17529. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17530. function SocketIoPresenceChannel() {
  17531. classCallCheck(this, SocketIoPresenceChannel);
  17532. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17533. }
  17534. createClass(SocketIoPresenceChannel, [{
  17535. key: 'here',
  17536. /**
  17537. * Register a callback to be called anytime the member list changes.
  17538. */
  17539. value: function here(callback) {
  17540. this.on('presence:subscribed', function (members) {
  17541. callback(members.map(function (m) {
  17542. return m.user_info;
  17543. }));
  17544. });
  17545. return this;
  17546. }
  17547. /**
  17548. * Listen for someone joining the channel.
  17549. */
  17550. }, {
  17551. key: 'joining',
  17552. value: function joining(callback) {
  17553. this.on('presence:joining', function (member) {
  17554. return callback(member.user_info);
  17555. });
  17556. return this;
  17557. }
  17558. /**
  17559. * Listen for someone leaving the channel.
  17560. */
  17561. }, {
  17562. key: 'leaving',
  17563. value: function leaving(callback) {
  17564. this.on('presence:leaving', function (member) {
  17565. return callback(member.user_info);
  17566. });
  17567. return this;
  17568. }
  17569. }]);
  17570. return SocketIoPresenceChannel;
  17571. }(SocketIoPrivateChannel);
  17572. /**
  17573. * This class represents a null channel.
  17574. */
  17575. var NullChannel = function (_Channel) {
  17576. inherits(NullChannel, _Channel);
  17577. function NullChannel() {
  17578. classCallCheck(this, NullChannel);
  17579. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17580. }
  17581. createClass(NullChannel, [{
  17582. key: 'subscribe',
  17583. /**
  17584. * Subscribe to a channel.
  17585. */
  17586. value: function subscribe() {}
  17587. //
  17588. /**
  17589. * Unsubscribe from a channel.
  17590. */
  17591. }, {
  17592. key: 'unsubscribe',
  17593. value: function unsubscribe() {}
  17594. //
  17595. /**
  17596. * Listen for an event on the channel instance.
  17597. */
  17598. }, {
  17599. key: 'listen',
  17600. value: function listen(event, callback) {
  17601. return this;
  17602. }
  17603. /**
  17604. * Stop listening for an event on the channel instance.
  17605. */
  17606. }, {
  17607. key: 'stopListening',
  17608. value: function stopListening(event) {
  17609. return this;
  17610. }
  17611. /**
  17612. * Bind a channel to an event.
  17613. */
  17614. }, {
  17615. key: 'on',
  17616. value: function on(event, callback) {
  17617. return this;
  17618. }
  17619. }]);
  17620. return NullChannel;
  17621. }(Channel);
  17622. /**
  17623. * This class represents a null private channel.
  17624. */
  17625. var NullPrivateChannel = function (_NullChannel) {
  17626. inherits(NullPrivateChannel, _NullChannel);
  17627. function NullPrivateChannel() {
  17628. classCallCheck(this, NullPrivateChannel);
  17629. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17630. }
  17631. createClass(NullPrivateChannel, [{
  17632. key: 'whisper',
  17633. /**
  17634. * Trigger client event on the channel.
  17635. */
  17636. value: function whisper(eventName, data) {
  17637. return this;
  17638. }
  17639. }]);
  17640. return NullPrivateChannel;
  17641. }(NullChannel);
  17642. /**
  17643. * This class represents a null presence channel.
  17644. */
  17645. var NullPresenceChannel = function (_NullChannel) {
  17646. inherits(NullPresenceChannel, _NullChannel);
  17647. function NullPresenceChannel() {
  17648. classCallCheck(this, NullPresenceChannel);
  17649. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17650. }
  17651. createClass(NullPresenceChannel, [{
  17652. key: 'here',
  17653. /**
  17654. * Register a callback to be called anytime the member list changes.
  17655. */
  17656. value: function here(callback) {
  17657. return this;
  17658. }
  17659. /**
  17660. * Listen for someone joining the channel.
  17661. */
  17662. }, {
  17663. key: 'joining',
  17664. value: function joining(callback) {
  17665. return this;
  17666. }
  17667. /**
  17668. * Listen for someone leaving the channel.
  17669. */
  17670. }, {
  17671. key: 'leaving',
  17672. value: function leaving(callback) {
  17673. return this;
  17674. }
  17675. /**
  17676. * Trigger client event on the channel.
  17677. */
  17678. }, {
  17679. key: 'whisper',
  17680. value: function whisper(eventName, data) {
  17681. return this;
  17682. }
  17683. }]);
  17684. return NullPresenceChannel;
  17685. }(NullChannel);
  17686. /**
  17687. * This class creates a connector to Pusher.
  17688. */
  17689. var PusherConnector = function (_Connector) {
  17690. inherits(PusherConnector, _Connector);
  17691. function PusherConnector() {
  17692. classCallCheck(this, PusherConnector);
  17693. /**
  17694. * All of the subscribed channel names.
  17695. */
  17696. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17697. _this.channels = {};
  17698. return _this;
  17699. }
  17700. /**
  17701. * Create a fresh Pusher connection.
  17702. */
  17703. createClass(PusherConnector, [{
  17704. key: 'connect',
  17705. value: function connect() {
  17706. if (typeof this.options.client !== 'undefined') {
  17707. this.pusher = this.options.client;
  17708. } else {
  17709. this.pusher = new Pusher(this.options.key, this.options);
  17710. }
  17711. }
  17712. /**
  17713. * Listen for an event on a channel instance.
  17714. */
  17715. }, {
  17716. key: 'listen',
  17717. value: function listen(name, event, callback) {
  17718. return this.channel(name).listen(event, callback);
  17719. }
  17720. /**
  17721. * Get a channel instance by name.
  17722. */
  17723. }, {
  17724. key: 'channel',
  17725. value: function channel(name) {
  17726. if (!this.channels[name]) {
  17727. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17728. }
  17729. return this.channels[name];
  17730. }
  17731. /**
  17732. * Get a private channel instance by name.
  17733. */
  17734. }, {
  17735. key: 'privateChannel',
  17736. value: function privateChannel(name) {
  17737. if (!this.channels['private-' + name]) {
  17738. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17739. }
  17740. return this.channels['private-' + name];
  17741. }
  17742. /**
  17743. * Get a presence channel instance by name.
  17744. */
  17745. }, {
  17746. key: 'presenceChannel',
  17747. value: function presenceChannel(name) {
  17748. if (!this.channels['presence-' + name]) {
  17749. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17750. }
  17751. return this.channels['presence-' + name];
  17752. }
  17753. /**
  17754. * Leave the given channel, as well as its private and presence variants.
  17755. */
  17756. }, {
  17757. key: 'leave',
  17758. value: function leave(name) {
  17759. var _this2 = this;
  17760. var channels = [name, 'private-' + name, 'presence-' + name];
  17761. channels.forEach(function (name, index) {
  17762. _this2.leaveChannel(name);
  17763. });
  17764. }
  17765. /**
  17766. * Leave the given channel.
  17767. */
  17768. }, {
  17769. key: 'leaveChannel',
  17770. value: function leaveChannel(name) {
  17771. if (this.channels[name]) {
  17772. this.channels[name].unsubscribe();
  17773. delete this.channels[name];
  17774. }
  17775. }
  17776. /**
  17777. * Get the socket ID for the connection.
  17778. */
  17779. }, {
  17780. key: 'socketId',
  17781. value: function socketId() {
  17782. return this.pusher.connection.socket_id;
  17783. }
  17784. /**
  17785. * Disconnect Pusher connection.
  17786. */
  17787. }, {
  17788. key: 'disconnect',
  17789. value: function disconnect() {
  17790. this.pusher.disconnect();
  17791. }
  17792. }]);
  17793. return PusherConnector;
  17794. }(Connector);
  17795. /**
  17796. * This class creates a connnector to a Socket.io server.
  17797. */
  17798. var SocketIoConnector = function (_Connector) {
  17799. inherits(SocketIoConnector, _Connector);
  17800. function SocketIoConnector() {
  17801. classCallCheck(this, SocketIoConnector);
  17802. /**
  17803. * All of the subscribed channel names.
  17804. */
  17805. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17806. _this.channels = {};
  17807. return _this;
  17808. }
  17809. /**
  17810. * Create a fresh Socket.io connection.
  17811. */
  17812. createClass(SocketIoConnector, [{
  17813. key: 'connect',
  17814. value: function connect() {
  17815. var io = this.getSocketIO();
  17816. this.socket = io(this.options.host, this.options);
  17817. return this.socket;
  17818. }
  17819. /**
  17820. * Get socket.io module from global scope or options.
  17821. */
  17822. }, {
  17823. key: 'getSocketIO',
  17824. value: function getSocketIO() {
  17825. if (typeof this.options.client !== 'undefined') {
  17826. return this.options.client;
  17827. }
  17828. if (typeof io !== 'undefined') {
  17829. return io;
  17830. }
  17831. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17832. }
  17833. /**
  17834. * Listen for an event on a channel instance.
  17835. */
  17836. }, {
  17837. key: 'listen',
  17838. value: function listen(name, event, callback) {
  17839. return this.channel(name).listen(event, callback);
  17840. }
  17841. /**
  17842. * Get a channel instance by name.
  17843. */
  17844. }, {
  17845. key: 'channel',
  17846. value: function channel(name) {
  17847. if (!this.channels[name]) {
  17848. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17849. }
  17850. return this.channels[name];
  17851. }
  17852. /**
  17853. * Get a private channel instance by name.
  17854. */
  17855. }, {
  17856. key: 'privateChannel',
  17857. value: function privateChannel(name) {
  17858. if (!this.channels['private-' + name]) {
  17859. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17860. }
  17861. return this.channels['private-' + name];
  17862. }
  17863. /**
  17864. * Get a presence channel instance by name.
  17865. */
  17866. }, {
  17867. key: 'presenceChannel',
  17868. value: function presenceChannel(name) {
  17869. if (!this.channels['presence-' + name]) {
  17870. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17871. }
  17872. return this.channels['presence-' + name];
  17873. }
  17874. /**
  17875. * Leave the given channel, as well as its private and presence variants.
  17876. */
  17877. }, {
  17878. key: 'leave',
  17879. value: function leave(name) {
  17880. var _this2 = this;
  17881. var channels = [name, 'private-' + name, 'presence-' + name];
  17882. channels.forEach(function (name) {
  17883. _this2.leaveChannel(name);
  17884. });
  17885. }
  17886. /**
  17887. * Leave the given channel.
  17888. */
  17889. }, {
  17890. key: 'leaveChannel',
  17891. value: function leaveChannel(name) {
  17892. if (this.channels[name]) {
  17893. this.channels[name].unsubscribe();
  17894. delete this.channels[name];
  17895. }
  17896. }
  17897. /**
  17898. * Get the socket ID for the connection.
  17899. */
  17900. }, {
  17901. key: 'socketId',
  17902. value: function socketId() {
  17903. return this.socket.id;
  17904. }
  17905. /**
  17906. * Disconnect Socketio connection.
  17907. */
  17908. }, {
  17909. key: 'disconnect',
  17910. value: function disconnect() {
  17911. this.socket.disconnect();
  17912. }
  17913. }]);
  17914. return SocketIoConnector;
  17915. }(Connector);
  17916. /**
  17917. * This class creates a null connector.
  17918. */
  17919. var NullConnector = function (_Connector) {
  17920. inherits(NullConnector, _Connector);
  17921. function NullConnector() {
  17922. classCallCheck(this, NullConnector);
  17923. /**
  17924. * All of the subscribed channel names.
  17925. */
  17926. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  17927. _this.channels = {};
  17928. return _this;
  17929. }
  17930. /**
  17931. * Create a fresh connection.
  17932. */
  17933. createClass(NullConnector, [{
  17934. key: 'connect',
  17935. value: function connect() {}
  17936. //
  17937. /**
  17938. * Listen for an event on a channel instance.
  17939. */
  17940. }, {
  17941. key: 'listen',
  17942. value: function listen(name, event, callback) {
  17943. return new NullChannel();
  17944. }
  17945. /**
  17946. * Get a channel instance by name.
  17947. */
  17948. }, {
  17949. key: 'channel',
  17950. value: function channel(name) {
  17951. return new NullChannel();
  17952. }
  17953. /**
  17954. * Get a private channel instance by name.
  17955. */
  17956. }, {
  17957. key: 'privateChannel',
  17958. value: function privateChannel(name) {
  17959. return new NullPrivateChannel();
  17960. }
  17961. /**
  17962. * Get a presence channel instance by name.
  17963. */
  17964. }, {
  17965. key: 'presenceChannel',
  17966. value: function presenceChannel(name) {
  17967. return new NullPresenceChannel();
  17968. }
  17969. /**
  17970. * Leave the given channel, as well as its private and presence variants.
  17971. */
  17972. }, {
  17973. key: 'leave',
  17974. value: function leave(name) {}
  17975. //
  17976. /**
  17977. * Leave the given channel.
  17978. */
  17979. }, {
  17980. key: 'leaveChannel',
  17981. value: function leaveChannel(name) {}
  17982. //
  17983. /**
  17984. * Get the socket ID for the connection.
  17985. */
  17986. }, {
  17987. key: 'socketId',
  17988. value: function socketId() {
  17989. return 'fake-socket-id';
  17990. }
  17991. /**
  17992. * Disconnect the connection.
  17993. */
  17994. }, {
  17995. key: 'disconnect',
  17996. value: function disconnect() {
  17997. //
  17998. }
  17999. }]);
  18000. return NullConnector;
  18001. }(Connector);
  18002. /**
  18003. * This class is the primary API for interacting with broadcasting.
  18004. */
  18005. var Echo = function () {
  18006. /**
  18007. * Create a new class instance.
  18008. */
  18009. function Echo(options) {
  18010. classCallCheck(this, Echo);
  18011. this.options = options;
  18012. this.connect();
  18013. if (!this.options.withoutInterceptors) {
  18014. this.registerInterceptors();
  18015. }
  18016. }
  18017. /**
  18018. * Get a channel instance by name.
  18019. */
  18020. createClass(Echo, [{
  18021. key: 'channel',
  18022. value: function channel(_channel) {
  18023. return this.connector.channel(_channel);
  18024. }
  18025. /**
  18026. * Create a new connection.
  18027. */
  18028. }, {
  18029. key: 'connect',
  18030. value: function connect() {
  18031. if (this.options.broadcaster == 'pusher') {
  18032. this.connector = new PusherConnector(this.options);
  18033. } else if (this.options.broadcaster == 'socket.io') {
  18034. this.connector = new SocketIoConnector(this.options);
  18035. } else if (this.options.broadcaster == 'null') {
  18036. this.connector = new NullConnector(this.options);
  18037. } else if (typeof this.options.broadcaster == 'function') {
  18038. this.connector = new this.options.broadcaster(this.options);
  18039. }
  18040. }
  18041. /**
  18042. * Disconnect from the Echo server.
  18043. */
  18044. }, {
  18045. key: 'disconnect',
  18046. value: function disconnect() {
  18047. this.connector.disconnect();
  18048. }
  18049. /**
  18050. * Get a presence channel instance by name.
  18051. */
  18052. }, {
  18053. key: 'join',
  18054. value: function join(channel) {
  18055. return this.connector.presenceChannel(channel);
  18056. }
  18057. /**
  18058. * Leave the given channel, as well as its private and presence variants.
  18059. */
  18060. }, {
  18061. key: 'leave',
  18062. value: function leave(channel) {
  18063. this.connector.leave(channel);
  18064. }
  18065. /**
  18066. * Leave the given channel.
  18067. */
  18068. }, {
  18069. key: 'leaveChannel',
  18070. value: function leaveChannel(channel) {
  18071. this.connector.leaveChannel(channel);
  18072. }
  18073. /**
  18074. * Listen for an event on a channel instance.
  18075. */
  18076. }, {
  18077. key: 'listen',
  18078. value: function listen(channel, event, callback) {
  18079. return this.connector.listen(channel, event, callback);
  18080. }
  18081. /**
  18082. * Get a private channel instance by name.
  18083. */
  18084. }, {
  18085. key: 'private',
  18086. value: function _private(channel) {
  18087. return this.connector.privateChannel(channel);
  18088. }
  18089. /**
  18090. * Get the Socket ID for the connection.
  18091. */
  18092. }, {
  18093. key: 'socketId',
  18094. value: function socketId() {
  18095. return this.connector.socketId();
  18096. }
  18097. /**
  18098. * Register 3rd party request interceptiors. These are used to automatically
  18099. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18100. */
  18101. }, {
  18102. key: 'registerInterceptors',
  18103. value: function registerInterceptors() {
  18104. if (typeof Vue === 'function' && Vue.http) {
  18105. this.registerVueRequestInterceptor();
  18106. }
  18107. if (typeof axios === 'function') {
  18108. this.registerAxiosRequestInterceptor();
  18109. }
  18110. if (typeof jQuery === 'function') {
  18111. this.registerjQueryAjaxSetup();
  18112. }
  18113. }
  18114. /**
  18115. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18116. */
  18117. }, {
  18118. key: 'registerVueRequestInterceptor',
  18119. value: function registerVueRequestInterceptor() {
  18120. var _this = this;
  18121. Vue.http.interceptors.push(function (request, next) {
  18122. if (_this.socketId()) {
  18123. request.headers.set('X-Socket-ID', _this.socketId());
  18124. }
  18125. next();
  18126. });
  18127. }
  18128. /**
  18129. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18130. */
  18131. }, {
  18132. key: 'registerAxiosRequestInterceptor',
  18133. value: function registerAxiosRequestInterceptor() {
  18134. var _this2 = this;
  18135. axios.interceptors.request.use(function (config) {
  18136. if (_this2.socketId()) {
  18137. config.headers['X-Socket-Id'] = _this2.socketId();
  18138. }
  18139. return config;
  18140. });
  18141. }
  18142. /**
  18143. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18144. */
  18145. }, {
  18146. key: 'registerjQueryAjaxSetup',
  18147. value: function registerjQueryAjaxSetup() {
  18148. var _this3 = this;
  18149. if (typeof jQuery.ajax != 'undefined') {
  18150. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18151. if (_this3.socketId()) {
  18152. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18153. }
  18154. });
  18155. }
  18156. }
  18157. }]);
  18158. return Echo;
  18159. }();
  18160. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18161. /***/ }),
  18162. /***/ "./node_modules/lodash/lodash.js":
  18163. /*!***************************************!*\
  18164. !*** ./node_modules/lodash/lodash.js ***!
  18165. \***************************************/
  18166. /*! no static exports found */
  18167. /***/ (function(module, exports, __webpack_require__) {
  18168. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18169. * @license
  18170. * Lodash <https://lodash.com/>
  18171. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18172. * Released under MIT license <https://lodash.com/license>
  18173. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18174. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18175. */
  18176. ;(function() {
  18177. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18178. var undefined;
  18179. /** Used as the semantic version number. */
  18180. var VERSION = '4.17.15';
  18181. /** Used as the size to enable large array optimizations. */
  18182. var LARGE_ARRAY_SIZE = 200;
  18183. /** Error message constants. */
  18184. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18185. FUNC_ERROR_TEXT = 'Expected a function';
  18186. /** Used to stand-in for `undefined` hash values. */
  18187. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18188. /** Used as the maximum memoize cache size. */
  18189. var MAX_MEMOIZE_SIZE = 500;
  18190. /** Used as the internal argument placeholder. */
  18191. var PLACEHOLDER = '__lodash_placeholder__';
  18192. /** Used to compose bitmasks for cloning. */
  18193. var CLONE_DEEP_FLAG = 1,
  18194. CLONE_FLAT_FLAG = 2,
  18195. CLONE_SYMBOLS_FLAG = 4;
  18196. /** Used to compose bitmasks for value comparisons. */
  18197. var COMPARE_PARTIAL_FLAG = 1,
  18198. COMPARE_UNORDERED_FLAG = 2;
  18199. /** Used to compose bitmasks for function metadata. */
  18200. var WRAP_BIND_FLAG = 1,
  18201. WRAP_BIND_KEY_FLAG = 2,
  18202. WRAP_CURRY_BOUND_FLAG = 4,
  18203. WRAP_CURRY_FLAG = 8,
  18204. WRAP_CURRY_RIGHT_FLAG = 16,
  18205. WRAP_PARTIAL_FLAG = 32,
  18206. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18207. WRAP_ARY_FLAG = 128,
  18208. WRAP_REARG_FLAG = 256,
  18209. WRAP_FLIP_FLAG = 512;
  18210. /** Used as default options for `_.truncate`. */
  18211. var DEFAULT_TRUNC_LENGTH = 30,
  18212. DEFAULT_TRUNC_OMISSION = '...';
  18213. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18214. var HOT_COUNT = 800,
  18215. HOT_SPAN = 16;
  18216. /** Used to indicate the type of lazy iteratees. */
  18217. var LAZY_FILTER_FLAG = 1,
  18218. LAZY_MAP_FLAG = 2,
  18219. LAZY_WHILE_FLAG = 3;
  18220. /** Used as references for various `Number` constants. */
  18221. var INFINITY = 1 / 0,
  18222. MAX_SAFE_INTEGER = 9007199254740991,
  18223. MAX_INTEGER = 1.7976931348623157e+308,
  18224. NAN = 0 / 0;
  18225. /** Used as references for the maximum length and index of an array. */
  18226. var MAX_ARRAY_LENGTH = 4294967295,
  18227. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18228. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18229. /** Used to associate wrap methods with their bit flags. */
  18230. var wrapFlags = [
  18231. ['ary', WRAP_ARY_FLAG],
  18232. ['bind', WRAP_BIND_FLAG],
  18233. ['bindKey', WRAP_BIND_KEY_FLAG],
  18234. ['curry', WRAP_CURRY_FLAG],
  18235. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18236. ['flip', WRAP_FLIP_FLAG],
  18237. ['partial', WRAP_PARTIAL_FLAG],
  18238. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18239. ['rearg', WRAP_REARG_FLAG]
  18240. ];
  18241. /** `Object#toString` result references. */
  18242. var argsTag = '[object Arguments]',
  18243. arrayTag = '[object Array]',
  18244. asyncTag = '[object AsyncFunction]',
  18245. boolTag = '[object Boolean]',
  18246. dateTag = '[object Date]',
  18247. domExcTag = '[object DOMException]',
  18248. errorTag = '[object Error]',
  18249. funcTag = '[object Function]',
  18250. genTag = '[object GeneratorFunction]',
  18251. mapTag = '[object Map]',
  18252. numberTag = '[object Number]',
  18253. nullTag = '[object Null]',
  18254. objectTag = '[object Object]',
  18255. promiseTag = '[object Promise]',
  18256. proxyTag = '[object Proxy]',
  18257. regexpTag = '[object RegExp]',
  18258. setTag = '[object Set]',
  18259. stringTag = '[object String]',
  18260. symbolTag = '[object Symbol]',
  18261. undefinedTag = '[object Undefined]',
  18262. weakMapTag = '[object WeakMap]',
  18263. weakSetTag = '[object WeakSet]';
  18264. var arrayBufferTag = '[object ArrayBuffer]',
  18265. dataViewTag = '[object DataView]',
  18266. float32Tag = '[object Float32Array]',
  18267. float64Tag = '[object Float64Array]',
  18268. int8Tag = '[object Int8Array]',
  18269. int16Tag = '[object Int16Array]',
  18270. int32Tag = '[object Int32Array]',
  18271. uint8Tag = '[object Uint8Array]',
  18272. uint8ClampedTag = '[object Uint8ClampedArray]',
  18273. uint16Tag = '[object Uint16Array]',
  18274. uint32Tag = '[object Uint32Array]';
  18275. /** Used to match empty string literals in compiled template source. */
  18276. var reEmptyStringLeading = /\b__p \+= '';/g,
  18277. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18278. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18279. /** Used to match HTML entities and HTML characters. */
  18280. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18281. reUnescapedHtml = /[&<>"']/g,
  18282. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18283. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18284. /** Used to match template delimiters. */
  18285. var reEscape = /<%-([\s\S]+?)%>/g,
  18286. reEvaluate = /<%([\s\S]+?)%>/g,
  18287. reInterpolate = /<%=([\s\S]+?)%>/g;
  18288. /** Used to match property names within property paths. */
  18289. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18290. reIsPlainProp = /^\w*$/,
  18291. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18292. /**
  18293. * Used to match `RegExp`
  18294. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18295. */
  18296. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18297. reHasRegExpChar = RegExp(reRegExpChar.source);
  18298. /** Used to match leading and trailing whitespace. */
  18299. var reTrim = /^\s+|\s+$/g,
  18300. reTrimStart = /^\s+/,
  18301. reTrimEnd = /\s+$/;
  18302. /** Used to match wrap detail comments. */
  18303. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18304. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18305. reSplitDetails = /,? & /;
  18306. /** Used to match words composed of alphanumeric characters. */
  18307. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18308. /** Used to match backslashes in property paths. */
  18309. var reEscapeChar = /\\(\\)?/g;
  18310. /**
  18311. * Used to match
  18312. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18313. */
  18314. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18315. /** Used to match `RegExp` flags from their coerced string values. */
  18316. var reFlags = /\w*$/;
  18317. /** Used to detect bad signed hexadecimal string values. */
  18318. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18319. /** Used to detect binary string values. */
  18320. var reIsBinary = /^0b[01]+$/i;
  18321. /** Used to detect host constructors (Safari). */
  18322. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18323. /** Used to detect octal string values. */
  18324. var reIsOctal = /^0o[0-7]+$/i;
  18325. /** Used to detect unsigned integer values. */
  18326. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18327. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18328. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18329. /** Used to ensure capturing order of template delimiters. */
  18330. var reNoMatch = /($^)/;
  18331. /** Used to match unescaped characters in compiled string literals. */
  18332. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18333. /** Used to compose unicode character classes. */
  18334. var rsAstralRange = '\\ud800-\\udfff',
  18335. rsComboMarksRange = '\\u0300-\\u036f',
  18336. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18337. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18338. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18339. rsDingbatRange = '\\u2700-\\u27bf',
  18340. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18341. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18342. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18343. rsPunctuationRange = '\\u2000-\\u206f',
  18344. 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',
  18345. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18346. rsVarRange = '\\ufe0e\\ufe0f',
  18347. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18348. /** Used to compose unicode capture groups. */
  18349. var rsApos = "['\u2019]",
  18350. rsAstral = '[' + rsAstralRange + ']',
  18351. rsBreak = '[' + rsBreakRange + ']',
  18352. rsCombo = '[' + rsComboRange + ']',
  18353. rsDigits = '\\d+',
  18354. rsDingbat = '[' + rsDingbatRange + ']',
  18355. rsLower = '[' + rsLowerRange + ']',
  18356. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18357. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18358. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18359. rsNonAstral = '[^' + rsAstralRange + ']',
  18360. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18361. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18362. rsUpper = '[' + rsUpperRange + ']',
  18363. rsZWJ = '\\u200d';
  18364. /** Used to compose unicode regexes. */
  18365. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18366. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18367. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18368. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18369. reOptMod = rsModifier + '?',
  18370. rsOptVar = '[' + rsVarRange + ']?',
  18371. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18372. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18373. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18374. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18375. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18376. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18377. /** Used to match apostrophes. */
  18378. var reApos = RegExp(rsApos, 'g');
  18379. /**
  18380. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18381. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18382. */
  18383. var reComboMark = RegExp(rsCombo, 'g');
  18384. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18385. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18386. /** Used to match complex or compound words. */
  18387. var reUnicodeWord = RegExp([
  18388. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18389. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18390. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18391. rsUpper + '+' + rsOptContrUpper,
  18392. rsOrdUpper,
  18393. rsOrdLower,
  18394. rsDigits,
  18395. rsEmoji
  18396. ].join('|'), 'g');
  18397. /** 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/). */
  18398. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18399. /** Used to detect strings that need a more robust regexp to match words. */
  18400. 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 ]/;
  18401. /** Used to assign default `context` object properties. */
  18402. var contextProps = [
  18403. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18404. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18405. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18406. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18407. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18408. ];
  18409. /** Used to make template sourceURLs easier to identify. */
  18410. var templateCounter = -1;
  18411. /** Used to identify `toStringTag` values of typed arrays. */
  18412. var typedArrayTags = {};
  18413. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18414. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18415. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18416. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18417. typedArrayTags[uint32Tag] = true;
  18418. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18419. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18420. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18421. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18422. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18423. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18424. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18425. typedArrayTags[weakMapTag] = false;
  18426. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18427. var cloneableTags = {};
  18428. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18429. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18430. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18431. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18432. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18433. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18434. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18435. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18436. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18437. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18438. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18439. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18440. cloneableTags[weakMapTag] = false;
  18441. /** Used to map Latin Unicode letters to basic Latin letters. */
  18442. var deburredLetters = {
  18443. // Latin-1 Supplement block.
  18444. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18445. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18446. '\xc7': 'C', '\xe7': 'c',
  18447. '\xd0': 'D', '\xf0': 'd',
  18448. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18449. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18450. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18451. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18452. '\xd1': 'N', '\xf1': 'n',
  18453. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18454. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18455. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18456. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18457. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18458. '\xc6': 'Ae', '\xe6': 'ae',
  18459. '\xde': 'Th', '\xfe': 'th',
  18460. '\xdf': 'ss',
  18461. // Latin Extended-A block.
  18462. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18463. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18464. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18465. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18466. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18467. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18468. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18469. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18470. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18471. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18472. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18473. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18474. '\u0134': 'J', '\u0135': 'j',
  18475. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18476. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18477. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18478. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18479. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18480. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18481. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18482. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18483. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18484. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18485. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18486. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18487. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18488. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18489. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18490. '\u0174': 'W', '\u0175': 'w',
  18491. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18492. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18493. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18494. '\u0132': 'IJ', '\u0133': 'ij',
  18495. '\u0152': 'Oe', '\u0153': 'oe',
  18496. '\u0149': "'n", '\u017f': 's'
  18497. };
  18498. /** Used to map characters to HTML entities. */
  18499. var htmlEscapes = {
  18500. '&': '&amp;',
  18501. '<': '&lt;',
  18502. '>': '&gt;',
  18503. '"': '&quot;',
  18504. "'": '&#39;'
  18505. };
  18506. /** Used to map HTML entities to characters. */
  18507. var htmlUnescapes = {
  18508. '&amp;': '&',
  18509. '&lt;': '<',
  18510. '&gt;': '>',
  18511. '&quot;': '"',
  18512. '&#39;': "'"
  18513. };
  18514. /** Used to escape characters for inclusion in compiled string literals. */
  18515. var stringEscapes = {
  18516. '\\': '\\',
  18517. "'": "'",
  18518. '\n': 'n',
  18519. '\r': 'r',
  18520. '\u2028': 'u2028',
  18521. '\u2029': 'u2029'
  18522. };
  18523. /** Built-in method references without a dependency on `root`. */
  18524. var freeParseFloat = parseFloat,
  18525. freeParseInt = parseInt;
  18526. /** Detect free variable `global` from Node.js. */
  18527. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18528. /** Detect free variable `self`. */
  18529. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18530. /** Used as a reference to the global object. */
  18531. var root = freeGlobal || freeSelf || Function('return this')();
  18532. /** Detect free variable `exports`. */
  18533. var freeExports = true && exports && !exports.nodeType && exports;
  18534. /** Detect free variable `module`. */
  18535. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18536. /** Detect the popular CommonJS extension `module.exports`. */
  18537. var moduleExports = freeModule && freeModule.exports === freeExports;
  18538. /** Detect free variable `process` from Node.js. */
  18539. var freeProcess = moduleExports && freeGlobal.process;
  18540. /** Used to access faster Node.js helpers. */
  18541. var nodeUtil = (function() {
  18542. try {
  18543. // Use `util.types` for Node.js 10+.
  18544. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18545. if (types) {
  18546. return types;
  18547. }
  18548. // Legacy `process.binding('util')` for Node.js < 10.
  18549. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18550. } catch (e) {}
  18551. }());
  18552. /* Node.js helper references. */
  18553. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18554. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18555. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18556. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18557. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18558. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18559. /*--------------------------------------------------------------------------*/
  18560. /**
  18561. * A faster alternative to `Function#apply`, this function invokes `func`
  18562. * with the `this` binding of `thisArg` and the arguments of `args`.
  18563. *
  18564. * @private
  18565. * @param {Function} func The function to invoke.
  18566. * @param {*} thisArg The `this` binding of `func`.
  18567. * @param {Array} args The arguments to invoke `func` with.
  18568. * @returns {*} Returns the result of `func`.
  18569. */
  18570. function apply(func, thisArg, args) {
  18571. switch (args.length) {
  18572. case 0: return func.call(thisArg);
  18573. case 1: return func.call(thisArg, args[0]);
  18574. case 2: return func.call(thisArg, args[0], args[1]);
  18575. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18576. }
  18577. return func.apply(thisArg, args);
  18578. }
  18579. /**
  18580. * A specialized version of `baseAggregator` for arrays.
  18581. *
  18582. * @private
  18583. * @param {Array} [array] The array to iterate over.
  18584. * @param {Function} setter The function to set `accumulator` values.
  18585. * @param {Function} iteratee The iteratee to transform keys.
  18586. * @param {Object} accumulator The initial aggregated object.
  18587. * @returns {Function} Returns `accumulator`.
  18588. */
  18589. function arrayAggregator(array, setter, iteratee, accumulator) {
  18590. var index = -1,
  18591. length = array == null ? 0 : array.length;
  18592. while (++index < length) {
  18593. var value = array[index];
  18594. setter(accumulator, value, iteratee(value), array);
  18595. }
  18596. return accumulator;
  18597. }
  18598. /**
  18599. * A specialized version of `_.forEach` for arrays without support for
  18600. * iteratee shorthands.
  18601. *
  18602. * @private
  18603. * @param {Array} [array] The array to iterate over.
  18604. * @param {Function} iteratee The function invoked per iteration.
  18605. * @returns {Array} Returns `array`.
  18606. */
  18607. function arrayEach(array, iteratee) {
  18608. var index = -1,
  18609. length = array == null ? 0 : array.length;
  18610. while (++index < length) {
  18611. if (iteratee(array[index], index, array) === false) {
  18612. break;
  18613. }
  18614. }
  18615. return array;
  18616. }
  18617. /**
  18618. * A specialized version of `_.forEachRight` for arrays without support for
  18619. * iteratee shorthands.
  18620. *
  18621. * @private
  18622. * @param {Array} [array] The array to iterate over.
  18623. * @param {Function} iteratee The function invoked per iteration.
  18624. * @returns {Array} Returns `array`.
  18625. */
  18626. function arrayEachRight(array, iteratee) {
  18627. var length = array == null ? 0 : array.length;
  18628. while (length--) {
  18629. if (iteratee(array[length], length, array) === false) {
  18630. break;
  18631. }
  18632. }
  18633. return array;
  18634. }
  18635. /**
  18636. * A specialized version of `_.every` for arrays without support for
  18637. * iteratee shorthands.
  18638. *
  18639. * @private
  18640. * @param {Array} [array] The array to iterate over.
  18641. * @param {Function} predicate The function invoked per iteration.
  18642. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18643. * else `false`.
  18644. */
  18645. function arrayEvery(array, predicate) {
  18646. var index = -1,
  18647. length = array == null ? 0 : array.length;
  18648. while (++index < length) {
  18649. if (!predicate(array[index], index, array)) {
  18650. return false;
  18651. }
  18652. }
  18653. return true;
  18654. }
  18655. /**
  18656. * A specialized version of `_.filter` for arrays without support for
  18657. * iteratee shorthands.
  18658. *
  18659. * @private
  18660. * @param {Array} [array] The array to iterate over.
  18661. * @param {Function} predicate The function invoked per iteration.
  18662. * @returns {Array} Returns the new filtered array.
  18663. */
  18664. function arrayFilter(array, predicate) {
  18665. var index = -1,
  18666. length = array == null ? 0 : array.length,
  18667. resIndex = 0,
  18668. result = [];
  18669. while (++index < length) {
  18670. var value = array[index];
  18671. if (predicate(value, index, array)) {
  18672. result[resIndex++] = value;
  18673. }
  18674. }
  18675. return result;
  18676. }
  18677. /**
  18678. * A specialized version of `_.includes` for arrays without support for
  18679. * specifying an index to search from.
  18680. *
  18681. * @private
  18682. * @param {Array} [array] The array to inspect.
  18683. * @param {*} target The value to search for.
  18684. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18685. */
  18686. function arrayIncludes(array, value) {
  18687. var length = array == null ? 0 : array.length;
  18688. return !!length && baseIndexOf(array, value, 0) > -1;
  18689. }
  18690. /**
  18691. * This function is like `arrayIncludes` except that it accepts a comparator.
  18692. *
  18693. * @private
  18694. * @param {Array} [array] The array to inspect.
  18695. * @param {*} target The value to search for.
  18696. * @param {Function} comparator The comparator invoked per element.
  18697. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18698. */
  18699. function arrayIncludesWith(array, value, comparator) {
  18700. var index = -1,
  18701. length = array == null ? 0 : array.length;
  18702. while (++index < length) {
  18703. if (comparator(value, array[index])) {
  18704. return true;
  18705. }
  18706. }
  18707. return false;
  18708. }
  18709. /**
  18710. * A specialized version of `_.map` for arrays without support for iteratee
  18711. * shorthands.
  18712. *
  18713. * @private
  18714. * @param {Array} [array] The array to iterate over.
  18715. * @param {Function} iteratee The function invoked per iteration.
  18716. * @returns {Array} Returns the new mapped array.
  18717. */
  18718. function arrayMap(array, iteratee) {
  18719. var index = -1,
  18720. length = array == null ? 0 : array.length,
  18721. result = Array(length);
  18722. while (++index < length) {
  18723. result[index] = iteratee(array[index], index, array);
  18724. }
  18725. return result;
  18726. }
  18727. /**
  18728. * Appends the elements of `values` to `array`.
  18729. *
  18730. * @private
  18731. * @param {Array} array The array to modify.
  18732. * @param {Array} values The values to append.
  18733. * @returns {Array} Returns `array`.
  18734. */
  18735. function arrayPush(array, values) {
  18736. var index = -1,
  18737. length = values.length,
  18738. offset = array.length;
  18739. while (++index < length) {
  18740. array[offset + index] = values[index];
  18741. }
  18742. return array;
  18743. }
  18744. /**
  18745. * A specialized version of `_.reduce` for arrays without support for
  18746. * iteratee shorthands.
  18747. *
  18748. * @private
  18749. * @param {Array} [array] The array to iterate over.
  18750. * @param {Function} iteratee The function invoked per iteration.
  18751. * @param {*} [accumulator] The initial value.
  18752. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18753. * the initial value.
  18754. * @returns {*} Returns the accumulated value.
  18755. */
  18756. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18757. var index = -1,
  18758. length = array == null ? 0 : array.length;
  18759. if (initAccum && length) {
  18760. accumulator = array[++index];
  18761. }
  18762. while (++index < length) {
  18763. accumulator = iteratee(accumulator, array[index], index, array);
  18764. }
  18765. return accumulator;
  18766. }
  18767. /**
  18768. * A specialized version of `_.reduceRight` for arrays without support for
  18769. * iteratee shorthands.
  18770. *
  18771. * @private
  18772. * @param {Array} [array] The array to iterate over.
  18773. * @param {Function} iteratee The function invoked per iteration.
  18774. * @param {*} [accumulator] The initial value.
  18775. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18776. * the initial value.
  18777. * @returns {*} Returns the accumulated value.
  18778. */
  18779. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18780. var length = array == null ? 0 : array.length;
  18781. if (initAccum && length) {
  18782. accumulator = array[--length];
  18783. }
  18784. while (length--) {
  18785. accumulator = iteratee(accumulator, array[length], length, array);
  18786. }
  18787. return accumulator;
  18788. }
  18789. /**
  18790. * A specialized version of `_.some` for arrays without support for iteratee
  18791. * shorthands.
  18792. *
  18793. * @private
  18794. * @param {Array} [array] The array to iterate over.
  18795. * @param {Function} predicate The function invoked per iteration.
  18796. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18797. * else `false`.
  18798. */
  18799. function arraySome(array, predicate) {
  18800. var index = -1,
  18801. length = array == null ? 0 : array.length;
  18802. while (++index < length) {
  18803. if (predicate(array[index], index, array)) {
  18804. return true;
  18805. }
  18806. }
  18807. return false;
  18808. }
  18809. /**
  18810. * Gets the size of an ASCII `string`.
  18811. *
  18812. * @private
  18813. * @param {string} string The string inspect.
  18814. * @returns {number} Returns the string size.
  18815. */
  18816. var asciiSize = baseProperty('length');
  18817. /**
  18818. * Converts an ASCII `string` to an array.
  18819. *
  18820. * @private
  18821. * @param {string} string The string to convert.
  18822. * @returns {Array} Returns the converted array.
  18823. */
  18824. function asciiToArray(string) {
  18825. return string.split('');
  18826. }
  18827. /**
  18828. * Splits an ASCII `string` into an array of its words.
  18829. *
  18830. * @private
  18831. * @param {string} The string to inspect.
  18832. * @returns {Array} Returns the words of `string`.
  18833. */
  18834. function asciiWords(string) {
  18835. return string.match(reAsciiWord) || [];
  18836. }
  18837. /**
  18838. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18839. * without support for iteratee shorthands, which iterates over `collection`
  18840. * using `eachFunc`.
  18841. *
  18842. * @private
  18843. * @param {Array|Object} collection The collection to inspect.
  18844. * @param {Function} predicate The function invoked per iteration.
  18845. * @param {Function} eachFunc The function to iterate over `collection`.
  18846. * @returns {*} Returns the found element or its key, else `undefined`.
  18847. */
  18848. function baseFindKey(collection, predicate, eachFunc) {
  18849. var result;
  18850. eachFunc(collection, function(value, key, collection) {
  18851. if (predicate(value, key, collection)) {
  18852. result = key;
  18853. return false;
  18854. }
  18855. });
  18856. return result;
  18857. }
  18858. /**
  18859. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18860. * support for iteratee shorthands.
  18861. *
  18862. * @private
  18863. * @param {Array} array The array to inspect.
  18864. * @param {Function} predicate The function invoked per iteration.
  18865. * @param {number} fromIndex The index to search from.
  18866. * @param {boolean} [fromRight] Specify iterating from right to left.
  18867. * @returns {number} Returns the index of the matched value, else `-1`.
  18868. */
  18869. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18870. var length = array.length,
  18871. index = fromIndex + (fromRight ? 1 : -1);
  18872. while ((fromRight ? index-- : ++index < length)) {
  18873. if (predicate(array[index], index, array)) {
  18874. return index;
  18875. }
  18876. }
  18877. return -1;
  18878. }
  18879. /**
  18880. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18881. *
  18882. * @private
  18883. * @param {Array} array The array to inspect.
  18884. * @param {*} value The value to search for.
  18885. * @param {number} fromIndex The index to search from.
  18886. * @returns {number} Returns the index of the matched value, else `-1`.
  18887. */
  18888. function baseIndexOf(array, value, fromIndex) {
  18889. return value === value
  18890. ? strictIndexOf(array, value, fromIndex)
  18891. : baseFindIndex(array, baseIsNaN, fromIndex);
  18892. }
  18893. /**
  18894. * This function is like `baseIndexOf` except that it accepts a comparator.
  18895. *
  18896. * @private
  18897. * @param {Array} array The array to inspect.
  18898. * @param {*} value The value to search for.
  18899. * @param {number} fromIndex The index to search from.
  18900. * @param {Function} comparator The comparator invoked per element.
  18901. * @returns {number} Returns the index of the matched value, else `-1`.
  18902. */
  18903. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18904. var index = fromIndex - 1,
  18905. length = array.length;
  18906. while (++index < length) {
  18907. if (comparator(array[index], value)) {
  18908. return index;
  18909. }
  18910. }
  18911. return -1;
  18912. }
  18913. /**
  18914. * The base implementation of `_.isNaN` without support for number objects.
  18915. *
  18916. * @private
  18917. * @param {*} value The value to check.
  18918. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  18919. */
  18920. function baseIsNaN(value) {
  18921. return value !== value;
  18922. }
  18923. /**
  18924. * The base implementation of `_.mean` and `_.meanBy` without support for
  18925. * iteratee shorthands.
  18926. *
  18927. * @private
  18928. * @param {Array} array The array to iterate over.
  18929. * @param {Function} iteratee The function invoked per iteration.
  18930. * @returns {number} Returns the mean.
  18931. */
  18932. function baseMean(array, iteratee) {
  18933. var length = array == null ? 0 : array.length;
  18934. return length ? (baseSum(array, iteratee) / length) : NAN;
  18935. }
  18936. /**
  18937. * The base implementation of `_.property` without support for deep paths.
  18938. *
  18939. * @private
  18940. * @param {string} key The key of the property to get.
  18941. * @returns {Function} Returns the new accessor function.
  18942. */
  18943. function baseProperty(key) {
  18944. return function(object) {
  18945. return object == null ? undefined : object[key];
  18946. };
  18947. }
  18948. /**
  18949. * The base implementation of `_.propertyOf` without support for deep paths.
  18950. *
  18951. * @private
  18952. * @param {Object} object The object to query.
  18953. * @returns {Function} Returns the new accessor function.
  18954. */
  18955. function basePropertyOf(object) {
  18956. return function(key) {
  18957. return object == null ? undefined : object[key];
  18958. };
  18959. }
  18960. /**
  18961. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  18962. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  18963. *
  18964. * @private
  18965. * @param {Array|Object} collection The collection to iterate over.
  18966. * @param {Function} iteratee The function invoked per iteration.
  18967. * @param {*} accumulator The initial value.
  18968. * @param {boolean} initAccum Specify using the first or last element of
  18969. * `collection` as the initial value.
  18970. * @param {Function} eachFunc The function to iterate over `collection`.
  18971. * @returns {*} Returns the accumulated value.
  18972. */
  18973. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  18974. eachFunc(collection, function(value, index, collection) {
  18975. accumulator = initAccum
  18976. ? (initAccum = false, value)
  18977. : iteratee(accumulator, value, index, collection);
  18978. });
  18979. return accumulator;
  18980. }
  18981. /**
  18982. * The base implementation of `_.sortBy` which uses `comparer` to define the
  18983. * sort order of `array` and replaces criteria objects with their corresponding
  18984. * values.
  18985. *
  18986. * @private
  18987. * @param {Array} array The array to sort.
  18988. * @param {Function} comparer The function to define sort order.
  18989. * @returns {Array} Returns `array`.
  18990. */
  18991. function baseSortBy(array, comparer) {
  18992. var length = array.length;
  18993. array.sort(comparer);
  18994. while (length--) {
  18995. array[length] = array[length].value;
  18996. }
  18997. return array;
  18998. }
  18999. /**
  19000. * The base implementation of `_.sum` and `_.sumBy` without support for
  19001. * iteratee shorthands.
  19002. *
  19003. * @private
  19004. * @param {Array} array The array to iterate over.
  19005. * @param {Function} iteratee The function invoked per iteration.
  19006. * @returns {number} Returns the sum.
  19007. */
  19008. function baseSum(array, iteratee) {
  19009. var result,
  19010. index = -1,
  19011. length = array.length;
  19012. while (++index < length) {
  19013. var current = iteratee(array[index]);
  19014. if (current !== undefined) {
  19015. result = result === undefined ? current : (result + current);
  19016. }
  19017. }
  19018. return result;
  19019. }
  19020. /**
  19021. * The base implementation of `_.times` without support for iteratee shorthands
  19022. * or max array length checks.
  19023. *
  19024. * @private
  19025. * @param {number} n The number of times to invoke `iteratee`.
  19026. * @param {Function} iteratee The function invoked per iteration.
  19027. * @returns {Array} Returns the array of results.
  19028. */
  19029. function baseTimes(n, iteratee) {
  19030. var index = -1,
  19031. result = Array(n);
  19032. while (++index < n) {
  19033. result[index] = iteratee(index);
  19034. }
  19035. return result;
  19036. }
  19037. /**
  19038. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19039. * of key-value pairs for `object` corresponding to the property names of `props`.
  19040. *
  19041. * @private
  19042. * @param {Object} object The object to query.
  19043. * @param {Array} props The property names to get values for.
  19044. * @returns {Object} Returns the key-value pairs.
  19045. */
  19046. function baseToPairs(object, props) {
  19047. return arrayMap(props, function(key) {
  19048. return [key, object[key]];
  19049. });
  19050. }
  19051. /**
  19052. * The base implementation of `_.unary` without support for storing metadata.
  19053. *
  19054. * @private
  19055. * @param {Function} func The function to cap arguments for.
  19056. * @returns {Function} Returns the new capped function.
  19057. */
  19058. function baseUnary(func) {
  19059. return function(value) {
  19060. return func(value);
  19061. };
  19062. }
  19063. /**
  19064. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19065. * array of `object` property values corresponding to the property names
  19066. * of `props`.
  19067. *
  19068. * @private
  19069. * @param {Object} object The object to query.
  19070. * @param {Array} props The property names to get values for.
  19071. * @returns {Object} Returns the array of property values.
  19072. */
  19073. function baseValues(object, props) {
  19074. return arrayMap(props, function(key) {
  19075. return object[key];
  19076. });
  19077. }
  19078. /**
  19079. * Checks if a `cache` value for `key` exists.
  19080. *
  19081. * @private
  19082. * @param {Object} cache The cache to query.
  19083. * @param {string} key The key of the entry to check.
  19084. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19085. */
  19086. function cacheHas(cache, key) {
  19087. return cache.has(key);
  19088. }
  19089. /**
  19090. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19091. * that is not found in the character symbols.
  19092. *
  19093. * @private
  19094. * @param {Array} strSymbols The string symbols to inspect.
  19095. * @param {Array} chrSymbols The character symbols to find.
  19096. * @returns {number} Returns the index of the first unmatched string symbol.
  19097. */
  19098. function charsStartIndex(strSymbols, chrSymbols) {
  19099. var index = -1,
  19100. length = strSymbols.length;
  19101. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19102. return index;
  19103. }
  19104. /**
  19105. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19106. * that is not found in the character symbols.
  19107. *
  19108. * @private
  19109. * @param {Array} strSymbols The string symbols to inspect.
  19110. * @param {Array} chrSymbols The character symbols to find.
  19111. * @returns {number} Returns the index of the last unmatched string symbol.
  19112. */
  19113. function charsEndIndex(strSymbols, chrSymbols) {
  19114. var index = strSymbols.length;
  19115. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19116. return index;
  19117. }
  19118. /**
  19119. * Gets the number of `placeholder` occurrences in `array`.
  19120. *
  19121. * @private
  19122. * @param {Array} array The array to inspect.
  19123. * @param {*} placeholder The placeholder to search for.
  19124. * @returns {number} Returns the placeholder count.
  19125. */
  19126. function countHolders(array, placeholder) {
  19127. var length = array.length,
  19128. result = 0;
  19129. while (length--) {
  19130. if (array[length] === placeholder) {
  19131. ++result;
  19132. }
  19133. }
  19134. return result;
  19135. }
  19136. /**
  19137. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19138. * letters to basic Latin letters.
  19139. *
  19140. * @private
  19141. * @param {string} letter The matched letter to deburr.
  19142. * @returns {string} Returns the deburred letter.
  19143. */
  19144. var deburrLetter = basePropertyOf(deburredLetters);
  19145. /**
  19146. * Used by `_.escape` to convert characters to HTML entities.
  19147. *
  19148. * @private
  19149. * @param {string} chr The matched character to escape.
  19150. * @returns {string} Returns the escaped character.
  19151. */
  19152. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19153. /**
  19154. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19155. *
  19156. * @private
  19157. * @param {string} chr The matched character to escape.
  19158. * @returns {string} Returns the escaped character.
  19159. */
  19160. function escapeStringChar(chr) {
  19161. return '\\' + stringEscapes[chr];
  19162. }
  19163. /**
  19164. * Gets the value at `key` of `object`.
  19165. *
  19166. * @private
  19167. * @param {Object} [object] The object to query.
  19168. * @param {string} key The key of the property to get.
  19169. * @returns {*} Returns the property value.
  19170. */
  19171. function getValue(object, key) {
  19172. return object == null ? undefined : object[key];
  19173. }
  19174. /**
  19175. * Checks if `string` contains Unicode symbols.
  19176. *
  19177. * @private
  19178. * @param {string} string The string to inspect.
  19179. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19180. */
  19181. function hasUnicode(string) {
  19182. return reHasUnicode.test(string);
  19183. }
  19184. /**
  19185. * Checks if `string` contains a word composed of Unicode symbols.
  19186. *
  19187. * @private
  19188. * @param {string} string The string to inspect.
  19189. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19190. */
  19191. function hasUnicodeWord(string) {
  19192. return reHasUnicodeWord.test(string);
  19193. }
  19194. /**
  19195. * Converts `iterator` to an array.
  19196. *
  19197. * @private
  19198. * @param {Object} iterator The iterator to convert.
  19199. * @returns {Array} Returns the converted array.
  19200. */
  19201. function iteratorToArray(iterator) {
  19202. var data,
  19203. result = [];
  19204. while (!(data = iterator.next()).done) {
  19205. result.push(data.value);
  19206. }
  19207. return result;
  19208. }
  19209. /**
  19210. * Converts `map` to its key-value pairs.
  19211. *
  19212. * @private
  19213. * @param {Object} map The map to convert.
  19214. * @returns {Array} Returns the key-value pairs.
  19215. */
  19216. function mapToArray(map) {
  19217. var index = -1,
  19218. result = Array(map.size);
  19219. map.forEach(function(value, key) {
  19220. result[++index] = [key, value];
  19221. });
  19222. return result;
  19223. }
  19224. /**
  19225. * Creates a unary function that invokes `func` with its argument transformed.
  19226. *
  19227. * @private
  19228. * @param {Function} func The function to wrap.
  19229. * @param {Function} transform The argument transform.
  19230. * @returns {Function} Returns the new function.
  19231. */
  19232. function overArg(func, transform) {
  19233. return function(arg) {
  19234. return func(transform(arg));
  19235. };
  19236. }
  19237. /**
  19238. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19239. * and returns an array of their indexes.
  19240. *
  19241. * @private
  19242. * @param {Array} array The array to modify.
  19243. * @param {*} placeholder The placeholder to replace.
  19244. * @returns {Array} Returns the new array of placeholder indexes.
  19245. */
  19246. function replaceHolders(array, placeholder) {
  19247. var index = -1,
  19248. length = array.length,
  19249. resIndex = 0,
  19250. result = [];
  19251. while (++index < length) {
  19252. var value = array[index];
  19253. if (value === placeholder || value === PLACEHOLDER) {
  19254. array[index] = PLACEHOLDER;
  19255. result[resIndex++] = index;
  19256. }
  19257. }
  19258. return result;
  19259. }
  19260. /**
  19261. * Converts `set` to an array of its values.
  19262. *
  19263. * @private
  19264. * @param {Object} set The set to convert.
  19265. * @returns {Array} Returns the values.
  19266. */
  19267. function setToArray(set) {
  19268. var index = -1,
  19269. result = Array(set.size);
  19270. set.forEach(function(value) {
  19271. result[++index] = value;
  19272. });
  19273. return result;
  19274. }
  19275. /**
  19276. * Converts `set` to its value-value pairs.
  19277. *
  19278. * @private
  19279. * @param {Object} set The set to convert.
  19280. * @returns {Array} Returns the value-value pairs.
  19281. */
  19282. function setToPairs(set) {
  19283. var index = -1,
  19284. result = Array(set.size);
  19285. set.forEach(function(value) {
  19286. result[++index] = [value, value];
  19287. });
  19288. return result;
  19289. }
  19290. /**
  19291. * A specialized version of `_.indexOf` which performs strict equality
  19292. * comparisons of values, i.e. `===`.
  19293. *
  19294. * @private
  19295. * @param {Array} array The array to inspect.
  19296. * @param {*} value The value to search for.
  19297. * @param {number} fromIndex The index to search from.
  19298. * @returns {number} Returns the index of the matched value, else `-1`.
  19299. */
  19300. function strictIndexOf(array, value, fromIndex) {
  19301. var index = fromIndex - 1,
  19302. length = array.length;
  19303. while (++index < length) {
  19304. if (array[index] === value) {
  19305. return index;
  19306. }
  19307. }
  19308. return -1;
  19309. }
  19310. /**
  19311. * A specialized version of `_.lastIndexOf` which performs strict equality
  19312. * comparisons of values, i.e. `===`.
  19313. *
  19314. * @private
  19315. * @param {Array} array The array to inspect.
  19316. * @param {*} value The value to search for.
  19317. * @param {number} fromIndex The index to search from.
  19318. * @returns {number} Returns the index of the matched value, else `-1`.
  19319. */
  19320. function strictLastIndexOf(array, value, fromIndex) {
  19321. var index = fromIndex + 1;
  19322. while (index--) {
  19323. if (array[index] === value) {
  19324. return index;
  19325. }
  19326. }
  19327. return index;
  19328. }
  19329. /**
  19330. * Gets the number of symbols in `string`.
  19331. *
  19332. * @private
  19333. * @param {string} string The string to inspect.
  19334. * @returns {number} Returns the string size.
  19335. */
  19336. function stringSize(string) {
  19337. return hasUnicode(string)
  19338. ? unicodeSize(string)
  19339. : asciiSize(string);
  19340. }
  19341. /**
  19342. * Converts `string` to an array.
  19343. *
  19344. * @private
  19345. * @param {string} string The string to convert.
  19346. * @returns {Array} Returns the converted array.
  19347. */
  19348. function stringToArray(string) {
  19349. return hasUnicode(string)
  19350. ? unicodeToArray(string)
  19351. : asciiToArray(string);
  19352. }
  19353. /**
  19354. * Used by `_.unescape` to convert HTML entities to characters.
  19355. *
  19356. * @private
  19357. * @param {string} chr The matched character to unescape.
  19358. * @returns {string} Returns the unescaped character.
  19359. */
  19360. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19361. /**
  19362. * Gets the size of a Unicode `string`.
  19363. *
  19364. * @private
  19365. * @param {string} string The string inspect.
  19366. * @returns {number} Returns the string size.
  19367. */
  19368. function unicodeSize(string) {
  19369. var result = reUnicode.lastIndex = 0;
  19370. while (reUnicode.test(string)) {
  19371. ++result;
  19372. }
  19373. return result;
  19374. }
  19375. /**
  19376. * Converts a Unicode `string` to an array.
  19377. *
  19378. * @private
  19379. * @param {string} string The string to convert.
  19380. * @returns {Array} Returns the converted array.
  19381. */
  19382. function unicodeToArray(string) {
  19383. return string.match(reUnicode) || [];
  19384. }
  19385. /**
  19386. * Splits a Unicode `string` into an array of its words.
  19387. *
  19388. * @private
  19389. * @param {string} The string to inspect.
  19390. * @returns {Array} Returns the words of `string`.
  19391. */
  19392. function unicodeWords(string) {
  19393. return string.match(reUnicodeWord) || [];
  19394. }
  19395. /*--------------------------------------------------------------------------*/
  19396. /**
  19397. * Create a new pristine `lodash` function using the `context` object.
  19398. *
  19399. * @static
  19400. * @memberOf _
  19401. * @since 1.1.0
  19402. * @category Util
  19403. * @param {Object} [context=root] The context object.
  19404. * @returns {Function} Returns a new `lodash` function.
  19405. * @example
  19406. *
  19407. * _.mixin({ 'foo': _.constant('foo') });
  19408. *
  19409. * var lodash = _.runInContext();
  19410. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19411. *
  19412. * _.isFunction(_.foo);
  19413. * // => true
  19414. * _.isFunction(_.bar);
  19415. * // => false
  19416. *
  19417. * lodash.isFunction(lodash.foo);
  19418. * // => false
  19419. * lodash.isFunction(lodash.bar);
  19420. * // => true
  19421. *
  19422. * // Create a suped-up `defer` in Node.js.
  19423. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19424. */
  19425. var runInContext = (function runInContext(context) {
  19426. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19427. /** Built-in constructor references. */
  19428. var Array = context.Array,
  19429. Date = context.Date,
  19430. Error = context.Error,
  19431. Function = context.Function,
  19432. Math = context.Math,
  19433. Object = context.Object,
  19434. RegExp = context.RegExp,
  19435. String = context.String,
  19436. TypeError = context.TypeError;
  19437. /** Used for built-in method references. */
  19438. var arrayProto = Array.prototype,
  19439. funcProto = Function.prototype,
  19440. objectProto = Object.prototype;
  19441. /** Used to detect overreaching core-js shims. */
  19442. var coreJsData = context['__core-js_shared__'];
  19443. /** Used to resolve the decompiled source of functions. */
  19444. var funcToString = funcProto.toString;
  19445. /** Used to check objects for own properties. */
  19446. var hasOwnProperty = objectProto.hasOwnProperty;
  19447. /** Used to generate unique IDs. */
  19448. var idCounter = 0;
  19449. /** Used to detect methods masquerading as native. */
  19450. var maskSrcKey = (function() {
  19451. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19452. return uid ? ('Symbol(src)_1.' + uid) : '';
  19453. }());
  19454. /**
  19455. * Used to resolve the
  19456. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19457. * of values.
  19458. */
  19459. var nativeObjectToString = objectProto.toString;
  19460. /** Used to infer the `Object` constructor. */
  19461. var objectCtorString = funcToString.call(Object);
  19462. /** Used to restore the original `_` reference in `_.noConflict`. */
  19463. var oldDash = root._;
  19464. /** Used to detect if a method is native. */
  19465. var reIsNative = RegExp('^' +
  19466. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19467. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19468. );
  19469. /** Built-in value references. */
  19470. var Buffer = moduleExports ? context.Buffer : undefined,
  19471. Symbol = context.Symbol,
  19472. Uint8Array = context.Uint8Array,
  19473. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19474. getPrototype = overArg(Object.getPrototypeOf, Object),
  19475. objectCreate = Object.create,
  19476. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19477. splice = arrayProto.splice,
  19478. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19479. symIterator = Symbol ? Symbol.iterator : undefined,
  19480. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19481. var defineProperty = (function() {
  19482. try {
  19483. var func = getNative(Object, 'defineProperty');
  19484. func({}, '', {});
  19485. return func;
  19486. } catch (e) {}
  19487. }());
  19488. /** Mocked built-ins. */
  19489. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19490. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19491. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19492. /* Built-in method references for those with the same name as other `lodash` methods. */
  19493. var nativeCeil = Math.ceil,
  19494. nativeFloor = Math.floor,
  19495. nativeGetSymbols = Object.getOwnPropertySymbols,
  19496. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19497. nativeIsFinite = context.isFinite,
  19498. nativeJoin = arrayProto.join,
  19499. nativeKeys = overArg(Object.keys, Object),
  19500. nativeMax = Math.max,
  19501. nativeMin = Math.min,
  19502. nativeNow = Date.now,
  19503. nativeParseInt = context.parseInt,
  19504. nativeRandom = Math.random,
  19505. nativeReverse = arrayProto.reverse;
  19506. /* Built-in method references that are verified to be native. */
  19507. var DataView = getNative(context, 'DataView'),
  19508. Map = getNative(context, 'Map'),
  19509. Promise = getNative(context, 'Promise'),
  19510. Set = getNative(context, 'Set'),
  19511. WeakMap = getNative(context, 'WeakMap'),
  19512. nativeCreate = getNative(Object, 'create');
  19513. /** Used to store function metadata. */
  19514. var metaMap = WeakMap && new WeakMap;
  19515. /** Used to lookup unminified function names. */
  19516. var realNames = {};
  19517. /** Used to detect maps, sets, and weakmaps. */
  19518. var dataViewCtorString = toSource(DataView),
  19519. mapCtorString = toSource(Map),
  19520. promiseCtorString = toSource(Promise),
  19521. setCtorString = toSource(Set),
  19522. weakMapCtorString = toSource(WeakMap);
  19523. /** Used to convert symbols to primitives and strings. */
  19524. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19525. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19526. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19527. /*------------------------------------------------------------------------*/
  19528. /**
  19529. * Creates a `lodash` object which wraps `value` to enable implicit method
  19530. * chain sequences. Methods that operate on and return arrays, collections,
  19531. * and functions can be chained together. Methods that retrieve a single value
  19532. * or may return a primitive value will automatically end the chain sequence
  19533. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19534. * with `_#value`.
  19535. *
  19536. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19537. * enabled using `_.chain`.
  19538. *
  19539. * The execution of chained methods is lazy, that is, it's deferred until
  19540. * `_#value` is implicitly or explicitly called.
  19541. *
  19542. * Lazy evaluation allows several methods to support shortcut fusion.
  19543. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19544. * the creation of intermediate arrays and can greatly reduce the number of
  19545. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19546. * fusion if the section is applied to an array and iteratees accept only
  19547. * one argument. The heuristic for whether a section qualifies for shortcut
  19548. * fusion is subject to change.
  19549. *
  19550. * Chaining is supported in custom builds as long as the `_#value` method is
  19551. * directly or indirectly included in the build.
  19552. *
  19553. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19554. *
  19555. * The wrapper `Array` methods are:
  19556. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19557. *
  19558. * The wrapper `String` methods are:
  19559. * `replace` and `split`
  19560. *
  19561. * The wrapper methods that support shortcut fusion are:
  19562. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19563. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19564. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19565. *
  19566. * The chainable wrapper methods are:
  19567. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19568. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19569. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19570. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19571. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19572. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19573. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19574. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19575. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19576. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19577. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19578. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19579. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19580. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19581. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19582. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19583. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19584. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19585. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19586. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19587. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19588. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19589. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19590. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19591. *
  19592. * The wrapper methods that are **not** chainable by default are:
  19593. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19594. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19595. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19596. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19597. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19598. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19599. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19600. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19601. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19602. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19603. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19604. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19605. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19606. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19607. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19608. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19609. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19610. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19611. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19612. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19613. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19614. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19615. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19616. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19617. * `upperFirst`, `value`, and `words`
  19618. *
  19619. * @name _
  19620. * @constructor
  19621. * @category Seq
  19622. * @param {*} value The value to wrap in a `lodash` instance.
  19623. * @returns {Object} Returns the new `lodash` wrapper instance.
  19624. * @example
  19625. *
  19626. * function square(n) {
  19627. * return n * n;
  19628. * }
  19629. *
  19630. * var wrapped = _([1, 2, 3]);
  19631. *
  19632. * // Returns an unwrapped value.
  19633. * wrapped.reduce(_.add);
  19634. * // => 6
  19635. *
  19636. * // Returns a wrapped value.
  19637. * var squares = wrapped.map(square);
  19638. *
  19639. * _.isArray(squares);
  19640. * // => false
  19641. *
  19642. * _.isArray(squares.value());
  19643. * // => true
  19644. */
  19645. function lodash(value) {
  19646. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19647. if (value instanceof LodashWrapper) {
  19648. return value;
  19649. }
  19650. if (hasOwnProperty.call(value, '__wrapped__')) {
  19651. return wrapperClone(value);
  19652. }
  19653. }
  19654. return new LodashWrapper(value);
  19655. }
  19656. /**
  19657. * The base implementation of `_.create` without support for assigning
  19658. * properties to the created object.
  19659. *
  19660. * @private
  19661. * @param {Object} proto The object to inherit from.
  19662. * @returns {Object} Returns the new object.
  19663. */
  19664. var baseCreate = (function() {
  19665. function object() {}
  19666. return function(proto) {
  19667. if (!isObject(proto)) {
  19668. return {};
  19669. }
  19670. if (objectCreate) {
  19671. return objectCreate(proto);
  19672. }
  19673. object.prototype = proto;
  19674. var result = new object;
  19675. object.prototype = undefined;
  19676. return result;
  19677. };
  19678. }());
  19679. /**
  19680. * The function whose prototype chain sequence wrappers inherit from.
  19681. *
  19682. * @private
  19683. */
  19684. function baseLodash() {
  19685. // No operation performed.
  19686. }
  19687. /**
  19688. * The base constructor for creating `lodash` wrapper objects.
  19689. *
  19690. * @private
  19691. * @param {*} value The value to wrap.
  19692. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19693. */
  19694. function LodashWrapper(value, chainAll) {
  19695. this.__wrapped__ = value;
  19696. this.__actions__ = [];
  19697. this.__chain__ = !!chainAll;
  19698. this.__index__ = 0;
  19699. this.__values__ = undefined;
  19700. }
  19701. /**
  19702. * By default, the template delimiters used by lodash are like those in
  19703. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19704. * following template settings to use alternative delimiters.
  19705. *
  19706. * @static
  19707. * @memberOf _
  19708. * @type {Object}
  19709. */
  19710. lodash.templateSettings = {
  19711. /**
  19712. * Used to detect `data` property values to be HTML-escaped.
  19713. *
  19714. * @memberOf _.templateSettings
  19715. * @type {RegExp}
  19716. */
  19717. 'escape': reEscape,
  19718. /**
  19719. * Used to detect code to be evaluated.
  19720. *
  19721. * @memberOf _.templateSettings
  19722. * @type {RegExp}
  19723. */
  19724. 'evaluate': reEvaluate,
  19725. /**
  19726. * Used to detect `data` property values to inject.
  19727. *
  19728. * @memberOf _.templateSettings
  19729. * @type {RegExp}
  19730. */
  19731. 'interpolate': reInterpolate,
  19732. /**
  19733. * Used to reference the data object in the template text.
  19734. *
  19735. * @memberOf _.templateSettings
  19736. * @type {string}
  19737. */
  19738. 'variable': '',
  19739. /**
  19740. * Used to import variables into the compiled template.
  19741. *
  19742. * @memberOf _.templateSettings
  19743. * @type {Object}
  19744. */
  19745. 'imports': {
  19746. /**
  19747. * A reference to the `lodash` function.
  19748. *
  19749. * @memberOf _.templateSettings.imports
  19750. * @type {Function}
  19751. */
  19752. '_': lodash
  19753. }
  19754. };
  19755. // Ensure wrappers are instances of `baseLodash`.
  19756. lodash.prototype = baseLodash.prototype;
  19757. lodash.prototype.constructor = lodash;
  19758. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19759. LodashWrapper.prototype.constructor = LodashWrapper;
  19760. /*------------------------------------------------------------------------*/
  19761. /**
  19762. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19763. *
  19764. * @private
  19765. * @constructor
  19766. * @param {*} value The value to wrap.
  19767. */
  19768. function LazyWrapper(value) {
  19769. this.__wrapped__ = value;
  19770. this.__actions__ = [];
  19771. this.__dir__ = 1;
  19772. this.__filtered__ = false;
  19773. this.__iteratees__ = [];
  19774. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19775. this.__views__ = [];
  19776. }
  19777. /**
  19778. * Creates a clone of the lazy wrapper object.
  19779. *
  19780. * @private
  19781. * @name clone
  19782. * @memberOf LazyWrapper
  19783. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19784. */
  19785. function lazyClone() {
  19786. var result = new LazyWrapper(this.__wrapped__);
  19787. result.__actions__ = copyArray(this.__actions__);
  19788. result.__dir__ = this.__dir__;
  19789. result.__filtered__ = this.__filtered__;
  19790. result.__iteratees__ = copyArray(this.__iteratees__);
  19791. result.__takeCount__ = this.__takeCount__;
  19792. result.__views__ = copyArray(this.__views__);
  19793. return result;
  19794. }
  19795. /**
  19796. * Reverses the direction of lazy iteration.
  19797. *
  19798. * @private
  19799. * @name reverse
  19800. * @memberOf LazyWrapper
  19801. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19802. */
  19803. function lazyReverse() {
  19804. if (this.__filtered__) {
  19805. var result = new LazyWrapper(this);
  19806. result.__dir__ = -1;
  19807. result.__filtered__ = true;
  19808. } else {
  19809. result = this.clone();
  19810. result.__dir__ *= -1;
  19811. }
  19812. return result;
  19813. }
  19814. /**
  19815. * Extracts the unwrapped value from its lazy wrapper.
  19816. *
  19817. * @private
  19818. * @name value
  19819. * @memberOf LazyWrapper
  19820. * @returns {*} Returns the unwrapped value.
  19821. */
  19822. function lazyValue() {
  19823. var array = this.__wrapped__.value(),
  19824. dir = this.__dir__,
  19825. isArr = isArray(array),
  19826. isRight = dir < 0,
  19827. arrLength = isArr ? array.length : 0,
  19828. view = getView(0, arrLength, this.__views__),
  19829. start = view.start,
  19830. end = view.end,
  19831. length = end - start,
  19832. index = isRight ? end : (start - 1),
  19833. iteratees = this.__iteratees__,
  19834. iterLength = iteratees.length,
  19835. resIndex = 0,
  19836. takeCount = nativeMin(length, this.__takeCount__);
  19837. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19838. return baseWrapperValue(array, this.__actions__);
  19839. }
  19840. var result = [];
  19841. outer:
  19842. while (length-- && resIndex < takeCount) {
  19843. index += dir;
  19844. var iterIndex = -1,
  19845. value = array[index];
  19846. while (++iterIndex < iterLength) {
  19847. var data = iteratees[iterIndex],
  19848. iteratee = data.iteratee,
  19849. type = data.type,
  19850. computed = iteratee(value);
  19851. if (type == LAZY_MAP_FLAG) {
  19852. value = computed;
  19853. } else if (!computed) {
  19854. if (type == LAZY_FILTER_FLAG) {
  19855. continue outer;
  19856. } else {
  19857. break outer;
  19858. }
  19859. }
  19860. }
  19861. result[resIndex++] = value;
  19862. }
  19863. return result;
  19864. }
  19865. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19866. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19867. LazyWrapper.prototype.constructor = LazyWrapper;
  19868. /*------------------------------------------------------------------------*/
  19869. /**
  19870. * Creates a hash object.
  19871. *
  19872. * @private
  19873. * @constructor
  19874. * @param {Array} [entries] The key-value pairs to cache.
  19875. */
  19876. function Hash(entries) {
  19877. var index = -1,
  19878. length = entries == null ? 0 : entries.length;
  19879. this.clear();
  19880. while (++index < length) {
  19881. var entry = entries[index];
  19882. this.set(entry[0], entry[1]);
  19883. }
  19884. }
  19885. /**
  19886. * Removes all key-value entries from the hash.
  19887. *
  19888. * @private
  19889. * @name clear
  19890. * @memberOf Hash
  19891. */
  19892. function hashClear() {
  19893. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19894. this.size = 0;
  19895. }
  19896. /**
  19897. * Removes `key` and its value from the hash.
  19898. *
  19899. * @private
  19900. * @name delete
  19901. * @memberOf Hash
  19902. * @param {Object} hash The hash to modify.
  19903. * @param {string} key The key of the value to remove.
  19904. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19905. */
  19906. function hashDelete(key) {
  19907. var result = this.has(key) && delete this.__data__[key];
  19908. this.size -= result ? 1 : 0;
  19909. return result;
  19910. }
  19911. /**
  19912. * Gets the hash value for `key`.
  19913. *
  19914. * @private
  19915. * @name get
  19916. * @memberOf Hash
  19917. * @param {string} key The key of the value to get.
  19918. * @returns {*} Returns the entry value.
  19919. */
  19920. function hashGet(key) {
  19921. var data = this.__data__;
  19922. if (nativeCreate) {
  19923. var result = data[key];
  19924. return result === HASH_UNDEFINED ? undefined : result;
  19925. }
  19926. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  19927. }
  19928. /**
  19929. * Checks if a hash value for `key` exists.
  19930. *
  19931. * @private
  19932. * @name has
  19933. * @memberOf Hash
  19934. * @param {string} key The key of the entry to check.
  19935. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19936. */
  19937. function hashHas(key) {
  19938. var data = this.__data__;
  19939. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  19940. }
  19941. /**
  19942. * Sets the hash `key` to `value`.
  19943. *
  19944. * @private
  19945. * @name set
  19946. * @memberOf Hash
  19947. * @param {string} key The key of the value to set.
  19948. * @param {*} value The value to set.
  19949. * @returns {Object} Returns the hash instance.
  19950. */
  19951. function hashSet(key, value) {
  19952. var data = this.__data__;
  19953. this.size += this.has(key) ? 0 : 1;
  19954. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  19955. return this;
  19956. }
  19957. // Add methods to `Hash`.
  19958. Hash.prototype.clear = hashClear;
  19959. Hash.prototype['delete'] = hashDelete;
  19960. Hash.prototype.get = hashGet;
  19961. Hash.prototype.has = hashHas;
  19962. Hash.prototype.set = hashSet;
  19963. /*------------------------------------------------------------------------*/
  19964. /**
  19965. * Creates an list cache object.
  19966. *
  19967. * @private
  19968. * @constructor
  19969. * @param {Array} [entries] The key-value pairs to cache.
  19970. */
  19971. function ListCache(entries) {
  19972. var index = -1,
  19973. length = entries == null ? 0 : entries.length;
  19974. this.clear();
  19975. while (++index < length) {
  19976. var entry = entries[index];
  19977. this.set(entry[0], entry[1]);
  19978. }
  19979. }
  19980. /**
  19981. * Removes all key-value entries from the list cache.
  19982. *
  19983. * @private
  19984. * @name clear
  19985. * @memberOf ListCache
  19986. */
  19987. function listCacheClear() {
  19988. this.__data__ = [];
  19989. this.size = 0;
  19990. }
  19991. /**
  19992. * Removes `key` and its value from the list cache.
  19993. *
  19994. * @private
  19995. * @name delete
  19996. * @memberOf ListCache
  19997. * @param {string} key The key of the value to remove.
  19998. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19999. */
  20000. function listCacheDelete(key) {
  20001. var data = this.__data__,
  20002. index = assocIndexOf(data, key);
  20003. if (index < 0) {
  20004. return false;
  20005. }
  20006. var lastIndex = data.length - 1;
  20007. if (index == lastIndex) {
  20008. data.pop();
  20009. } else {
  20010. splice.call(data, index, 1);
  20011. }
  20012. --this.size;
  20013. return true;
  20014. }
  20015. /**
  20016. * Gets the list cache value for `key`.
  20017. *
  20018. * @private
  20019. * @name get
  20020. * @memberOf ListCache
  20021. * @param {string} key The key of the value to get.
  20022. * @returns {*} Returns the entry value.
  20023. */
  20024. function listCacheGet(key) {
  20025. var data = this.__data__,
  20026. index = assocIndexOf(data, key);
  20027. return index < 0 ? undefined : data[index][1];
  20028. }
  20029. /**
  20030. * Checks if a list cache value for `key` exists.
  20031. *
  20032. * @private
  20033. * @name has
  20034. * @memberOf ListCache
  20035. * @param {string} key The key of the entry to check.
  20036. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20037. */
  20038. function listCacheHas(key) {
  20039. return assocIndexOf(this.__data__, key) > -1;
  20040. }
  20041. /**
  20042. * Sets the list cache `key` to `value`.
  20043. *
  20044. * @private
  20045. * @name set
  20046. * @memberOf ListCache
  20047. * @param {string} key The key of the value to set.
  20048. * @param {*} value The value to set.
  20049. * @returns {Object} Returns the list cache instance.
  20050. */
  20051. function listCacheSet(key, value) {
  20052. var data = this.__data__,
  20053. index = assocIndexOf(data, key);
  20054. if (index < 0) {
  20055. ++this.size;
  20056. data.push([key, value]);
  20057. } else {
  20058. data[index][1] = value;
  20059. }
  20060. return this;
  20061. }
  20062. // Add methods to `ListCache`.
  20063. ListCache.prototype.clear = listCacheClear;
  20064. ListCache.prototype['delete'] = listCacheDelete;
  20065. ListCache.prototype.get = listCacheGet;
  20066. ListCache.prototype.has = listCacheHas;
  20067. ListCache.prototype.set = listCacheSet;
  20068. /*------------------------------------------------------------------------*/
  20069. /**
  20070. * Creates a map cache object to store key-value pairs.
  20071. *
  20072. * @private
  20073. * @constructor
  20074. * @param {Array} [entries] The key-value pairs to cache.
  20075. */
  20076. function MapCache(entries) {
  20077. var index = -1,
  20078. length = entries == null ? 0 : entries.length;
  20079. this.clear();
  20080. while (++index < length) {
  20081. var entry = entries[index];
  20082. this.set(entry[0], entry[1]);
  20083. }
  20084. }
  20085. /**
  20086. * Removes all key-value entries from the map.
  20087. *
  20088. * @private
  20089. * @name clear
  20090. * @memberOf MapCache
  20091. */
  20092. function mapCacheClear() {
  20093. this.size = 0;
  20094. this.__data__ = {
  20095. 'hash': new Hash,
  20096. 'map': new (Map || ListCache),
  20097. 'string': new Hash
  20098. };
  20099. }
  20100. /**
  20101. * Removes `key` and its value from the map.
  20102. *
  20103. * @private
  20104. * @name delete
  20105. * @memberOf MapCache
  20106. * @param {string} key The key of the value to remove.
  20107. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20108. */
  20109. function mapCacheDelete(key) {
  20110. var result = getMapData(this, key)['delete'](key);
  20111. this.size -= result ? 1 : 0;
  20112. return result;
  20113. }
  20114. /**
  20115. * Gets the map value for `key`.
  20116. *
  20117. * @private
  20118. * @name get
  20119. * @memberOf MapCache
  20120. * @param {string} key The key of the value to get.
  20121. * @returns {*} Returns the entry value.
  20122. */
  20123. function mapCacheGet(key) {
  20124. return getMapData(this, key).get(key);
  20125. }
  20126. /**
  20127. * Checks if a map value for `key` exists.
  20128. *
  20129. * @private
  20130. * @name has
  20131. * @memberOf MapCache
  20132. * @param {string} key The key of the entry to check.
  20133. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20134. */
  20135. function mapCacheHas(key) {
  20136. return getMapData(this, key).has(key);
  20137. }
  20138. /**
  20139. * Sets the map `key` to `value`.
  20140. *
  20141. * @private
  20142. * @name set
  20143. * @memberOf MapCache
  20144. * @param {string} key The key of the value to set.
  20145. * @param {*} value The value to set.
  20146. * @returns {Object} Returns the map cache instance.
  20147. */
  20148. function mapCacheSet(key, value) {
  20149. var data = getMapData(this, key),
  20150. size = data.size;
  20151. data.set(key, value);
  20152. this.size += data.size == size ? 0 : 1;
  20153. return this;
  20154. }
  20155. // Add methods to `MapCache`.
  20156. MapCache.prototype.clear = mapCacheClear;
  20157. MapCache.prototype['delete'] = mapCacheDelete;
  20158. MapCache.prototype.get = mapCacheGet;
  20159. MapCache.prototype.has = mapCacheHas;
  20160. MapCache.prototype.set = mapCacheSet;
  20161. /*------------------------------------------------------------------------*/
  20162. /**
  20163. *
  20164. * Creates an array cache object to store unique values.
  20165. *
  20166. * @private
  20167. * @constructor
  20168. * @param {Array} [values] The values to cache.
  20169. */
  20170. function SetCache(values) {
  20171. var index = -1,
  20172. length = values == null ? 0 : values.length;
  20173. this.__data__ = new MapCache;
  20174. while (++index < length) {
  20175. this.add(values[index]);
  20176. }
  20177. }
  20178. /**
  20179. * Adds `value` to the array cache.
  20180. *
  20181. * @private
  20182. * @name add
  20183. * @memberOf SetCache
  20184. * @alias push
  20185. * @param {*} value The value to cache.
  20186. * @returns {Object} Returns the cache instance.
  20187. */
  20188. function setCacheAdd(value) {
  20189. this.__data__.set(value, HASH_UNDEFINED);
  20190. return this;
  20191. }
  20192. /**
  20193. * Checks if `value` is in the array cache.
  20194. *
  20195. * @private
  20196. * @name has
  20197. * @memberOf SetCache
  20198. * @param {*} value The value to search for.
  20199. * @returns {number} Returns `true` if `value` is found, else `false`.
  20200. */
  20201. function setCacheHas(value) {
  20202. return this.__data__.has(value);
  20203. }
  20204. // Add methods to `SetCache`.
  20205. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20206. SetCache.prototype.has = setCacheHas;
  20207. /*------------------------------------------------------------------------*/
  20208. /**
  20209. * Creates a stack cache object to store key-value pairs.
  20210. *
  20211. * @private
  20212. * @constructor
  20213. * @param {Array} [entries] The key-value pairs to cache.
  20214. */
  20215. function Stack(entries) {
  20216. var data = this.__data__ = new ListCache(entries);
  20217. this.size = data.size;
  20218. }
  20219. /**
  20220. * Removes all key-value entries from the stack.
  20221. *
  20222. * @private
  20223. * @name clear
  20224. * @memberOf Stack
  20225. */
  20226. function stackClear() {
  20227. this.__data__ = new ListCache;
  20228. this.size = 0;
  20229. }
  20230. /**
  20231. * Removes `key` and its value from the stack.
  20232. *
  20233. * @private
  20234. * @name delete
  20235. * @memberOf Stack
  20236. * @param {string} key The key of the value to remove.
  20237. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20238. */
  20239. function stackDelete(key) {
  20240. var data = this.__data__,
  20241. result = data['delete'](key);
  20242. this.size = data.size;
  20243. return result;
  20244. }
  20245. /**
  20246. * Gets the stack value for `key`.
  20247. *
  20248. * @private
  20249. * @name get
  20250. * @memberOf Stack
  20251. * @param {string} key The key of the value to get.
  20252. * @returns {*} Returns the entry value.
  20253. */
  20254. function stackGet(key) {
  20255. return this.__data__.get(key);
  20256. }
  20257. /**
  20258. * Checks if a stack value for `key` exists.
  20259. *
  20260. * @private
  20261. * @name has
  20262. * @memberOf Stack
  20263. * @param {string} key The key of the entry to check.
  20264. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20265. */
  20266. function stackHas(key) {
  20267. return this.__data__.has(key);
  20268. }
  20269. /**
  20270. * Sets the stack `key` to `value`.
  20271. *
  20272. * @private
  20273. * @name set
  20274. * @memberOf Stack
  20275. * @param {string} key The key of the value to set.
  20276. * @param {*} value The value to set.
  20277. * @returns {Object} Returns the stack cache instance.
  20278. */
  20279. function stackSet(key, value) {
  20280. var data = this.__data__;
  20281. if (data instanceof ListCache) {
  20282. var pairs = data.__data__;
  20283. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20284. pairs.push([key, value]);
  20285. this.size = ++data.size;
  20286. return this;
  20287. }
  20288. data = this.__data__ = new MapCache(pairs);
  20289. }
  20290. data.set(key, value);
  20291. this.size = data.size;
  20292. return this;
  20293. }
  20294. // Add methods to `Stack`.
  20295. Stack.prototype.clear = stackClear;
  20296. Stack.prototype['delete'] = stackDelete;
  20297. Stack.prototype.get = stackGet;
  20298. Stack.prototype.has = stackHas;
  20299. Stack.prototype.set = stackSet;
  20300. /*------------------------------------------------------------------------*/
  20301. /**
  20302. * Creates an array of the enumerable property names of the array-like `value`.
  20303. *
  20304. * @private
  20305. * @param {*} value The value to query.
  20306. * @param {boolean} inherited Specify returning inherited property names.
  20307. * @returns {Array} Returns the array of property names.
  20308. */
  20309. function arrayLikeKeys(value, inherited) {
  20310. var isArr = isArray(value),
  20311. isArg = !isArr && isArguments(value),
  20312. isBuff = !isArr && !isArg && isBuffer(value),
  20313. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20314. skipIndexes = isArr || isArg || isBuff || isType,
  20315. result = skipIndexes ? baseTimes(value.length, String) : [],
  20316. length = result.length;
  20317. for (var key in value) {
  20318. if ((inherited || hasOwnProperty.call(value, key)) &&
  20319. !(skipIndexes && (
  20320. // Safari 9 has enumerable `arguments.length` in strict mode.
  20321. key == 'length' ||
  20322. // Node.js 0.10 has enumerable non-index properties on buffers.
  20323. (isBuff && (key == 'offset' || key == 'parent')) ||
  20324. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20325. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20326. // Skip index properties.
  20327. isIndex(key, length)
  20328. ))) {
  20329. result.push(key);
  20330. }
  20331. }
  20332. return result;
  20333. }
  20334. /**
  20335. * A specialized version of `_.sample` for arrays.
  20336. *
  20337. * @private
  20338. * @param {Array} array The array to sample.
  20339. * @returns {*} Returns the random element.
  20340. */
  20341. function arraySample(array) {
  20342. var length = array.length;
  20343. return length ? array[baseRandom(0, length - 1)] : undefined;
  20344. }
  20345. /**
  20346. * A specialized version of `_.sampleSize` for arrays.
  20347. *
  20348. * @private
  20349. * @param {Array} array The array to sample.
  20350. * @param {number} n The number of elements to sample.
  20351. * @returns {Array} Returns the random elements.
  20352. */
  20353. function arraySampleSize(array, n) {
  20354. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20355. }
  20356. /**
  20357. * A specialized version of `_.shuffle` for arrays.
  20358. *
  20359. * @private
  20360. * @param {Array} array The array to shuffle.
  20361. * @returns {Array} Returns the new shuffled array.
  20362. */
  20363. function arrayShuffle(array) {
  20364. return shuffleSelf(copyArray(array));
  20365. }
  20366. /**
  20367. * This function is like `assignValue` except that it doesn't assign
  20368. * `undefined` values.
  20369. *
  20370. * @private
  20371. * @param {Object} object The object to modify.
  20372. * @param {string} key The key of the property to assign.
  20373. * @param {*} value The value to assign.
  20374. */
  20375. function assignMergeValue(object, key, value) {
  20376. if ((value !== undefined && !eq(object[key], value)) ||
  20377. (value === undefined && !(key in object))) {
  20378. baseAssignValue(object, key, value);
  20379. }
  20380. }
  20381. /**
  20382. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20383. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20384. * for equality comparisons.
  20385. *
  20386. * @private
  20387. * @param {Object} object The object to modify.
  20388. * @param {string} key The key of the property to assign.
  20389. * @param {*} value The value to assign.
  20390. */
  20391. function assignValue(object, key, value) {
  20392. var objValue = object[key];
  20393. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20394. (value === undefined && !(key in object))) {
  20395. baseAssignValue(object, key, value);
  20396. }
  20397. }
  20398. /**
  20399. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20400. *
  20401. * @private
  20402. * @param {Array} array The array to inspect.
  20403. * @param {*} key The key to search for.
  20404. * @returns {number} Returns the index of the matched value, else `-1`.
  20405. */
  20406. function assocIndexOf(array, key) {
  20407. var length = array.length;
  20408. while (length--) {
  20409. if (eq(array[length][0], key)) {
  20410. return length;
  20411. }
  20412. }
  20413. return -1;
  20414. }
  20415. /**
  20416. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20417. * by `iteratee` and values set by `setter`.
  20418. *
  20419. * @private
  20420. * @param {Array|Object} collection The collection to iterate over.
  20421. * @param {Function} setter The function to set `accumulator` values.
  20422. * @param {Function} iteratee The iteratee to transform keys.
  20423. * @param {Object} accumulator The initial aggregated object.
  20424. * @returns {Function} Returns `accumulator`.
  20425. */
  20426. function baseAggregator(collection, setter, iteratee, accumulator) {
  20427. baseEach(collection, function(value, key, collection) {
  20428. setter(accumulator, value, iteratee(value), collection);
  20429. });
  20430. return accumulator;
  20431. }
  20432. /**
  20433. * The base implementation of `_.assign` without support for multiple sources
  20434. * or `customizer` functions.
  20435. *
  20436. * @private
  20437. * @param {Object} object The destination object.
  20438. * @param {Object} source The source object.
  20439. * @returns {Object} Returns `object`.
  20440. */
  20441. function baseAssign(object, source) {
  20442. return object && copyObject(source, keys(source), object);
  20443. }
  20444. /**
  20445. * The base implementation of `_.assignIn` without support for multiple sources
  20446. * or `customizer` functions.
  20447. *
  20448. * @private
  20449. * @param {Object} object The destination object.
  20450. * @param {Object} source The source object.
  20451. * @returns {Object} Returns `object`.
  20452. */
  20453. function baseAssignIn(object, source) {
  20454. return object && copyObject(source, keysIn(source), object);
  20455. }
  20456. /**
  20457. * The base implementation of `assignValue` and `assignMergeValue` without
  20458. * value checks.
  20459. *
  20460. * @private
  20461. * @param {Object} object The object to modify.
  20462. * @param {string} key The key of the property to assign.
  20463. * @param {*} value The value to assign.
  20464. */
  20465. function baseAssignValue(object, key, value) {
  20466. if (key == '__proto__' && defineProperty) {
  20467. defineProperty(object, key, {
  20468. 'configurable': true,
  20469. 'enumerable': true,
  20470. 'value': value,
  20471. 'writable': true
  20472. });
  20473. } else {
  20474. object[key] = value;
  20475. }
  20476. }
  20477. /**
  20478. * The base implementation of `_.at` without support for individual paths.
  20479. *
  20480. * @private
  20481. * @param {Object} object The object to iterate over.
  20482. * @param {string[]} paths The property paths to pick.
  20483. * @returns {Array} Returns the picked elements.
  20484. */
  20485. function baseAt(object, paths) {
  20486. var index = -1,
  20487. length = paths.length,
  20488. result = Array(length),
  20489. skip = object == null;
  20490. while (++index < length) {
  20491. result[index] = skip ? undefined : get(object, paths[index]);
  20492. }
  20493. return result;
  20494. }
  20495. /**
  20496. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20497. *
  20498. * @private
  20499. * @param {number} number The number to clamp.
  20500. * @param {number} [lower] The lower bound.
  20501. * @param {number} upper The upper bound.
  20502. * @returns {number} Returns the clamped number.
  20503. */
  20504. function baseClamp(number, lower, upper) {
  20505. if (number === number) {
  20506. if (upper !== undefined) {
  20507. number = number <= upper ? number : upper;
  20508. }
  20509. if (lower !== undefined) {
  20510. number = number >= lower ? number : lower;
  20511. }
  20512. }
  20513. return number;
  20514. }
  20515. /**
  20516. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20517. * traversed objects.
  20518. *
  20519. * @private
  20520. * @param {*} value The value to clone.
  20521. * @param {boolean} bitmask The bitmask flags.
  20522. * 1 - Deep clone
  20523. * 2 - Flatten inherited properties
  20524. * 4 - Clone symbols
  20525. * @param {Function} [customizer] The function to customize cloning.
  20526. * @param {string} [key] The key of `value`.
  20527. * @param {Object} [object] The parent object of `value`.
  20528. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20529. * @returns {*} Returns the cloned value.
  20530. */
  20531. function baseClone(value, bitmask, customizer, key, object, stack) {
  20532. var result,
  20533. isDeep = bitmask & CLONE_DEEP_FLAG,
  20534. isFlat = bitmask & CLONE_FLAT_FLAG,
  20535. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20536. if (customizer) {
  20537. result = object ? customizer(value, key, object, stack) : customizer(value);
  20538. }
  20539. if (result !== undefined) {
  20540. return result;
  20541. }
  20542. if (!isObject(value)) {
  20543. return value;
  20544. }
  20545. var isArr = isArray(value);
  20546. if (isArr) {
  20547. result = initCloneArray(value);
  20548. if (!isDeep) {
  20549. return copyArray(value, result);
  20550. }
  20551. } else {
  20552. var tag = getTag(value),
  20553. isFunc = tag == funcTag || tag == genTag;
  20554. if (isBuffer(value)) {
  20555. return cloneBuffer(value, isDeep);
  20556. }
  20557. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20558. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20559. if (!isDeep) {
  20560. return isFlat
  20561. ? copySymbolsIn(value, baseAssignIn(result, value))
  20562. : copySymbols(value, baseAssign(result, value));
  20563. }
  20564. } else {
  20565. if (!cloneableTags[tag]) {
  20566. return object ? value : {};
  20567. }
  20568. result = initCloneByTag(value, tag, isDeep);
  20569. }
  20570. }
  20571. // Check for circular references and return its corresponding clone.
  20572. stack || (stack = new Stack);
  20573. var stacked = stack.get(value);
  20574. if (stacked) {
  20575. return stacked;
  20576. }
  20577. stack.set(value, result);
  20578. if (isSet(value)) {
  20579. value.forEach(function(subValue) {
  20580. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20581. });
  20582. } else if (isMap(value)) {
  20583. value.forEach(function(subValue, key) {
  20584. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20585. });
  20586. }
  20587. var keysFunc = isFull
  20588. ? (isFlat ? getAllKeysIn : getAllKeys)
  20589. : (isFlat ? keysIn : keys);
  20590. var props = isArr ? undefined : keysFunc(value);
  20591. arrayEach(props || value, function(subValue, key) {
  20592. if (props) {
  20593. key = subValue;
  20594. subValue = value[key];
  20595. }
  20596. // Recursively populate clone (susceptible to call stack limits).
  20597. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20598. });
  20599. return result;
  20600. }
  20601. /**
  20602. * The base implementation of `_.conforms` which doesn't clone `source`.
  20603. *
  20604. * @private
  20605. * @param {Object} source The object of property predicates to conform to.
  20606. * @returns {Function} Returns the new spec function.
  20607. */
  20608. function baseConforms(source) {
  20609. var props = keys(source);
  20610. return function(object) {
  20611. return baseConformsTo(object, source, props);
  20612. };
  20613. }
  20614. /**
  20615. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20616. *
  20617. * @private
  20618. * @param {Object} object The object to inspect.
  20619. * @param {Object} source The object of property predicates to conform to.
  20620. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20621. */
  20622. function baseConformsTo(object, source, props) {
  20623. var length = props.length;
  20624. if (object == null) {
  20625. return !length;
  20626. }
  20627. object = Object(object);
  20628. while (length--) {
  20629. var key = props[length],
  20630. predicate = source[key],
  20631. value = object[key];
  20632. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20633. return false;
  20634. }
  20635. }
  20636. return true;
  20637. }
  20638. /**
  20639. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20640. * to provide to `func`.
  20641. *
  20642. * @private
  20643. * @param {Function} func The function to delay.
  20644. * @param {number} wait The number of milliseconds to delay invocation.
  20645. * @param {Array} args The arguments to provide to `func`.
  20646. * @returns {number|Object} Returns the timer id or timeout object.
  20647. */
  20648. function baseDelay(func, wait, args) {
  20649. if (typeof func != 'function') {
  20650. throw new TypeError(FUNC_ERROR_TEXT);
  20651. }
  20652. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20653. }
  20654. /**
  20655. * The base implementation of methods like `_.difference` without support
  20656. * for excluding multiple arrays or iteratee shorthands.
  20657. *
  20658. * @private
  20659. * @param {Array} array The array to inspect.
  20660. * @param {Array} values The values to exclude.
  20661. * @param {Function} [iteratee] The iteratee invoked per element.
  20662. * @param {Function} [comparator] The comparator invoked per element.
  20663. * @returns {Array} Returns the new array of filtered values.
  20664. */
  20665. function baseDifference(array, values, iteratee, comparator) {
  20666. var index = -1,
  20667. includes = arrayIncludes,
  20668. isCommon = true,
  20669. length = array.length,
  20670. result = [],
  20671. valuesLength = values.length;
  20672. if (!length) {
  20673. return result;
  20674. }
  20675. if (iteratee) {
  20676. values = arrayMap(values, baseUnary(iteratee));
  20677. }
  20678. if (comparator) {
  20679. includes = arrayIncludesWith;
  20680. isCommon = false;
  20681. }
  20682. else if (values.length >= LARGE_ARRAY_SIZE) {
  20683. includes = cacheHas;
  20684. isCommon = false;
  20685. values = new SetCache(values);
  20686. }
  20687. outer:
  20688. while (++index < length) {
  20689. var value = array[index],
  20690. computed = iteratee == null ? value : iteratee(value);
  20691. value = (comparator || value !== 0) ? value : 0;
  20692. if (isCommon && computed === computed) {
  20693. var valuesIndex = valuesLength;
  20694. while (valuesIndex--) {
  20695. if (values[valuesIndex] === computed) {
  20696. continue outer;
  20697. }
  20698. }
  20699. result.push(value);
  20700. }
  20701. else if (!includes(values, computed, comparator)) {
  20702. result.push(value);
  20703. }
  20704. }
  20705. return result;
  20706. }
  20707. /**
  20708. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20709. *
  20710. * @private
  20711. * @param {Array|Object} collection The collection to iterate over.
  20712. * @param {Function} iteratee The function invoked per iteration.
  20713. * @returns {Array|Object} Returns `collection`.
  20714. */
  20715. var baseEach = createBaseEach(baseForOwn);
  20716. /**
  20717. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20718. *
  20719. * @private
  20720. * @param {Array|Object} collection The collection to iterate over.
  20721. * @param {Function} iteratee The function invoked per iteration.
  20722. * @returns {Array|Object} Returns `collection`.
  20723. */
  20724. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20725. /**
  20726. * The base implementation of `_.every` without support for iteratee shorthands.
  20727. *
  20728. * @private
  20729. * @param {Array|Object} collection The collection to iterate over.
  20730. * @param {Function} predicate The function invoked per iteration.
  20731. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20732. * else `false`
  20733. */
  20734. function baseEvery(collection, predicate) {
  20735. var result = true;
  20736. baseEach(collection, function(value, index, collection) {
  20737. result = !!predicate(value, index, collection);
  20738. return result;
  20739. });
  20740. return result;
  20741. }
  20742. /**
  20743. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20744. * `comparator` to determine the extremum value.
  20745. *
  20746. * @private
  20747. * @param {Array} array The array to iterate over.
  20748. * @param {Function} iteratee The iteratee invoked per iteration.
  20749. * @param {Function} comparator The comparator used to compare values.
  20750. * @returns {*} Returns the extremum value.
  20751. */
  20752. function baseExtremum(array, iteratee, comparator) {
  20753. var index = -1,
  20754. length = array.length;
  20755. while (++index < length) {
  20756. var value = array[index],
  20757. current = iteratee(value);
  20758. if (current != null && (computed === undefined
  20759. ? (current === current && !isSymbol(current))
  20760. : comparator(current, computed)
  20761. )) {
  20762. var computed = current,
  20763. result = value;
  20764. }
  20765. }
  20766. return result;
  20767. }
  20768. /**
  20769. * The base implementation of `_.fill` without an iteratee call guard.
  20770. *
  20771. * @private
  20772. * @param {Array} array The array to fill.
  20773. * @param {*} value The value to fill `array` with.
  20774. * @param {number} [start=0] The start position.
  20775. * @param {number} [end=array.length] The end position.
  20776. * @returns {Array} Returns `array`.
  20777. */
  20778. function baseFill(array, value, start, end) {
  20779. var length = array.length;
  20780. start = toInteger(start);
  20781. if (start < 0) {
  20782. start = -start > length ? 0 : (length + start);
  20783. }
  20784. end = (end === undefined || end > length) ? length : toInteger(end);
  20785. if (end < 0) {
  20786. end += length;
  20787. }
  20788. end = start > end ? 0 : toLength(end);
  20789. while (start < end) {
  20790. array[start++] = value;
  20791. }
  20792. return array;
  20793. }
  20794. /**
  20795. * The base implementation of `_.filter` without support for iteratee shorthands.
  20796. *
  20797. * @private
  20798. * @param {Array|Object} collection The collection to iterate over.
  20799. * @param {Function} predicate The function invoked per iteration.
  20800. * @returns {Array} Returns the new filtered array.
  20801. */
  20802. function baseFilter(collection, predicate) {
  20803. var result = [];
  20804. baseEach(collection, function(value, index, collection) {
  20805. if (predicate(value, index, collection)) {
  20806. result.push(value);
  20807. }
  20808. });
  20809. return result;
  20810. }
  20811. /**
  20812. * The base implementation of `_.flatten` with support for restricting flattening.
  20813. *
  20814. * @private
  20815. * @param {Array} array The array to flatten.
  20816. * @param {number} depth The maximum recursion depth.
  20817. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20818. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20819. * @param {Array} [result=[]] The initial result value.
  20820. * @returns {Array} Returns the new flattened array.
  20821. */
  20822. function baseFlatten(array, depth, predicate, isStrict, result) {
  20823. var index = -1,
  20824. length = array.length;
  20825. predicate || (predicate = isFlattenable);
  20826. result || (result = []);
  20827. while (++index < length) {
  20828. var value = array[index];
  20829. if (depth > 0 && predicate(value)) {
  20830. if (depth > 1) {
  20831. // Recursively flatten arrays (susceptible to call stack limits).
  20832. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20833. } else {
  20834. arrayPush(result, value);
  20835. }
  20836. } else if (!isStrict) {
  20837. result[result.length] = value;
  20838. }
  20839. }
  20840. return result;
  20841. }
  20842. /**
  20843. * The base implementation of `baseForOwn` which iterates over `object`
  20844. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20845. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20846. *
  20847. * @private
  20848. * @param {Object} object The object to iterate over.
  20849. * @param {Function} iteratee The function invoked per iteration.
  20850. * @param {Function} keysFunc The function to get the keys of `object`.
  20851. * @returns {Object} Returns `object`.
  20852. */
  20853. var baseFor = createBaseFor();
  20854. /**
  20855. * This function is like `baseFor` except that it iterates over properties
  20856. * in the opposite order.
  20857. *
  20858. * @private
  20859. * @param {Object} object The object to iterate over.
  20860. * @param {Function} iteratee The function invoked per iteration.
  20861. * @param {Function} keysFunc The function to get the keys of `object`.
  20862. * @returns {Object} Returns `object`.
  20863. */
  20864. var baseForRight = createBaseFor(true);
  20865. /**
  20866. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20867. *
  20868. * @private
  20869. * @param {Object} object The object to iterate over.
  20870. * @param {Function} iteratee The function invoked per iteration.
  20871. * @returns {Object} Returns `object`.
  20872. */
  20873. function baseForOwn(object, iteratee) {
  20874. return object && baseFor(object, iteratee, keys);
  20875. }
  20876. /**
  20877. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20878. *
  20879. * @private
  20880. * @param {Object} object The object to iterate over.
  20881. * @param {Function} iteratee The function invoked per iteration.
  20882. * @returns {Object} Returns `object`.
  20883. */
  20884. function baseForOwnRight(object, iteratee) {
  20885. return object && baseForRight(object, iteratee, keys);
  20886. }
  20887. /**
  20888. * The base implementation of `_.functions` which creates an array of
  20889. * `object` function property names filtered from `props`.
  20890. *
  20891. * @private
  20892. * @param {Object} object The object to inspect.
  20893. * @param {Array} props The property names to filter.
  20894. * @returns {Array} Returns the function names.
  20895. */
  20896. function baseFunctions(object, props) {
  20897. return arrayFilter(props, function(key) {
  20898. return isFunction(object[key]);
  20899. });
  20900. }
  20901. /**
  20902. * The base implementation of `_.get` without support for default values.
  20903. *
  20904. * @private
  20905. * @param {Object} object The object to query.
  20906. * @param {Array|string} path The path of the property to get.
  20907. * @returns {*} Returns the resolved value.
  20908. */
  20909. function baseGet(object, path) {
  20910. path = castPath(path, object);
  20911. var index = 0,
  20912. length = path.length;
  20913. while (object != null && index < length) {
  20914. object = object[toKey(path[index++])];
  20915. }
  20916. return (index && index == length) ? object : undefined;
  20917. }
  20918. /**
  20919. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  20920. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  20921. * symbols of `object`.
  20922. *
  20923. * @private
  20924. * @param {Object} object The object to query.
  20925. * @param {Function} keysFunc The function to get the keys of `object`.
  20926. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  20927. * @returns {Array} Returns the array of property names and symbols.
  20928. */
  20929. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  20930. var result = keysFunc(object);
  20931. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  20932. }
  20933. /**
  20934. * The base implementation of `getTag` without fallbacks for buggy environments.
  20935. *
  20936. * @private
  20937. * @param {*} value The value to query.
  20938. * @returns {string} Returns the `toStringTag`.
  20939. */
  20940. function baseGetTag(value) {
  20941. if (value == null) {
  20942. return value === undefined ? undefinedTag : nullTag;
  20943. }
  20944. return (symToStringTag && symToStringTag in Object(value))
  20945. ? getRawTag(value)
  20946. : objectToString(value);
  20947. }
  20948. /**
  20949. * The base implementation of `_.gt` which doesn't coerce arguments.
  20950. *
  20951. * @private
  20952. * @param {*} value The value to compare.
  20953. * @param {*} other The other value to compare.
  20954. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  20955. * else `false`.
  20956. */
  20957. function baseGt(value, other) {
  20958. return value > other;
  20959. }
  20960. /**
  20961. * The base implementation of `_.has` without support for deep paths.
  20962. *
  20963. * @private
  20964. * @param {Object} [object] The object to query.
  20965. * @param {Array|string} key The key to check.
  20966. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20967. */
  20968. function baseHas(object, key) {
  20969. return object != null && hasOwnProperty.call(object, key);
  20970. }
  20971. /**
  20972. * The base implementation of `_.hasIn` without support for deep paths.
  20973. *
  20974. * @private
  20975. * @param {Object} [object] The object to query.
  20976. * @param {Array|string} key The key to check.
  20977. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20978. */
  20979. function baseHasIn(object, key) {
  20980. return object != null && key in Object(object);
  20981. }
  20982. /**
  20983. * The base implementation of `_.inRange` which doesn't coerce arguments.
  20984. *
  20985. * @private
  20986. * @param {number} number The number to check.
  20987. * @param {number} start The start of the range.
  20988. * @param {number} end The end of the range.
  20989. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  20990. */
  20991. function baseInRange(number, start, end) {
  20992. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  20993. }
  20994. /**
  20995. * The base implementation of methods like `_.intersection`, without support
  20996. * for iteratee shorthands, that accepts an array of arrays to inspect.
  20997. *
  20998. * @private
  20999. * @param {Array} arrays The arrays to inspect.
  21000. * @param {Function} [iteratee] The iteratee invoked per element.
  21001. * @param {Function} [comparator] The comparator invoked per element.
  21002. * @returns {Array} Returns the new array of shared values.
  21003. */
  21004. function baseIntersection(arrays, iteratee, comparator) {
  21005. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21006. length = arrays[0].length,
  21007. othLength = arrays.length,
  21008. othIndex = othLength,
  21009. caches = Array(othLength),
  21010. maxLength = Infinity,
  21011. result = [];
  21012. while (othIndex--) {
  21013. var array = arrays[othIndex];
  21014. if (othIndex && iteratee) {
  21015. array = arrayMap(array, baseUnary(iteratee));
  21016. }
  21017. maxLength = nativeMin(array.length, maxLength);
  21018. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21019. ? new SetCache(othIndex && array)
  21020. : undefined;
  21021. }
  21022. array = arrays[0];
  21023. var index = -1,
  21024. seen = caches[0];
  21025. outer:
  21026. while (++index < length && result.length < maxLength) {
  21027. var value = array[index],
  21028. computed = iteratee ? iteratee(value) : value;
  21029. value = (comparator || value !== 0) ? value : 0;
  21030. if (!(seen
  21031. ? cacheHas(seen, computed)
  21032. : includes(result, computed, comparator)
  21033. )) {
  21034. othIndex = othLength;
  21035. while (--othIndex) {
  21036. var cache = caches[othIndex];
  21037. if (!(cache
  21038. ? cacheHas(cache, computed)
  21039. : includes(arrays[othIndex], computed, comparator))
  21040. ) {
  21041. continue outer;
  21042. }
  21043. }
  21044. if (seen) {
  21045. seen.push(computed);
  21046. }
  21047. result.push(value);
  21048. }
  21049. }
  21050. return result;
  21051. }
  21052. /**
  21053. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21054. * `object` with values transformed by `iteratee` and set by `setter`.
  21055. *
  21056. * @private
  21057. * @param {Object} object The object to iterate over.
  21058. * @param {Function} setter The function to set `accumulator` values.
  21059. * @param {Function} iteratee The iteratee to transform values.
  21060. * @param {Object} accumulator The initial inverted object.
  21061. * @returns {Function} Returns `accumulator`.
  21062. */
  21063. function baseInverter(object, setter, iteratee, accumulator) {
  21064. baseForOwn(object, function(value, key, object) {
  21065. setter(accumulator, iteratee(value), key, object);
  21066. });
  21067. return accumulator;
  21068. }
  21069. /**
  21070. * The base implementation of `_.invoke` without support for individual
  21071. * method arguments.
  21072. *
  21073. * @private
  21074. * @param {Object} object The object to query.
  21075. * @param {Array|string} path The path of the method to invoke.
  21076. * @param {Array} args The arguments to invoke the method with.
  21077. * @returns {*} Returns the result of the invoked method.
  21078. */
  21079. function baseInvoke(object, path, args) {
  21080. path = castPath(path, object);
  21081. object = parent(object, path);
  21082. var func = object == null ? object : object[toKey(last(path))];
  21083. return func == null ? undefined : apply(func, object, args);
  21084. }
  21085. /**
  21086. * The base implementation of `_.isArguments`.
  21087. *
  21088. * @private
  21089. * @param {*} value The value to check.
  21090. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21091. */
  21092. function baseIsArguments(value) {
  21093. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21094. }
  21095. /**
  21096. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21097. *
  21098. * @private
  21099. * @param {*} value The value to check.
  21100. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21101. */
  21102. function baseIsArrayBuffer(value) {
  21103. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21104. }
  21105. /**
  21106. * The base implementation of `_.isDate` without Node.js optimizations.
  21107. *
  21108. * @private
  21109. * @param {*} value The value to check.
  21110. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21111. */
  21112. function baseIsDate(value) {
  21113. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21114. }
  21115. /**
  21116. * The base implementation of `_.isEqual` which supports partial comparisons
  21117. * and tracks traversed objects.
  21118. *
  21119. * @private
  21120. * @param {*} value The value to compare.
  21121. * @param {*} other The other value to compare.
  21122. * @param {boolean} bitmask The bitmask flags.
  21123. * 1 - Unordered comparison
  21124. * 2 - Partial comparison
  21125. * @param {Function} [customizer] The function to customize comparisons.
  21126. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21127. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21128. */
  21129. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21130. if (value === other) {
  21131. return true;
  21132. }
  21133. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21134. return value !== value && other !== other;
  21135. }
  21136. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21137. }
  21138. /**
  21139. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21140. * deep comparisons and tracks traversed objects enabling objects with circular
  21141. * references to be compared.
  21142. *
  21143. * @private
  21144. * @param {Object} object The object to compare.
  21145. * @param {Object} other The other object to compare.
  21146. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21147. * @param {Function} customizer The function to customize comparisons.
  21148. * @param {Function} equalFunc The function to determine equivalents of values.
  21149. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21150. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21151. */
  21152. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21153. var objIsArr = isArray(object),
  21154. othIsArr = isArray(other),
  21155. objTag = objIsArr ? arrayTag : getTag(object),
  21156. othTag = othIsArr ? arrayTag : getTag(other);
  21157. objTag = objTag == argsTag ? objectTag : objTag;
  21158. othTag = othTag == argsTag ? objectTag : othTag;
  21159. var objIsObj = objTag == objectTag,
  21160. othIsObj = othTag == objectTag,
  21161. isSameTag = objTag == othTag;
  21162. if (isSameTag && isBuffer(object)) {
  21163. if (!isBuffer(other)) {
  21164. return false;
  21165. }
  21166. objIsArr = true;
  21167. objIsObj = false;
  21168. }
  21169. if (isSameTag && !objIsObj) {
  21170. stack || (stack = new Stack);
  21171. return (objIsArr || isTypedArray(object))
  21172. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21173. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21174. }
  21175. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21176. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21177. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21178. if (objIsWrapped || othIsWrapped) {
  21179. var objUnwrapped = objIsWrapped ? object.value() : object,
  21180. othUnwrapped = othIsWrapped ? other.value() : other;
  21181. stack || (stack = new Stack);
  21182. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21183. }
  21184. }
  21185. if (!isSameTag) {
  21186. return false;
  21187. }
  21188. stack || (stack = new Stack);
  21189. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21190. }
  21191. /**
  21192. * The base implementation of `_.isMap` without Node.js optimizations.
  21193. *
  21194. * @private
  21195. * @param {*} value The value to check.
  21196. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21197. */
  21198. function baseIsMap(value) {
  21199. return isObjectLike(value) && getTag(value) == mapTag;
  21200. }
  21201. /**
  21202. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21203. *
  21204. * @private
  21205. * @param {Object} object The object to inspect.
  21206. * @param {Object} source The object of property values to match.
  21207. * @param {Array} matchData The property names, values, and compare flags to match.
  21208. * @param {Function} [customizer] The function to customize comparisons.
  21209. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21210. */
  21211. function baseIsMatch(object, source, matchData, customizer) {
  21212. var index = matchData.length,
  21213. length = index,
  21214. noCustomizer = !customizer;
  21215. if (object == null) {
  21216. return !length;
  21217. }
  21218. object = Object(object);
  21219. while (index--) {
  21220. var data = matchData[index];
  21221. if ((noCustomizer && data[2])
  21222. ? data[1] !== object[data[0]]
  21223. : !(data[0] in object)
  21224. ) {
  21225. return false;
  21226. }
  21227. }
  21228. while (++index < length) {
  21229. data = matchData[index];
  21230. var key = data[0],
  21231. objValue = object[key],
  21232. srcValue = data[1];
  21233. if (noCustomizer && data[2]) {
  21234. if (objValue === undefined && !(key in object)) {
  21235. return false;
  21236. }
  21237. } else {
  21238. var stack = new Stack;
  21239. if (customizer) {
  21240. var result = customizer(objValue, srcValue, key, object, source, stack);
  21241. }
  21242. if (!(result === undefined
  21243. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21244. : result
  21245. )) {
  21246. return false;
  21247. }
  21248. }
  21249. }
  21250. return true;
  21251. }
  21252. /**
  21253. * The base implementation of `_.isNative` without bad shim checks.
  21254. *
  21255. * @private
  21256. * @param {*} value The value to check.
  21257. * @returns {boolean} Returns `true` if `value` is a native function,
  21258. * else `false`.
  21259. */
  21260. function baseIsNative(value) {
  21261. if (!isObject(value) || isMasked(value)) {
  21262. return false;
  21263. }
  21264. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21265. return pattern.test(toSource(value));
  21266. }
  21267. /**
  21268. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21269. *
  21270. * @private
  21271. * @param {*} value The value to check.
  21272. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21273. */
  21274. function baseIsRegExp(value) {
  21275. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21276. }
  21277. /**
  21278. * The base implementation of `_.isSet` without Node.js optimizations.
  21279. *
  21280. * @private
  21281. * @param {*} value The value to check.
  21282. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21283. */
  21284. function baseIsSet(value) {
  21285. return isObjectLike(value) && getTag(value) == setTag;
  21286. }
  21287. /**
  21288. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21289. *
  21290. * @private
  21291. * @param {*} value The value to check.
  21292. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21293. */
  21294. function baseIsTypedArray(value) {
  21295. return isObjectLike(value) &&
  21296. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21297. }
  21298. /**
  21299. * The base implementation of `_.iteratee`.
  21300. *
  21301. * @private
  21302. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21303. * @returns {Function} Returns the iteratee.
  21304. */
  21305. function baseIteratee(value) {
  21306. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21307. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21308. if (typeof value == 'function') {
  21309. return value;
  21310. }
  21311. if (value == null) {
  21312. return identity;
  21313. }
  21314. if (typeof value == 'object') {
  21315. return isArray(value)
  21316. ? baseMatchesProperty(value[0], value[1])
  21317. : baseMatches(value);
  21318. }
  21319. return property(value);
  21320. }
  21321. /**
  21322. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21323. *
  21324. * @private
  21325. * @param {Object} object The object to query.
  21326. * @returns {Array} Returns the array of property names.
  21327. */
  21328. function baseKeys(object) {
  21329. if (!isPrototype(object)) {
  21330. return nativeKeys(object);
  21331. }
  21332. var result = [];
  21333. for (var key in Object(object)) {
  21334. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21335. result.push(key);
  21336. }
  21337. }
  21338. return result;
  21339. }
  21340. /**
  21341. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21342. *
  21343. * @private
  21344. * @param {Object} object The object to query.
  21345. * @returns {Array} Returns the array of property names.
  21346. */
  21347. function baseKeysIn(object) {
  21348. if (!isObject(object)) {
  21349. return nativeKeysIn(object);
  21350. }
  21351. var isProto = isPrototype(object),
  21352. result = [];
  21353. for (var key in object) {
  21354. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21355. result.push(key);
  21356. }
  21357. }
  21358. return result;
  21359. }
  21360. /**
  21361. * The base implementation of `_.lt` which doesn't coerce arguments.
  21362. *
  21363. * @private
  21364. * @param {*} value The value to compare.
  21365. * @param {*} other The other value to compare.
  21366. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21367. * else `false`.
  21368. */
  21369. function baseLt(value, other) {
  21370. return value < other;
  21371. }
  21372. /**
  21373. * The base implementation of `_.map` without support for iteratee shorthands.
  21374. *
  21375. * @private
  21376. * @param {Array|Object} collection The collection to iterate over.
  21377. * @param {Function} iteratee The function invoked per iteration.
  21378. * @returns {Array} Returns the new mapped array.
  21379. */
  21380. function baseMap(collection, iteratee) {
  21381. var index = -1,
  21382. result = isArrayLike(collection) ? Array(collection.length) : [];
  21383. baseEach(collection, function(value, key, collection) {
  21384. result[++index] = iteratee(value, key, collection);
  21385. });
  21386. return result;
  21387. }
  21388. /**
  21389. * The base implementation of `_.matches` which doesn't clone `source`.
  21390. *
  21391. * @private
  21392. * @param {Object} source The object of property values to match.
  21393. * @returns {Function} Returns the new spec function.
  21394. */
  21395. function baseMatches(source) {
  21396. var matchData = getMatchData(source);
  21397. if (matchData.length == 1 && matchData[0][2]) {
  21398. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21399. }
  21400. return function(object) {
  21401. return object === source || baseIsMatch(object, source, matchData);
  21402. };
  21403. }
  21404. /**
  21405. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21406. *
  21407. * @private
  21408. * @param {string} path The path of the property to get.
  21409. * @param {*} srcValue The value to match.
  21410. * @returns {Function} Returns the new spec function.
  21411. */
  21412. function baseMatchesProperty(path, srcValue) {
  21413. if (isKey(path) && isStrictComparable(srcValue)) {
  21414. return matchesStrictComparable(toKey(path), srcValue);
  21415. }
  21416. return function(object) {
  21417. var objValue = get(object, path);
  21418. return (objValue === undefined && objValue === srcValue)
  21419. ? hasIn(object, path)
  21420. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21421. };
  21422. }
  21423. /**
  21424. * The base implementation of `_.merge` without support for multiple sources.
  21425. *
  21426. * @private
  21427. * @param {Object} object The destination object.
  21428. * @param {Object} source The source object.
  21429. * @param {number} srcIndex The index of `source`.
  21430. * @param {Function} [customizer] The function to customize merged values.
  21431. * @param {Object} [stack] Tracks traversed source values and their merged
  21432. * counterparts.
  21433. */
  21434. function baseMerge(object, source, srcIndex, customizer, stack) {
  21435. if (object === source) {
  21436. return;
  21437. }
  21438. baseFor(source, function(srcValue, key) {
  21439. stack || (stack = new Stack);
  21440. if (isObject(srcValue)) {
  21441. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21442. }
  21443. else {
  21444. var newValue = customizer
  21445. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21446. : undefined;
  21447. if (newValue === undefined) {
  21448. newValue = srcValue;
  21449. }
  21450. assignMergeValue(object, key, newValue);
  21451. }
  21452. }, keysIn);
  21453. }
  21454. /**
  21455. * A specialized version of `baseMerge` for arrays and objects which performs
  21456. * deep merges and tracks traversed objects enabling objects with circular
  21457. * references to be merged.
  21458. *
  21459. * @private
  21460. * @param {Object} object The destination object.
  21461. * @param {Object} source The source object.
  21462. * @param {string} key The key of the value to merge.
  21463. * @param {number} srcIndex The index of `source`.
  21464. * @param {Function} mergeFunc The function to merge values.
  21465. * @param {Function} [customizer] The function to customize assigned values.
  21466. * @param {Object} [stack] Tracks traversed source values and their merged
  21467. * counterparts.
  21468. */
  21469. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21470. var objValue = safeGet(object, key),
  21471. srcValue = safeGet(source, key),
  21472. stacked = stack.get(srcValue);
  21473. if (stacked) {
  21474. assignMergeValue(object, key, stacked);
  21475. return;
  21476. }
  21477. var newValue = customizer
  21478. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21479. : undefined;
  21480. var isCommon = newValue === undefined;
  21481. if (isCommon) {
  21482. var isArr = isArray(srcValue),
  21483. isBuff = !isArr && isBuffer(srcValue),
  21484. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21485. newValue = srcValue;
  21486. if (isArr || isBuff || isTyped) {
  21487. if (isArray(objValue)) {
  21488. newValue = objValue;
  21489. }
  21490. else if (isArrayLikeObject(objValue)) {
  21491. newValue = copyArray(objValue);
  21492. }
  21493. else if (isBuff) {
  21494. isCommon = false;
  21495. newValue = cloneBuffer(srcValue, true);
  21496. }
  21497. else if (isTyped) {
  21498. isCommon = false;
  21499. newValue = cloneTypedArray(srcValue, true);
  21500. }
  21501. else {
  21502. newValue = [];
  21503. }
  21504. }
  21505. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21506. newValue = objValue;
  21507. if (isArguments(objValue)) {
  21508. newValue = toPlainObject(objValue);
  21509. }
  21510. else if (!isObject(objValue) || isFunction(objValue)) {
  21511. newValue = initCloneObject(srcValue);
  21512. }
  21513. }
  21514. else {
  21515. isCommon = false;
  21516. }
  21517. }
  21518. if (isCommon) {
  21519. // Recursively merge objects and arrays (susceptible to call stack limits).
  21520. stack.set(srcValue, newValue);
  21521. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21522. stack['delete'](srcValue);
  21523. }
  21524. assignMergeValue(object, key, newValue);
  21525. }
  21526. /**
  21527. * The base implementation of `_.nth` which doesn't coerce arguments.
  21528. *
  21529. * @private
  21530. * @param {Array} array The array to query.
  21531. * @param {number} n The index of the element to return.
  21532. * @returns {*} Returns the nth element of `array`.
  21533. */
  21534. function baseNth(array, n) {
  21535. var length = array.length;
  21536. if (!length) {
  21537. return;
  21538. }
  21539. n += n < 0 ? length : 0;
  21540. return isIndex(n, length) ? array[n] : undefined;
  21541. }
  21542. /**
  21543. * The base implementation of `_.orderBy` without param guards.
  21544. *
  21545. * @private
  21546. * @param {Array|Object} collection The collection to iterate over.
  21547. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21548. * @param {string[]} orders The sort orders of `iteratees`.
  21549. * @returns {Array} Returns the new sorted array.
  21550. */
  21551. function baseOrderBy(collection, iteratees, orders) {
  21552. var index = -1;
  21553. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21554. var result = baseMap(collection, function(value, key, collection) {
  21555. var criteria = arrayMap(iteratees, function(iteratee) {
  21556. return iteratee(value);
  21557. });
  21558. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21559. });
  21560. return baseSortBy(result, function(object, other) {
  21561. return compareMultiple(object, other, orders);
  21562. });
  21563. }
  21564. /**
  21565. * The base implementation of `_.pick` without support for individual
  21566. * property identifiers.
  21567. *
  21568. * @private
  21569. * @param {Object} object The source object.
  21570. * @param {string[]} paths The property paths to pick.
  21571. * @returns {Object} Returns the new object.
  21572. */
  21573. function basePick(object, paths) {
  21574. return basePickBy(object, paths, function(value, path) {
  21575. return hasIn(object, path);
  21576. });
  21577. }
  21578. /**
  21579. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21580. *
  21581. * @private
  21582. * @param {Object} object The source object.
  21583. * @param {string[]} paths The property paths to pick.
  21584. * @param {Function} predicate The function invoked per property.
  21585. * @returns {Object} Returns the new object.
  21586. */
  21587. function basePickBy(object, paths, predicate) {
  21588. var index = -1,
  21589. length = paths.length,
  21590. result = {};
  21591. while (++index < length) {
  21592. var path = paths[index],
  21593. value = baseGet(object, path);
  21594. if (predicate(value, path)) {
  21595. baseSet(result, castPath(path, object), value);
  21596. }
  21597. }
  21598. return result;
  21599. }
  21600. /**
  21601. * A specialized version of `baseProperty` which supports deep paths.
  21602. *
  21603. * @private
  21604. * @param {Array|string} path The path of the property to get.
  21605. * @returns {Function} Returns the new accessor function.
  21606. */
  21607. function basePropertyDeep(path) {
  21608. return function(object) {
  21609. return baseGet(object, path);
  21610. };
  21611. }
  21612. /**
  21613. * The base implementation of `_.pullAllBy` without support for iteratee
  21614. * shorthands.
  21615. *
  21616. * @private
  21617. * @param {Array} array The array to modify.
  21618. * @param {Array} values The values to remove.
  21619. * @param {Function} [iteratee] The iteratee invoked per element.
  21620. * @param {Function} [comparator] The comparator invoked per element.
  21621. * @returns {Array} Returns `array`.
  21622. */
  21623. function basePullAll(array, values, iteratee, comparator) {
  21624. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21625. index = -1,
  21626. length = values.length,
  21627. seen = array;
  21628. if (array === values) {
  21629. values = copyArray(values);
  21630. }
  21631. if (iteratee) {
  21632. seen = arrayMap(array, baseUnary(iteratee));
  21633. }
  21634. while (++index < length) {
  21635. var fromIndex = 0,
  21636. value = values[index],
  21637. computed = iteratee ? iteratee(value) : value;
  21638. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21639. if (seen !== array) {
  21640. splice.call(seen, fromIndex, 1);
  21641. }
  21642. splice.call(array, fromIndex, 1);
  21643. }
  21644. }
  21645. return array;
  21646. }
  21647. /**
  21648. * The base implementation of `_.pullAt` without support for individual
  21649. * indexes or capturing the removed elements.
  21650. *
  21651. * @private
  21652. * @param {Array} array The array to modify.
  21653. * @param {number[]} indexes The indexes of elements to remove.
  21654. * @returns {Array} Returns `array`.
  21655. */
  21656. function basePullAt(array, indexes) {
  21657. var length = array ? indexes.length : 0,
  21658. lastIndex = length - 1;
  21659. while (length--) {
  21660. var index = indexes[length];
  21661. if (length == lastIndex || index !== previous) {
  21662. var previous = index;
  21663. if (isIndex(index)) {
  21664. splice.call(array, index, 1);
  21665. } else {
  21666. baseUnset(array, index);
  21667. }
  21668. }
  21669. }
  21670. return array;
  21671. }
  21672. /**
  21673. * The base implementation of `_.random` without support for returning
  21674. * floating-point numbers.
  21675. *
  21676. * @private
  21677. * @param {number} lower The lower bound.
  21678. * @param {number} upper The upper bound.
  21679. * @returns {number} Returns the random number.
  21680. */
  21681. function baseRandom(lower, upper) {
  21682. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21683. }
  21684. /**
  21685. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21686. * coerce arguments.
  21687. *
  21688. * @private
  21689. * @param {number} start The start of the range.
  21690. * @param {number} end The end of the range.
  21691. * @param {number} step The value to increment or decrement by.
  21692. * @param {boolean} [fromRight] Specify iterating from right to left.
  21693. * @returns {Array} Returns the range of numbers.
  21694. */
  21695. function baseRange(start, end, step, fromRight) {
  21696. var index = -1,
  21697. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21698. result = Array(length);
  21699. while (length--) {
  21700. result[fromRight ? length : ++index] = start;
  21701. start += step;
  21702. }
  21703. return result;
  21704. }
  21705. /**
  21706. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21707. *
  21708. * @private
  21709. * @param {string} string The string to repeat.
  21710. * @param {number} n The number of times to repeat the string.
  21711. * @returns {string} Returns the repeated string.
  21712. */
  21713. function baseRepeat(string, n) {
  21714. var result = '';
  21715. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21716. return result;
  21717. }
  21718. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21719. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21720. do {
  21721. if (n % 2) {
  21722. result += string;
  21723. }
  21724. n = nativeFloor(n / 2);
  21725. if (n) {
  21726. string += string;
  21727. }
  21728. } while (n);
  21729. return result;
  21730. }
  21731. /**
  21732. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21733. *
  21734. * @private
  21735. * @param {Function} func The function to apply a rest parameter to.
  21736. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21737. * @returns {Function} Returns the new function.
  21738. */
  21739. function baseRest(func, start) {
  21740. return setToString(overRest(func, start, identity), func + '');
  21741. }
  21742. /**
  21743. * The base implementation of `_.sample`.
  21744. *
  21745. * @private
  21746. * @param {Array|Object} collection The collection to sample.
  21747. * @returns {*} Returns the random element.
  21748. */
  21749. function baseSample(collection) {
  21750. return arraySample(values(collection));
  21751. }
  21752. /**
  21753. * The base implementation of `_.sampleSize` without param guards.
  21754. *
  21755. * @private
  21756. * @param {Array|Object} collection The collection to sample.
  21757. * @param {number} n The number of elements to sample.
  21758. * @returns {Array} Returns the random elements.
  21759. */
  21760. function baseSampleSize(collection, n) {
  21761. var array = values(collection);
  21762. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21763. }
  21764. /**
  21765. * The base implementation of `_.set`.
  21766. *
  21767. * @private
  21768. * @param {Object} object The object to modify.
  21769. * @param {Array|string} path The path of the property to set.
  21770. * @param {*} value The value to set.
  21771. * @param {Function} [customizer] The function to customize path creation.
  21772. * @returns {Object} Returns `object`.
  21773. */
  21774. function baseSet(object, path, value, customizer) {
  21775. if (!isObject(object)) {
  21776. return object;
  21777. }
  21778. path = castPath(path, object);
  21779. var index = -1,
  21780. length = path.length,
  21781. lastIndex = length - 1,
  21782. nested = object;
  21783. while (nested != null && ++index < length) {
  21784. var key = toKey(path[index]),
  21785. newValue = value;
  21786. if (index != lastIndex) {
  21787. var objValue = nested[key];
  21788. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21789. if (newValue === undefined) {
  21790. newValue = isObject(objValue)
  21791. ? objValue
  21792. : (isIndex(path[index + 1]) ? [] : {});
  21793. }
  21794. }
  21795. assignValue(nested, key, newValue);
  21796. nested = nested[key];
  21797. }
  21798. return object;
  21799. }
  21800. /**
  21801. * The base implementation of `setData` without support for hot loop shorting.
  21802. *
  21803. * @private
  21804. * @param {Function} func The function to associate metadata with.
  21805. * @param {*} data The metadata.
  21806. * @returns {Function} Returns `func`.
  21807. */
  21808. var baseSetData = !metaMap ? identity : function(func, data) {
  21809. metaMap.set(func, data);
  21810. return func;
  21811. };
  21812. /**
  21813. * The base implementation of `setToString` without support for hot loop shorting.
  21814. *
  21815. * @private
  21816. * @param {Function} func The function to modify.
  21817. * @param {Function} string The `toString` result.
  21818. * @returns {Function} Returns `func`.
  21819. */
  21820. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21821. return defineProperty(func, 'toString', {
  21822. 'configurable': true,
  21823. 'enumerable': false,
  21824. 'value': constant(string),
  21825. 'writable': true
  21826. });
  21827. };
  21828. /**
  21829. * The base implementation of `_.shuffle`.
  21830. *
  21831. * @private
  21832. * @param {Array|Object} collection The collection to shuffle.
  21833. * @returns {Array} Returns the new shuffled array.
  21834. */
  21835. function baseShuffle(collection) {
  21836. return shuffleSelf(values(collection));
  21837. }
  21838. /**
  21839. * The base implementation of `_.slice` without an iteratee call guard.
  21840. *
  21841. * @private
  21842. * @param {Array} array The array to slice.
  21843. * @param {number} [start=0] The start position.
  21844. * @param {number} [end=array.length] The end position.
  21845. * @returns {Array} Returns the slice of `array`.
  21846. */
  21847. function baseSlice(array, start, end) {
  21848. var index = -1,
  21849. length = array.length;
  21850. if (start < 0) {
  21851. start = -start > length ? 0 : (length + start);
  21852. }
  21853. end = end > length ? length : end;
  21854. if (end < 0) {
  21855. end += length;
  21856. }
  21857. length = start > end ? 0 : ((end - start) >>> 0);
  21858. start >>>= 0;
  21859. var result = Array(length);
  21860. while (++index < length) {
  21861. result[index] = array[index + start];
  21862. }
  21863. return result;
  21864. }
  21865. /**
  21866. * The base implementation of `_.some` without support for iteratee shorthands.
  21867. *
  21868. * @private
  21869. * @param {Array|Object} collection The collection to iterate over.
  21870. * @param {Function} predicate The function invoked per iteration.
  21871. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21872. * else `false`.
  21873. */
  21874. function baseSome(collection, predicate) {
  21875. var result;
  21876. baseEach(collection, function(value, index, collection) {
  21877. result = predicate(value, index, collection);
  21878. return !result;
  21879. });
  21880. return !!result;
  21881. }
  21882. /**
  21883. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21884. * performs a binary search of `array` to determine the index at which `value`
  21885. * should be inserted into `array` in order to maintain its sort order.
  21886. *
  21887. * @private
  21888. * @param {Array} array The sorted array to inspect.
  21889. * @param {*} value The value to evaluate.
  21890. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21891. * @returns {number} Returns the index at which `value` should be inserted
  21892. * into `array`.
  21893. */
  21894. function baseSortedIndex(array, value, retHighest) {
  21895. var low = 0,
  21896. high = array == null ? low : array.length;
  21897. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21898. while (low < high) {
  21899. var mid = (low + high) >>> 1,
  21900. computed = array[mid];
  21901. if (computed !== null && !isSymbol(computed) &&
  21902. (retHighest ? (computed <= value) : (computed < value))) {
  21903. low = mid + 1;
  21904. } else {
  21905. high = mid;
  21906. }
  21907. }
  21908. return high;
  21909. }
  21910. return baseSortedIndexBy(array, value, identity, retHighest);
  21911. }
  21912. /**
  21913. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  21914. * which invokes `iteratee` for `value` and each element of `array` to compute
  21915. * their sort ranking. The iteratee is invoked with one argument; (value).
  21916. *
  21917. * @private
  21918. * @param {Array} array The sorted array to inspect.
  21919. * @param {*} value The value to evaluate.
  21920. * @param {Function} iteratee The iteratee invoked per element.
  21921. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21922. * @returns {number} Returns the index at which `value` should be inserted
  21923. * into `array`.
  21924. */
  21925. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  21926. value = iteratee(value);
  21927. var low = 0,
  21928. high = array == null ? 0 : array.length,
  21929. valIsNaN = value !== value,
  21930. valIsNull = value === null,
  21931. valIsSymbol = isSymbol(value),
  21932. valIsUndefined = value === undefined;
  21933. while (low < high) {
  21934. var mid = nativeFloor((low + high) / 2),
  21935. computed = iteratee(array[mid]),
  21936. othIsDefined = computed !== undefined,
  21937. othIsNull = computed === null,
  21938. othIsReflexive = computed === computed,
  21939. othIsSymbol = isSymbol(computed);
  21940. if (valIsNaN) {
  21941. var setLow = retHighest || othIsReflexive;
  21942. } else if (valIsUndefined) {
  21943. setLow = othIsReflexive && (retHighest || othIsDefined);
  21944. } else if (valIsNull) {
  21945. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  21946. } else if (valIsSymbol) {
  21947. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  21948. } else if (othIsNull || othIsSymbol) {
  21949. setLow = false;
  21950. } else {
  21951. setLow = retHighest ? (computed <= value) : (computed < value);
  21952. }
  21953. if (setLow) {
  21954. low = mid + 1;
  21955. } else {
  21956. high = mid;
  21957. }
  21958. }
  21959. return nativeMin(high, MAX_ARRAY_INDEX);
  21960. }
  21961. /**
  21962. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  21963. * support for iteratee shorthands.
  21964. *
  21965. * @private
  21966. * @param {Array} array The array to inspect.
  21967. * @param {Function} [iteratee] The iteratee invoked per element.
  21968. * @returns {Array} Returns the new duplicate free array.
  21969. */
  21970. function baseSortedUniq(array, iteratee) {
  21971. var index = -1,
  21972. length = array.length,
  21973. resIndex = 0,
  21974. result = [];
  21975. while (++index < length) {
  21976. var value = array[index],
  21977. computed = iteratee ? iteratee(value) : value;
  21978. if (!index || !eq(computed, seen)) {
  21979. var seen = computed;
  21980. result[resIndex++] = value === 0 ? 0 : value;
  21981. }
  21982. }
  21983. return result;
  21984. }
  21985. /**
  21986. * The base implementation of `_.toNumber` which doesn't ensure correct
  21987. * conversions of binary, hexadecimal, or octal string values.
  21988. *
  21989. * @private
  21990. * @param {*} value The value to process.
  21991. * @returns {number} Returns the number.
  21992. */
  21993. function baseToNumber(value) {
  21994. if (typeof value == 'number') {
  21995. return value;
  21996. }
  21997. if (isSymbol(value)) {
  21998. return NAN;
  21999. }
  22000. return +value;
  22001. }
  22002. /**
  22003. * The base implementation of `_.toString` which doesn't convert nullish
  22004. * values to empty strings.
  22005. *
  22006. * @private
  22007. * @param {*} value The value to process.
  22008. * @returns {string} Returns the string.
  22009. */
  22010. function baseToString(value) {
  22011. // Exit early for strings to avoid a performance hit in some environments.
  22012. if (typeof value == 'string') {
  22013. return value;
  22014. }
  22015. if (isArray(value)) {
  22016. // Recursively convert values (susceptible to call stack limits).
  22017. return arrayMap(value, baseToString) + '';
  22018. }
  22019. if (isSymbol(value)) {
  22020. return symbolToString ? symbolToString.call(value) : '';
  22021. }
  22022. var result = (value + '');
  22023. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22024. }
  22025. /**
  22026. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22027. *
  22028. * @private
  22029. * @param {Array} array The array to inspect.
  22030. * @param {Function} [iteratee] The iteratee invoked per element.
  22031. * @param {Function} [comparator] The comparator invoked per element.
  22032. * @returns {Array} Returns the new duplicate free array.
  22033. */
  22034. function baseUniq(array, iteratee, comparator) {
  22035. var index = -1,
  22036. includes = arrayIncludes,
  22037. length = array.length,
  22038. isCommon = true,
  22039. result = [],
  22040. seen = result;
  22041. if (comparator) {
  22042. isCommon = false;
  22043. includes = arrayIncludesWith;
  22044. }
  22045. else if (length >= LARGE_ARRAY_SIZE) {
  22046. var set = iteratee ? null : createSet(array);
  22047. if (set) {
  22048. return setToArray(set);
  22049. }
  22050. isCommon = false;
  22051. includes = cacheHas;
  22052. seen = new SetCache;
  22053. }
  22054. else {
  22055. seen = iteratee ? [] : result;
  22056. }
  22057. outer:
  22058. while (++index < length) {
  22059. var value = array[index],
  22060. computed = iteratee ? iteratee(value) : value;
  22061. value = (comparator || value !== 0) ? value : 0;
  22062. if (isCommon && computed === computed) {
  22063. var seenIndex = seen.length;
  22064. while (seenIndex--) {
  22065. if (seen[seenIndex] === computed) {
  22066. continue outer;
  22067. }
  22068. }
  22069. if (iteratee) {
  22070. seen.push(computed);
  22071. }
  22072. result.push(value);
  22073. }
  22074. else if (!includes(seen, computed, comparator)) {
  22075. if (seen !== result) {
  22076. seen.push(computed);
  22077. }
  22078. result.push(value);
  22079. }
  22080. }
  22081. return result;
  22082. }
  22083. /**
  22084. * The base implementation of `_.unset`.
  22085. *
  22086. * @private
  22087. * @param {Object} object The object to modify.
  22088. * @param {Array|string} path The property path to unset.
  22089. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22090. */
  22091. function baseUnset(object, path) {
  22092. path = castPath(path, object);
  22093. object = parent(object, path);
  22094. return object == null || delete object[toKey(last(path))];
  22095. }
  22096. /**
  22097. * The base implementation of `_.update`.
  22098. *
  22099. * @private
  22100. * @param {Object} object The object to modify.
  22101. * @param {Array|string} path The path of the property to update.
  22102. * @param {Function} updater The function to produce the updated value.
  22103. * @param {Function} [customizer] The function to customize path creation.
  22104. * @returns {Object} Returns `object`.
  22105. */
  22106. function baseUpdate(object, path, updater, customizer) {
  22107. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22108. }
  22109. /**
  22110. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22111. * without support for iteratee shorthands.
  22112. *
  22113. * @private
  22114. * @param {Array} array The array to query.
  22115. * @param {Function} predicate The function invoked per iteration.
  22116. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22117. * @param {boolean} [fromRight] Specify iterating from right to left.
  22118. * @returns {Array} Returns the slice of `array`.
  22119. */
  22120. function baseWhile(array, predicate, isDrop, fromRight) {
  22121. var length = array.length,
  22122. index = fromRight ? length : -1;
  22123. while ((fromRight ? index-- : ++index < length) &&
  22124. predicate(array[index], index, array)) {}
  22125. return isDrop
  22126. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22127. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22128. }
  22129. /**
  22130. * The base implementation of `wrapperValue` which returns the result of
  22131. * performing a sequence of actions on the unwrapped `value`, where each
  22132. * successive action is supplied the return value of the previous.
  22133. *
  22134. * @private
  22135. * @param {*} value The unwrapped value.
  22136. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22137. * @returns {*} Returns the resolved value.
  22138. */
  22139. function baseWrapperValue(value, actions) {
  22140. var result = value;
  22141. if (result instanceof LazyWrapper) {
  22142. result = result.value();
  22143. }
  22144. return arrayReduce(actions, function(result, action) {
  22145. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22146. }, result);
  22147. }
  22148. /**
  22149. * The base implementation of methods like `_.xor`, without support for
  22150. * iteratee shorthands, that accepts an array of arrays to inspect.
  22151. *
  22152. * @private
  22153. * @param {Array} arrays The arrays to inspect.
  22154. * @param {Function} [iteratee] The iteratee invoked per element.
  22155. * @param {Function} [comparator] The comparator invoked per element.
  22156. * @returns {Array} Returns the new array of values.
  22157. */
  22158. function baseXor(arrays, iteratee, comparator) {
  22159. var length = arrays.length;
  22160. if (length < 2) {
  22161. return length ? baseUniq(arrays[0]) : [];
  22162. }
  22163. var index = -1,
  22164. result = Array(length);
  22165. while (++index < length) {
  22166. var array = arrays[index],
  22167. othIndex = -1;
  22168. while (++othIndex < length) {
  22169. if (othIndex != index) {
  22170. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22171. }
  22172. }
  22173. }
  22174. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22175. }
  22176. /**
  22177. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22178. *
  22179. * @private
  22180. * @param {Array} props The property identifiers.
  22181. * @param {Array} values The property values.
  22182. * @param {Function} assignFunc The function to assign values.
  22183. * @returns {Object} Returns the new object.
  22184. */
  22185. function baseZipObject(props, values, assignFunc) {
  22186. var index = -1,
  22187. length = props.length,
  22188. valsLength = values.length,
  22189. result = {};
  22190. while (++index < length) {
  22191. var value = index < valsLength ? values[index] : undefined;
  22192. assignFunc(result, props[index], value);
  22193. }
  22194. return result;
  22195. }
  22196. /**
  22197. * Casts `value` to an empty array if it's not an array like object.
  22198. *
  22199. * @private
  22200. * @param {*} value The value to inspect.
  22201. * @returns {Array|Object} Returns the cast array-like object.
  22202. */
  22203. function castArrayLikeObject(value) {
  22204. return isArrayLikeObject(value) ? value : [];
  22205. }
  22206. /**
  22207. * Casts `value` to `identity` if it's not a function.
  22208. *
  22209. * @private
  22210. * @param {*} value The value to inspect.
  22211. * @returns {Function} Returns cast function.
  22212. */
  22213. function castFunction(value) {
  22214. return typeof value == 'function' ? value : identity;
  22215. }
  22216. /**
  22217. * Casts `value` to a path array if it's not one.
  22218. *
  22219. * @private
  22220. * @param {*} value The value to inspect.
  22221. * @param {Object} [object] The object to query keys on.
  22222. * @returns {Array} Returns the cast property path array.
  22223. */
  22224. function castPath(value, object) {
  22225. if (isArray(value)) {
  22226. return value;
  22227. }
  22228. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22229. }
  22230. /**
  22231. * A `baseRest` alias which can be replaced with `identity` by module
  22232. * replacement plugins.
  22233. *
  22234. * @private
  22235. * @type {Function}
  22236. * @param {Function} func The function to apply a rest parameter to.
  22237. * @returns {Function} Returns the new function.
  22238. */
  22239. var castRest = baseRest;
  22240. /**
  22241. * Casts `array` to a slice if it's needed.
  22242. *
  22243. * @private
  22244. * @param {Array} array The array to inspect.
  22245. * @param {number} start The start position.
  22246. * @param {number} [end=array.length] The end position.
  22247. * @returns {Array} Returns the cast slice.
  22248. */
  22249. function castSlice(array, start, end) {
  22250. var length = array.length;
  22251. end = end === undefined ? length : end;
  22252. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22253. }
  22254. /**
  22255. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22256. *
  22257. * @private
  22258. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22259. */
  22260. var clearTimeout = ctxClearTimeout || function(id) {
  22261. return root.clearTimeout(id);
  22262. };
  22263. /**
  22264. * Creates a clone of `buffer`.
  22265. *
  22266. * @private
  22267. * @param {Buffer} buffer The buffer to clone.
  22268. * @param {boolean} [isDeep] Specify a deep clone.
  22269. * @returns {Buffer} Returns the cloned buffer.
  22270. */
  22271. function cloneBuffer(buffer, isDeep) {
  22272. if (isDeep) {
  22273. return buffer.slice();
  22274. }
  22275. var length = buffer.length,
  22276. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22277. buffer.copy(result);
  22278. return result;
  22279. }
  22280. /**
  22281. * Creates a clone of `arrayBuffer`.
  22282. *
  22283. * @private
  22284. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22285. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22286. */
  22287. function cloneArrayBuffer(arrayBuffer) {
  22288. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22289. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22290. return result;
  22291. }
  22292. /**
  22293. * Creates a clone of `dataView`.
  22294. *
  22295. * @private
  22296. * @param {Object} dataView The data view to clone.
  22297. * @param {boolean} [isDeep] Specify a deep clone.
  22298. * @returns {Object} Returns the cloned data view.
  22299. */
  22300. function cloneDataView(dataView, isDeep) {
  22301. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22302. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22303. }
  22304. /**
  22305. * Creates a clone of `regexp`.
  22306. *
  22307. * @private
  22308. * @param {Object} regexp The regexp to clone.
  22309. * @returns {Object} Returns the cloned regexp.
  22310. */
  22311. function cloneRegExp(regexp) {
  22312. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22313. result.lastIndex = regexp.lastIndex;
  22314. return result;
  22315. }
  22316. /**
  22317. * Creates a clone of the `symbol` object.
  22318. *
  22319. * @private
  22320. * @param {Object} symbol The symbol object to clone.
  22321. * @returns {Object} Returns the cloned symbol object.
  22322. */
  22323. function cloneSymbol(symbol) {
  22324. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22325. }
  22326. /**
  22327. * Creates a clone of `typedArray`.
  22328. *
  22329. * @private
  22330. * @param {Object} typedArray The typed array to clone.
  22331. * @param {boolean} [isDeep] Specify a deep clone.
  22332. * @returns {Object} Returns the cloned typed array.
  22333. */
  22334. function cloneTypedArray(typedArray, isDeep) {
  22335. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22336. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22337. }
  22338. /**
  22339. * Compares values to sort them in ascending order.
  22340. *
  22341. * @private
  22342. * @param {*} value The value to compare.
  22343. * @param {*} other The other value to compare.
  22344. * @returns {number} Returns the sort order indicator for `value`.
  22345. */
  22346. function compareAscending(value, other) {
  22347. if (value !== other) {
  22348. var valIsDefined = value !== undefined,
  22349. valIsNull = value === null,
  22350. valIsReflexive = value === value,
  22351. valIsSymbol = isSymbol(value);
  22352. var othIsDefined = other !== undefined,
  22353. othIsNull = other === null,
  22354. othIsReflexive = other === other,
  22355. othIsSymbol = isSymbol(other);
  22356. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22357. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22358. (valIsNull && othIsDefined && othIsReflexive) ||
  22359. (!valIsDefined && othIsReflexive) ||
  22360. !valIsReflexive) {
  22361. return 1;
  22362. }
  22363. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22364. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22365. (othIsNull && valIsDefined && valIsReflexive) ||
  22366. (!othIsDefined && valIsReflexive) ||
  22367. !othIsReflexive) {
  22368. return -1;
  22369. }
  22370. }
  22371. return 0;
  22372. }
  22373. /**
  22374. * Used by `_.orderBy` to compare multiple properties of a value to another
  22375. * and stable sort them.
  22376. *
  22377. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22378. * specify an order of "desc" for descending or "asc" for ascending sort order
  22379. * of corresponding values.
  22380. *
  22381. * @private
  22382. * @param {Object} object The object to compare.
  22383. * @param {Object} other The other object to compare.
  22384. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22385. * @returns {number} Returns the sort order indicator for `object`.
  22386. */
  22387. function compareMultiple(object, other, orders) {
  22388. var index = -1,
  22389. objCriteria = object.criteria,
  22390. othCriteria = other.criteria,
  22391. length = objCriteria.length,
  22392. ordersLength = orders.length;
  22393. while (++index < length) {
  22394. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22395. if (result) {
  22396. if (index >= ordersLength) {
  22397. return result;
  22398. }
  22399. var order = orders[index];
  22400. return result * (order == 'desc' ? -1 : 1);
  22401. }
  22402. }
  22403. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22404. // that causes it, under certain circumstances, to provide the same value for
  22405. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22406. // for more details.
  22407. //
  22408. // This also ensures a stable sort in V8 and other engines.
  22409. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22410. return object.index - other.index;
  22411. }
  22412. /**
  22413. * Creates an array that is the composition of partially applied arguments,
  22414. * placeholders, and provided arguments into a single array of arguments.
  22415. *
  22416. * @private
  22417. * @param {Array} args The provided arguments.
  22418. * @param {Array} partials The arguments to prepend to those provided.
  22419. * @param {Array} holders The `partials` placeholder indexes.
  22420. * @params {boolean} [isCurried] Specify composing for a curried function.
  22421. * @returns {Array} Returns the new array of composed arguments.
  22422. */
  22423. function composeArgs(args, partials, holders, isCurried) {
  22424. var argsIndex = -1,
  22425. argsLength = args.length,
  22426. holdersLength = holders.length,
  22427. leftIndex = -1,
  22428. leftLength = partials.length,
  22429. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22430. result = Array(leftLength + rangeLength),
  22431. isUncurried = !isCurried;
  22432. while (++leftIndex < leftLength) {
  22433. result[leftIndex] = partials[leftIndex];
  22434. }
  22435. while (++argsIndex < holdersLength) {
  22436. if (isUncurried || argsIndex < argsLength) {
  22437. result[holders[argsIndex]] = args[argsIndex];
  22438. }
  22439. }
  22440. while (rangeLength--) {
  22441. result[leftIndex++] = args[argsIndex++];
  22442. }
  22443. return result;
  22444. }
  22445. /**
  22446. * This function is like `composeArgs` except that the arguments composition
  22447. * is tailored for `_.partialRight`.
  22448. *
  22449. * @private
  22450. * @param {Array} args The provided arguments.
  22451. * @param {Array} partials The arguments to append to those provided.
  22452. * @param {Array} holders The `partials` placeholder indexes.
  22453. * @params {boolean} [isCurried] Specify composing for a curried function.
  22454. * @returns {Array} Returns the new array of composed arguments.
  22455. */
  22456. function composeArgsRight(args, partials, holders, isCurried) {
  22457. var argsIndex = -1,
  22458. argsLength = args.length,
  22459. holdersIndex = -1,
  22460. holdersLength = holders.length,
  22461. rightIndex = -1,
  22462. rightLength = partials.length,
  22463. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22464. result = Array(rangeLength + rightLength),
  22465. isUncurried = !isCurried;
  22466. while (++argsIndex < rangeLength) {
  22467. result[argsIndex] = args[argsIndex];
  22468. }
  22469. var offset = argsIndex;
  22470. while (++rightIndex < rightLength) {
  22471. result[offset + rightIndex] = partials[rightIndex];
  22472. }
  22473. while (++holdersIndex < holdersLength) {
  22474. if (isUncurried || argsIndex < argsLength) {
  22475. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22476. }
  22477. }
  22478. return result;
  22479. }
  22480. /**
  22481. * Copies the values of `source` to `array`.
  22482. *
  22483. * @private
  22484. * @param {Array} source The array to copy values from.
  22485. * @param {Array} [array=[]] The array to copy values to.
  22486. * @returns {Array} Returns `array`.
  22487. */
  22488. function copyArray(source, array) {
  22489. var index = -1,
  22490. length = source.length;
  22491. array || (array = Array(length));
  22492. while (++index < length) {
  22493. array[index] = source[index];
  22494. }
  22495. return array;
  22496. }
  22497. /**
  22498. * Copies properties of `source` to `object`.
  22499. *
  22500. * @private
  22501. * @param {Object} source The object to copy properties from.
  22502. * @param {Array} props The property identifiers to copy.
  22503. * @param {Object} [object={}] The object to copy properties to.
  22504. * @param {Function} [customizer] The function to customize copied values.
  22505. * @returns {Object} Returns `object`.
  22506. */
  22507. function copyObject(source, props, object, customizer) {
  22508. var isNew = !object;
  22509. object || (object = {});
  22510. var index = -1,
  22511. length = props.length;
  22512. while (++index < length) {
  22513. var key = props[index];
  22514. var newValue = customizer
  22515. ? customizer(object[key], source[key], key, object, source)
  22516. : undefined;
  22517. if (newValue === undefined) {
  22518. newValue = source[key];
  22519. }
  22520. if (isNew) {
  22521. baseAssignValue(object, key, newValue);
  22522. } else {
  22523. assignValue(object, key, newValue);
  22524. }
  22525. }
  22526. return object;
  22527. }
  22528. /**
  22529. * Copies own symbols of `source` to `object`.
  22530. *
  22531. * @private
  22532. * @param {Object} source The object to copy symbols from.
  22533. * @param {Object} [object={}] The object to copy symbols to.
  22534. * @returns {Object} Returns `object`.
  22535. */
  22536. function copySymbols(source, object) {
  22537. return copyObject(source, getSymbols(source), object);
  22538. }
  22539. /**
  22540. * Copies own and inherited symbols of `source` to `object`.
  22541. *
  22542. * @private
  22543. * @param {Object} source The object to copy symbols from.
  22544. * @param {Object} [object={}] The object to copy symbols to.
  22545. * @returns {Object} Returns `object`.
  22546. */
  22547. function copySymbolsIn(source, object) {
  22548. return copyObject(source, getSymbolsIn(source), object);
  22549. }
  22550. /**
  22551. * Creates a function like `_.groupBy`.
  22552. *
  22553. * @private
  22554. * @param {Function} setter The function to set accumulator values.
  22555. * @param {Function} [initializer] The accumulator object initializer.
  22556. * @returns {Function} Returns the new aggregator function.
  22557. */
  22558. function createAggregator(setter, initializer) {
  22559. return function(collection, iteratee) {
  22560. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22561. accumulator = initializer ? initializer() : {};
  22562. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22563. };
  22564. }
  22565. /**
  22566. * Creates a function like `_.assign`.
  22567. *
  22568. * @private
  22569. * @param {Function} assigner The function to assign values.
  22570. * @returns {Function} Returns the new assigner function.
  22571. */
  22572. function createAssigner(assigner) {
  22573. return baseRest(function(object, sources) {
  22574. var index = -1,
  22575. length = sources.length,
  22576. customizer = length > 1 ? sources[length - 1] : undefined,
  22577. guard = length > 2 ? sources[2] : undefined;
  22578. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22579. ? (length--, customizer)
  22580. : undefined;
  22581. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22582. customizer = length < 3 ? undefined : customizer;
  22583. length = 1;
  22584. }
  22585. object = Object(object);
  22586. while (++index < length) {
  22587. var source = sources[index];
  22588. if (source) {
  22589. assigner(object, source, index, customizer);
  22590. }
  22591. }
  22592. return object;
  22593. });
  22594. }
  22595. /**
  22596. * Creates a `baseEach` or `baseEachRight` function.
  22597. *
  22598. * @private
  22599. * @param {Function} eachFunc The function to iterate over a collection.
  22600. * @param {boolean} [fromRight] Specify iterating from right to left.
  22601. * @returns {Function} Returns the new base function.
  22602. */
  22603. function createBaseEach(eachFunc, fromRight) {
  22604. return function(collection, iteratee) {
  22605. if (collection == null) {
  22606. return collection;
  22607. }
  22608. if (!isArrayLike(collection)) {
  22609. return eachFunc(collection, iteratee);
  22610. }
  22611. var length = collection.length,
  22612. index = fromRight ? length : -1,
  22613. iterable = Object(collection);
  22614. while ((fromRight ? index-- : ++index < length)) {
  22615. if (iteratee(iterable[index], index, iterable) === false) {
  22616. break;
  22617. }
  22618. }
  22619. return collection;
  22620. };
  22621. }
  22622. /**
  22623. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22624. *
  22625. * @private
  22626. * @param {boolean} [fromRight] Specify iterating from right to left.
  22627. * @returns {Function} Returns the new base function.
  22628. */
  22629. function createBaseFor(fromRight) {
  22630. return function(object, iteratee, keysFunc) {
  22631. var index = -1,
  22632. iterable = Object(object),
  22633. props = keysFunc(object),
  22634. length = props.length;
  22635. while (length--) {
  22636. var key = props[fromRight ? length : ++index];
  22637. if (iteratee(iterable[key], key, iterable) === false) {
  22638. break;
  22639. }
  22640. }
  22641. return object;
  22642. };
  22643. }
  22644. /**
  22645. * Creates a function that wraps `func` to invoke it with the optional `this`
  22646. * binding of `thisArg`.
  22647. *
  22648. * @private
  22649. * @param {Function} func The function to wrap.
  22650. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22651. * @param {*} [thisArg] The `this` binding of `func`.
  22652. * @returns {Function} Returns the new wrapped function.
  22653. */
  22654. function createBind(func, bitmask, thisArg) {
  22655. var isBind = bitmask & WRAP_BIND_FLAG,
  22656. Ctor = createCtor(func);
  22657. function wrapper() {
  22658. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22659. return fn.apply(isBind ? thisArg : this, arguments);
  22660. }
  22661. return wrapper;
  22662. }
  22663. /**
  22664. * Creates a function like `_.lowerFirst`.
  22665. *
  22666. * @private
  22667. * @param {string} methodName The name of the `String` case method to use.
  22668. * @returns {Function} Returns the new case function.
  22669. */
  22670. function createCaseFirst(methodName) {
  22671. return function(string) {
  22672. string = toString(string);
  22673. var strSymbols = hasUnicode(string)
  22674. ? stringToArray(string)
  22675. : undefined;
  22676. var chr = strSymbols
  22677. ? strSymbols[0]
  22678. : string.charAt(0);
  22679. var trailing = strSymbols
  22680. ? castSlice(strSymbols, 1).join('')
  22681. : string.slice(1);
  22682. return chr[methodName]() + trailing;
  22683. };
  22684. }
  22685. /**
  22686. * Creates a function like `_.camelCase`.
  22687. *
  22688. * @private
  22689. * @param {Function} callback The function to combine each word.
  22690. * @returns {Function} Returns the new compounder function.
  22691. */
  22692. function createCompounder(callback) {
  22693. return function(string) {
  22694. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22695. };
  22696. }
  22697. /**
  22698. * Creates a function that produces an instance of `Ctor` regardless of
  22699. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22700. *
  22701. * @private
  22702. * @param {Function} Ctor The constructor to wrap.
  22703. * @returns {Function} Returns the new wrapped function.
  22704. */
  22705. function createCtor(Ctor) {
  22706. return function() {
  22707. // Use a `switch` statement to work with class constructors. See
  22708. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22709. // for more details.
  22710. var args = arguments;
  22711. switch (args.length) {
  22712. case 0: return new Ctor;
  22713. case 1: return new Ctor(args[0]);
  22714. case 2: return new Ctor(args[0], args[1]);
  22715. case 3: return new Ctor(args[0], args[1], args[2]);
  22716. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22717. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22718. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22719. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22720. }
  22721. var thisBinding = baseCreate(Ctor.prototype),
  22722. result = Ctor.apply(thisBinding, args);
  22723. // Mimic the constructor's `return` behavior.
  22724. // See https://es5.github.io/#x13.2.2 for more details.
  22725. return isObject(result) ? result : thisBinding;
  22726. };
  22727. }
  22728. /**
  22729. * Creates a function that wraps `func` to enable currying.
  22730. *
  22731. * @private
  22732. * @param {Function} func The function to wrap.
  22733. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22734. * @param {number} arity The arity of `func`.
  22735. * @returns {Function} Returns the new wrapped function.
  22736. */
  22737. function createCurry(func, bitmask, arity) {
  22738. var Ctor = createCtor(func);
  22739. function wrapper() {
  22740. var length = arguments.length,
  22741. args = Array(length),
  22742. index = length,
  22743. placeholder = getHolder(wrapper);
  22744. while (index--) {
  22745. args[index] = arguments[index];
  22746. }
  22747. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22748. ? []
  22749. : replaceHolders(args, placeholder);
  22750. length -= holders.length;
  22751. if (length < arity) {
  22752. return createRecurry(
  22753. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22754. args, holders, undefined, undefined, arity - length);
  22755. }
  22756. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22757. return apply(fn, this, args);
  22758. }
  22759. return wrapper;
  22760. }
  22761. /**
  22762. * Creates a `_.find` or `_.findLast` function.
  22763. *
  22764. * @private
  22765. * @param {Function} findIndexFunc The function to find the collection index.
  22766. * @returns {Function} Returns the new find function.
  22767. */
  22768. function createFind(findIndexFunc) {
  22769. return function(collection, predicate, fromIndex) {
  22770. var iterable = Object(collection);
  22771. if (!isArrayLike(collection)) {
  22772. var iteratee = getIteratee(predicate, 3);
  22773. collection = keys(collection);
  22774. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22775. }
  22776. var index = findIndexFunc(collection, predicate, fromIndex);
  22777. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22778. };
  22779. }
  22780. /**
  22781. * Creates a `_.flow` or `_.flowRight` function.
  22782. *
  22783. * @private
  22784. * @param {boolean} [fromRight] Specify iterating from right to left.
  22785. * @returns {Function} Returns the new flow function.
  22786. */
  22787. function createFlow(fromRight) {
  22788. return flatRest(function(funcs) {
  22789. var length = funcs.length,
  22790. index = length,
  22791. prereq = LodashWrapper.prototype.thru;
  22792. if (fromRight) {
  22793. funcs.reverse();
  22794. }
  22795. while (index--) {
  22796. var func = funcs[index];
  22797. if (typeof func != 'function') {
  22798. throw new TypeError(FUNC_ERROR_TEXT);
  22799. }
  22800. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22801. var wrapper = new LodashWrapper([], true);
  22802. }
  22803. }
  22804. index = wrapper ? index : length;
  22805. while (++index < length) {
  22806. func = funcs[index];
  22807. var funcName = getFuncName(func),
  22808. data = funcName == 'wrapper' ? getData(func) : undefined;
  22809. if (data && isLaziable(data[0]) &&
  22810. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22811. !data[4].length && data[9] == 1
  22812. ) {
  22813. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22814. } else {
  22815. wrapper = (func.length == 1 && isLaziable(func))
  22816. ? wrapper[funcName]()
  22817. : wrapper.thru(func);
  22818. }
  22819. }
  22820. return function() {
  22821. var args = arguments,
  22822. value = args[0];
  22823. if (wrapper && args.length == 1 && isArray(value)) {
  22824. return wrapper.plant(value).value();
  22825. }
  22826. var index = 0,
  22827. result = length ? funcs[index].apply(this, args) : value;
  22828. while (++index < length) {
  22829. result = funcs[index].call(this, result);
  22830. }
  22831. return result;
  22832. };
  22833. });
  22834. }
  22835. /**
  22836. * Creates a function that wraps `func` to invoke it with optional `this`
  22837. * binding of `thisArg`, partial application, and currying.
  22838. *
  22839. * @private
  22840. * @param {Function|string} func The function or method name to wrap.
  22841. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22842. * @param {*} [thisArg] The `this` binding of `func`.
  22843. * @param {Array} [partials] The arguments to prepend to those provided to
  22844. * the new function.
  22845. * @param {Array} [holders] The `partials` placeholder indexes.
  22846. * @param {Array} [partialsRight] The arguments to append to those provided
  22847. * to the new function.
  22848. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22849. * @param {Array} [argPos] The argument positions of the new function.
  22850. * @param {number} [ary] The arity cap of `func`.
  22851. * @param {number} [arity] The arity of `func`.
  22852. * @returns {Function} Returns the new wrapped function.
  22853. */
  22854. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22855. var isAry = bitmask & WRAP_ARY_FLAG,
  22856. isBind = bitmask & WRAP_BIND_FLAG,
  22857. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22858. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22859. isFlip = bitmask & WRAP_FLIP_FLAG,
  22860. Ctor = isBindKey ? undefined : createCtor(func);
  22861. function wrapper() {
  22862. var length = arguments.length,
  22863. args = Array(length),
  22864. index = length;
  22865. while (index--) {
  22866. args[index] = arguments[index];
  22867. }
  22868. if (isCurried) {
  22869. var placeholder = getHolder(wrapper),
  22870. holdersCount = countHolders(args, placeholder);
  22871. }
  22872. if (partials) {
  22873. args = composeArgs(args, partials, holders, isCurried);
  22874. }
  22875. if (partialsRight) {
  22876. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22877. }
  22878. length -= holdersCount;
  22879. if (isCurried && length < arity) {
  22880. var newHolders = replaceHolders(args, placeholder);
  22881. return createRecurry(
  22882. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22883. args, newHolders, argPos, ary, arity - length
  22884. );
  22885. }
  22886. var thisBinding = isBind ? thisArg : this,
  22887. fn = isBindKey ? thisBinding[func] : func;
  22888. length = args.length;
  22889. if (argPos) {
  22890. args = reorder(args, argPos);
  22891. } else if (isFlip && length > 1) {
  22892. args.reverse();
  22893. }
  22894. if (isAry && ary < length) {
  22895. args.length = ary;
  22896. }
  22897. if (this && this !== root && this instanceof wrapper) {
  22898. fn = Ctor || createCtor(fn);
  22899. }
  22900. return fn.apply(thisBinding, args);
  22901. }
  22902. return wrapper;
  22903. }
  22904. /**
  22905. * Creates a function like `_.invertBy`.
  22906. *
  22907. * @private
  22908. * @param {Function} setter The function to set accumulator values.
  22909. * @param {Function} toIteratee The function to resolve iteratees.
  22910. * @returns {Function} Returns the new inverter function.
  22911. */
  22912. function createInverter(setter, toIteratee) {
  22913. return function(object, iteratee) {
  22914. return baseInverter(object, setter, toIteratee(iteratee), {});
  22915. };
  22916. }
  22917. /**
  22918. * Creates a function that performs a mathematical operation on two values.
  22919. *
  22920. * @private
  22921. * @param {Function} operator The function to perform the operation.
  22922. * @param {number} [defaultValue] The value used for `undefined` arguments.
  22923. * @returns {Function} Returns the new mathematical operation function.
  22924. */
  22925. function createMathOperation(operator, defaultValue) {
  22926. return function(value, other) {
  22927. var result;
  22928. if (value === undefined && other === undefined) {
  22929. return defaultValue;
  22930. }
  22931. if (value !== undefined) {
  22932. result = value;
  22933. }
  22934. if (other !== undefined) {
  22935. if (result === undefined) {
  22936. return other;
  22937. }
  22938. if (typeof value == 'string' || typeof other == 'string') {
  22939. value = baseToString(value);
  22940. other = baseToString(other);
  22941. } else {
  22942. value = baseToNumber(value);
  22943. other = baseToNumber(other);
  22944. }
  22945. result = operator(value, other);
  22946. }
  22947. return result;
  22948. };
  22949. }
  22950. /**
  22951. * Creates a function like `_.over`.
  22952. *
  22953. * @private
  22954. * @param {Function} arrayFunc The function to iterate over iteratees.
  22955. * @returns {Function} Returns the new over function.
  22956. */
  22957. function createOver(arrayFunc) {
  22958. return flatRest(function(iteratees) {
  22959. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  22960. return baseRest(function(args) {
  22961. var thisArg = this;
  22962. return arrayFunc(iteratees, function(iteratee) {
  22963. return apply(iteratee, thisArg, args);
  22964. });
  22965. });
  22966. });
  22967. }
  22968. /**
  22969. * Creates the padding for `string` based on `length`. The `chars` string
  22970. * is truncated if the number of characters exceeds `length`.
  22971. *
  22972. * @private
  22973. * @param {number} length The padding length.
  22974. * @param {string} [chars=' '] The string used as padding.
  22975. * @returns {string} Returns the padding for `string`.
  22976. */
  22977. function createPadding(length, chars) {
  22978. chars = chars === undefined ? ' ' : baseToString(chars);
  22979. var charsLength = chars.length;
  22980. if (charsLength < 2) {
  22981. return charsLength ? baseRepeat(chars, length) : chars;
  22982. }
  22983. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  22984. return hasUnicode(chars)
  22985. ? castSlice(stringToArray(result), 0, length).join('')
  22986. : result.slice(0, length);
  22987. }
  22988. /**
  22989. * Creates a function that wraps `func` to invoke it with the `this` binding
  22990. * of `thisArg` and `partials` prepended to the arguments it receives.
  22991. *
  22992. * @private
  22993. * @param {Function} func The function to wrap.
  22994. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22995. * @param {*} thisArg The `this` binding of `func`.
  22996. * @param {Array} partials The arguments to prepend to those provided to
  22997. * the new function.
  22998. * @returns {Function} Returns the new wrapped function.
  22999. */
  23000. function createPartial(func, bitmask, thisArg, partials) {
  23001. var isBind = bitmask & WRAP_BIND_FLAG,
  23002. Ctor = createCtor(func);
  23003. function wrapper() {
  23004. var argsIndex = -1,
  23005. argsLength = arguments.length,
  23006. leftIndex = -1,
  23007. leftLength = partials.length,
  23008. args = Array(leftLength + argsLength),
  23009. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23010. while (++leftIndex < leftLength) {
  23011. args[leftIndex] = partials[leftIndex];
  23012. }
  23013. while (argsLength--) {
  23014. args[leftIndex++] = arguments[++argsIndex];
  23015. }
  23016. return apply(fn, isBind ? thisArg : this, args);
  23017. }
  23018. return wrapper;
  23019. }
  23020. /**
  23021. * Creates a `_.range` or `_.rangeRight` function.
  23022. *
  23023. * @private
  23024. * @param {boolean} [fromRight] Specify iterating from right to left.
  23025. * @returns {Function} Returns the new range function.
  23026. */
  23027. function createRange(fromRight) {
  23028. return function(start, end, step) {
  23029. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23030. end = step = undefined;
  23031. }
  23032. // Ensure the sign of `-0` is preserved.
  23033. start = toFinite(start);
  23034. if (end === undefined) {
  23035. end = start;
  23036. start = 0;
  23037. } else {
  23038. end = toFinite(end);
  23039. }
  23040. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23041. return baseRange(start, end, step, fromRight);
  23042. };
  23043. }
  23044. /**
  23045. * Creates a function that performs a relational operation on two values.
  23046. *
  23047. * @private
  23048. * @param {Function} operator The function to perform the operation.
  23049. * @returns {Function} Returns the new relational operation function.
  23050. */
  23051. function createRelationalOperation(operator) {
  23052. return function(value, other) {
  23053. if (!(typeof value == 'string' && typeof other == 'string')) {
  23054. value = toNumber(value);
  23055. other = toNumber(other);
  23056. }
  23057. return operator(value, other);
  23058. };
  23059. }
  23060. /**
  23061. * Creates a function that wraps `func` to continue currying.
  23062. *
  23063. * @private
  23064. * @param {Function} func The function to wrap.
  23065. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23066. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23067. * @param {*} placeholder The placeholder value.
  23068. * @param {*} [thisArg] The `this` binding of `func`.
  23069. * @param {Array} [partials] The arguments to prepend to those provided to
  23070. * the new function.
  23071. * @param {Array} [holders] The `partials` placeholder indexes.
  23072. * @param {Array} [argPos] The argument positions of the new function.
  23073. * @param {number} [ary] The arity cap of `func`.
  23074. * @param {number} [arity] The arity of `func`.
  23075. * @returns {Function} Returns the new wrapped function.
  23076. */
  23077. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23078. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23079. newHolders = isCurry ? holders : undefined,
  23080. newHoldersRight = isCurry ? undefined : holders,
  23081. newPartials = isCurry ? partials : undefined,
  23082. newPartialsRight = isCurry ? undefined : partials;
  23083. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23084. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23085. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23086. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23087. }
  23088. var newData = [
  23089. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23090. newHoldersRight, argPos, ary, arity
  23091. ];
  23092. var result = wrapFunc.apply(undefined, newData);
  23093. if (isLaziable(func)) {
  23094. setData(result, newData);
  23095. }
  23096. result.placeholder = placeholder;
  23097. return setWrapToString(result, func, bitmask);
  23098. }
  23099. /**
  23100. * Creates a function like `_.round`.
  23101. *
  23102. * @private
  23103. * @param {string} methodName The name of the `Math` method to use when rounding.
  23104. * @returns {Function} Returns the new round function.
  23105. */
  23106. function createRound(methodName) {
  23107. var func = Math[methodName];
  23108. return function(number, precision) {
  23109. number = toNumber(number);
  23110. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23111. if (precision && nativeIsFinite(number)) {
  23112. // Shift with exponential notation to avoid floating-point issues.
  23113. // See [MDN](https://mdn.io/round#Examples) for more details.
  23114. var pair = (toString(number) + 'e').split('e'),
  23115. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23116. pair = (toString(value) + 'e').split('e');
  23117. return +(pair[0] + 'e' + (+pair[1] - precision));
  23118. }
  23119. return func(number);
  23120. };
  23121. }
  23122. /**
  23123. * Creates a set object of `values`.
  23124. *
  23125. * @private
  23126. * @param {Array} values The values to add to the set.
  23127. * @returns {Object} Returns the new set.
  23128. */
  23129. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23130. return new Set(values);
  23131. };
  23132. /**
  23133. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23134. *
  23135. * @private
  23136. * @param {Function} keysFunc The function to get the keys of a given object.
  23137. * @returns {Function} Returns the new pairs function.
  23138. */
  23139. function createToPairs(keysFunc) {
  23140. return function(object) {
  23141. var tag = getTag(object);
  23142. if (tag == mapTag) {
  23143. return mapToArray(object);
  23144. }
  23145. if (tag == setTag) {
  23146. return setToPairs(object);
  23147. }
  23148. return baseToPairs(object, keysFunc(object));
  23149. };
  23150. }
  23151. /**
  23152. * Creates a function that either curries or invokes `func` with optional
  23153. * `this` binding and partially applied arguments.
  23154. *
  23155. * @private
  23156. * @param {Function|string} func The function or method name to wrap.
  23157. * @param {number} bitmask The bitmask flags.
  23158. * 1 - `_.bind`
  23159. * 2 - `_.bindKey`
  23160. * 4 - `_.curry` or `_.curryRight` of a bound function
  23161. * 8 - `_.curry`
  23162. * 16 - `_.curryRight`
  23163. * 32 - `_.partial`
  23164. * 64 - `_.partialRight`
  23165. * 128 - `_.rearg`
  23166. * 256 - `_.ary`
  23167. * 512 - `_.flip`
  23168. * @param {*} [thisArg] The `this` binding of `func`.
  23169. * @param {Array} [partials] The arguments to be partially applied.
  23170. * @param {Array} [holders] The `partials` placeholder indexes.
  23171. * @param {Array} [argPos] The argument positions of the new function.
  23172. * @param {number} [ary] The arity cap of `func`.
  23173. * @param {number} [arity] The arity of `func`.
  23174. * @returns {Function} Returns the new wrapped function.
  23175. */
  23176. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23177. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23178. if (!isBindKey && typeof func != 'function') {
  23179. throw new TypeError(FUNC_ERROR_TEXT);
  23180. }
  23181. var length = partials ? partials.length : 0;
  23182. if (!length) {
  23183. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23184. partials = holders = undefined;
  23185. }
  23186. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23187. arity = arity === undefined ? arity : toInteger(arity);
  23188. length -= holders ? holders.length : 0;
  23189. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23190. var partialsRight = partials,
  23191. holdersRight = holders;
  23192. partials = holders = undefined;
  23193. }
  23194. var data = isBindKey ? undefined : getData(func);
  23195. var newData = [
  23196. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23197. argPos, ary, arity
  23198. ];
  23199. if (data) {
  23200. mergeData(newData, data);
  23201. }
  23202. func = newData[0];
  23203. bitmask = newData[1];
  23204. thisArg = newData[2];
  23205. partials = newData[3];
  23206. holders = newData[4];
  23207. arity = newData[9] = newData[9] === undefined
  23208. ? (isBindKey ? 0 : func.length)
  23209. : nativeMax(newData[9] - length, 0);
  23210. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23211. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23212. }
  23213. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23214. var result = createBind(func, bitmask, thisArg);
  23215. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23216. result = createCurry(func, bitmask, arity);
  23217. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23218. result = createPartial(func, bitmask, thisArg, partials);
  23219. } else {
  23220. result = createHybrid.apply(undefined, newData);
  23221. }
  23222. var setter = data ? baseSetData : setData;
  23223. return setWrapToString(setter(result, newData), func, bitmask);
  23224. }
  23225. /**
  23226. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23227. * of source objects to the destination object for all destination properties
  23228. * that resolve to `undefined`.
  23229. *
  23230. * @private
  23231. * @param {*} objValue The destination value.
  23232. * @param {*} srcValue The source value.
  23233. * @param {string} key The key of the property to assign.
  23234. * @param {Object} object The parent object of `objValue`.
  23235. * @returns {*} Returns the value to assign.
  23236. */
  23237. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23238. if (objValue === undefined ||
  23239. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23240. return srcValue;
  23241. }
  23242. return objValue;
  23243. }
  23244. /**
  23245. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23246. * objects into destination objects that are passed thru.
  23247. *
  23248. * @private
  23249. * @param {*} objValue The destination value.
  23250. * @param {*} srcValue The source value.
  23251. * @param {string} key The key of the property to merge.
  23252. * @param {Object} object The parent object of `objValue`.
  23253. * @param {Object} source The parent object of `srcValue`.
  23254. * @param {Object} [stack] Tracks traversed source values and their merged
  23255. * counterparts.
  23256. * @returns {*} Returns the value to assign.
  23257. */
  23258. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23259. if (isObject(objValue) && isObject(srcValue)) {
  23260. // Recursively merge objects and arrays (susceptible to call stack limits).
  23261. stack.set(srcValue, objValue);
  23262. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23263. stack['delete'](srcValue);
  23264. }
  23265. return objValue;
  23266. }
  23267. /**
  23268. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23269. * objects.
  23270. *
  23271. * @private
  23272. * @param {*} value The value to inspect.
  23273. * @param {string} key The key of the property to inspect.
  23274. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23275. */
  23276. function customOmitClone(value) {
  23277. return isPlainObject(value) ? undefined : value;
  23278. }
  23279. /**
  23280. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23281. * partial deep comparisons.
  23282. *
  23283. * @private
  23284. * @param {Array} array The array to compare.
  23285. * @param {Array} other The other array to compare.
  23286. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23287. * @param {Function} customizer The function to customize comparisons.
  23288. * @param {Function} equalFunc The function to determine equivalents of values.
  23289. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23290. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23291. */
  23292. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23293. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23294. arrLength = array.length,
  23295. othLength = other.length;
  23296. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23297. return false;
  23298. }
  23299. // Assume cyclic values are equal.
  23300. var stacked = stack.get(array);
  23301. if (stacked && stack.get(other)) {
  23302. return stacked == other;
  23303. }
  23304. var index = -1,
  23305. result = true,
  23306. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23307. stack.set(array, other);
  23308. stack.set(other, array);
  23309. // Ignore non-index properties.
  23310. while (++index < arrLength) {
  23311. var arrValue = array[index],
  23312. othValue = other[index];
  23313. if (customizer) {
  23314. var compared = isPartial
  23315. ? customizer(othValue, arrValue, index, other, array, stack)
  23316. : customizer(arrValue, othValue, index, array, other, stack);
  23317. }
  23318. if (compared !== undefined) {
  23319. if (compared) {
  23320. continue;
  23321. }
  23322. result = false;
  23323. break;
  23324. }
  23325. // Recursively compare arrays (susceptible to call stack limits).
  23326. if (seen) {
  23327. if (!arraySome(other, function(othValue, othIndex) {
  23328. if (!cacheHas(seen, othIndex) &&
  23329. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23330. return seen.push(othIndex);
  23331. }
  23332. })) {
  23333. result = false;
  23334. break;
  23335. }
  23336. } else if (!(
  23337. arrValue === othValue ||
  23338. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23339. )) {
  23340. result = false;
  23341. break;
  23342. }
  23343. }
  23344. stack['delete'](array);
  23345. stack['delete'](other);
  23346. return result;
  23347. }
  23348. /**
  23349. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23350. * the same `toStringTag`.
  23351. *
  23352. * **Note:** This function only supports comparing values with tags of
  23353. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23354. *
  23355. * @private
  23356. * @param {Object} object The object to compare.
  23357. * @param {Object} other The other object to compare.
  23358. * @param {string} tag The `toStringTag` of the objects to compare.
  23359. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23360. * @param {Function} customizer The function to customize comparisons.
  23361. * @param {Function} equalFunc The function to determine equivalents of values.
  23362. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23363. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23364. */
  23365. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23366. switch (tag) {
  23367. case dataViewTag:
  23368. if ((object.byteLength != other.byteLength) ||
  23369. (object.byteOffset != other.byteOffset)) {
  23370. return false;
  23371. }
  23372. object = object.buffer;
  23373. other = other.buffer;
  23374. case arrayBufferTag:
  23375. if ((object.byteLength != other.byteLength) ||
  23376. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23377. return false;
  23378. }
  23379. return true;
  23380. case boolTag:
  23381. case dateTag:
  23382. case numberTag:
  23383. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23384. // Invalid dates are coerced to `NaN`.
  23385. return eq(+object, +other);
  23386. case errorTag:
  23387. return object.name == other.name && object.message == other.message;
  23388. case regexpTag:
  23389. case stringTag:
  23390. // Coerce regexes to strings and treat strings, primitives and objects,
  23391. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23392. // for more details.
  23393. return object == (other + '');
  23394. case mapTag:
  23395. var convert = mapToArray;
  23396. case setTag:
  23397. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23398. convert || (convert = setToArray);
  23399. if (object.size != other.size && !isPartial) {
  23400. return false;
  23401. }
  23402. // Assume cyclic values are equal.
  23403. var stacked = stack.get(object);
  23404. if (stacked) {
  23405. return stacked == other;
  23406. }
  23407. bitmask |= COMPARE_UNORDERED_FLAG;
  23408. // Recursively compare objects (susceptible to call stack limits).
  23409. stack.set(object, other);
  23410. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23411. stack['delete'](object);
  23412. return result;
  23413. case symbolTag:
  23414. if (symbolValueOf) {
  23415. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23416. }
  23417. }
  23418. return false;
  23419. }
  23420. /**
  23421. * A specialized version of `baseIsEqualDeep` for objects with support for
  23422. * partial deep comparisons.
  23423. *
  23424. * @private
  23425. * @param {Object} object The object to compare.
  23426. * @param {Object} other The other object to compare.
  23427. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23428. * @param {Function} customizer The function to customize comparisons.
  23429. * @param {Function} equalFunc The function to determine equivalents of values.
  23430. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23431. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23432. */
  23433. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23434. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23435. objProps = getAllKeys(object),
  23436. objLength = objProps.length,
  23437. othProps = getAllKeys(other),
  23438. othLength = othProps.length;
  23439. if (objLength != othLength && !isPartial) {
  23440. return false;
  23441. }
  23442. var index = objLength;
  23443. while (index--) {
  23444. var key = objProps[index];
  23445. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23446. return false;
  23447. }
  23448. }
  23449. // Assume cyclic values are equal.
  23450. var stacked = stack.get(object);
  23451. if (stacked && stack.get(other)) {
  23452. return stacked == other;
  23453. }
  23454. var result = true;
  23455. stack.set(object, other);
  23456. stack.set(other, object);
  23457. var skipCtor = isPartial;
  23458. while (++index < objLength) {
  23459. key = objProps[index];
  23460. var objValue = object[key],
  23461. othValue = other[key];
  23462. if (customizer) {
  23463. var compared = isPartial
  23464. ? customizer(othValue, objValue, key, other, object, stack)
  23465. : customizer(objValue, othValue, key, object, other, stack);
  23466. }
  23467. // Recursively compare objects (susceptible to call stack limits).
  23468. if (!(compared === undefined
  23469. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23470. : compared
  23471. )) {
  23472. result = false;
  23473. break;
  23474. }
  23475. skipCtor || (skipCtor = key == 'constructor');
  23476. }
  23477. if (result && !skipCtor) {
  23478. var objCtor = object.constructor,
  23479. othCtor = other.constructor;
  23480. // Non `Object` object instances with different constructors are not equal.
  23481. if (objCtor != othCtor &&
  23482. ('constructor' in object && 'constructor' in other) &&
  23483. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23484. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23485. result = false;
  23486. }
  23487. }
  23488. stack['delete'](object);
  23489. stack['delete'](other);
  23490. return result;
  23491. }
  23492. /**
  23493. * A specialized version of `baseRest` which flattens the rest array.
  23494. *
  23495. * @private
  23496. * @param {Function} func The function to apply a rest parameter to.
  23497. * @returns {Function} Returns the new function.
  23498. */
  23499. function flatRest(func) {
  23500. return setToString(overRest(func, undefined, flatten), func + '');
  23501. }
  23502. /**
  23503. * Creates an array of own enumerable property names and symbols of `object`.
  23504. *
  23505. * @private
  23506. * @param {Object} object The object to query.
  23507. * @returns {Array} Returns the array of property names and symbols.
  23508. */
  23509. function getAllKeys(object) {
  23510. return baseGetAllKeys(object, keys, getSymbols);
  23511. }
  23512. /**
  23513. * Creates an array of own and inherited enumerable property names and
  23514. * symbols of `object`.
  23515. *
  23516. * @private
  23517. * @param {Object} object The object to query.
  23518. * @returns {Array} Returns the array of property names and symbols.
  23519. */
  23520. function getAllKeysIn(object) {
  23521. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23522. }
  23523. /**
  23524. * Gets metadata for `func`.
  23525. *
  23526. * @private
  23527. * @param {Function} func The function to query.
  23528. * @returns {*} Returns the metadata for `func`.
  23529. */
  23530. var getData = !metaMap ? noop : function(func) {
  23531. return metaMap.get(func);
  23532. };
  23533. /**
  23534. * Gets the name of `func`.
  23535. *
  23536. * @private
  23537. * @param {Function} func The function to query.
  23538. * @returns {string} Returns the function name.
  23539. */
  23540. function getFuncName(func) {
  23541. var result = (func.name + ''),
  23542. array = realNames[result],
  23543. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23544. while (length--) {
  23545. var data = array[length],
  23546. otherFunc = data.func;
  23547. if (otherFunc == null || otherFunc == func) {
  23548. return data.name;
  23549. }
  23550. }
  23551. return result;
  23552. }
  23553. /**
  23554. * Gets the argument placeholder value for `func`.
  23555. *
  23556. * @private
  23557. * @param {Function} func The function to inspect.
  23558. * @returns {*} Returns the placeholder value.
  23559. */
  23560. function getHolder(func) {
  23561. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23562. return object.placeholder;
  23563. }
  23564. /**
  23565. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23566. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23567. * If arguments are provided, the chosen function is invoked with them and
  23568. * its result is returned.
  23569. *
  23570. * @private
  23571. * @param {*} [value] The value to convert to an iteratee.
  23572. * @param {number} [arity] The arity of the created iteratee.
  23573. * @returns {Function} Returns the chosen function or its result.
  23574. */
  23575. function getIteratee() {
  23576. var result = lodash.iteratee || iteratee;
  23577. result = result === iteratee ? baseIteratee : result;
  23578. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23579. }
  23580. /**
  23581. * Gets the data for `map`.
  23582. *
  23583. * @private
  23584. * @param {Object} map The map to query.
  23585. * @param {string} key The reference key.
  23586. * @returns {*} Returns the map data.
  23587. */
  23588. function getMapData(map, key) {
  23589. var data = map.__data__;
  23590. return isKeyable(key)
  23591. ? data[typeof key == 'string' ? 'string' : 'hash']
  23592. : data.map;
  23593. }
  23594. /**
  23595. * Gets the property names, values, and compare flags of `object`.
  23596. *
  23597. * @private
  23598. * @param {Object} object The object to query.
  23599. * @returns {Array} Returns the match data of `object`.
  23600. */
  23601. function getMatchData(object) {
  23602. var result = keys(object),
  23603. length = result.length;
  23604. while (length--) {
  23605. var key = result[length],
  23606. value = object[key];
  23607. result[length] = [key, value, isStrictComparable(value)];
  23608. }
  23609. return result;
  23610. }
  23611. /**
  23612. * Gets the native function at `key` of `object`.
  23613. *
  23614. * @private
  23615. * @param {Object} object The object to query.
  23616. * @param {string} key The key of the method to get.
  23617. * @returns {*} Returns the function if it's native, else `undefined`.
  23618. */
  23619. function getNative(object, key) {
  23620. var value = getValue(object, key);
  23621. return baseIsNative(value) ? value : undefined;
  23622. }
  23623. /**
  23624. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23625. *
  23626. * @private
  23627. * @param {*} value The value to query.
  23628. * @returns {string} Returns the raw `toStringTag`.
  23629. */
  23630. function getRawTag(value) {
  23631. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23632. tag = value[symToStringTag];
  23633. try {
  23634. value[symToStringTag] = undefined;
  23635. var unmasked = true;
  23636. } catch (e) {}
  23637. var result = nativeObjectToString.call(value);
  23638. if (unmasked) {
  23639. if (isOwn) {
  23640. value[symToStringTag] = tag;
  23641. } else {
  23642. delete value[symToStringTag];
  23643. }
  23644. }
  23645. return result;
  23646. }
  23647. /**
  23648. * Creates an array of the own enumerable symbols of `object`.
  23649. *
  23650. * @private
  23651. * @param {Object} object The object to query.
  23652. * @returns {Array} Returns the array of symbols.
  23653. */
  23654. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23655. if (object == null) {
  23656. return [];
  23657. }
  23658. object = Object(object);
  23659. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23660. return propertyIsEnumerable.call(object, symbol);
  23661. });
  23662. };
  23663. /**
  23664. * Creates an array of the own and inherited enumerable symbols of `object`.
  23665. *
  23666. * @private
  23667. * @param {Object} object The object to query.
  23668. * @returns {Array} Returns the array of symbols.
  23669. */
  23670. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23671. var result = [];
  23672. while (object) {
  23673. arrayPush(result, getSymbols(object));
  23674. object = getPrototype(object);
  23675. }
  23676. return result;
  23677. };
  23678. /**
  23679. * Gets the `toStringTag` of `value`.
  23680. *
  23681. * @private
  23682. * @param {*} value The value to query.
  23683. * @returns {string} Returns the `toStringTag`.
  23684. */
  23685. var getTag = baseGetTag;
  23686. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23687. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23688. (Map && getTag(new Map) != mapTag) ||
  23689. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23690. (Set && getTag(new Set) != setTag) ||
  23691. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23692. getTag = function(value) {
  23693. var result = baseGetTag(value),
  23694. Ctor = result == objectTag ? value.constructor : undefined,
  23695. ctorString = Ctor ? toSource(Ctor) : '';
  23696. if (ctorString) {
  23697. switch (ctorString) {
  23698. case dataViewCtorString: return dataViewTag;
  23699. case mapCtorString: return mapTag;
  23700. case promiseCtorString: return promiseTag;
  23701. case setCtorString: return setTag;
  23702. case weakMapCtorString: return weakMapTag;
  23703. }
  23704. }
  23705. return result;
  23706. };
  23707. }
  23708. /**
  23709. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23710. *
  23711. * @private
  23712. * @param {number} start The start of the view.
  23713. * @param {number} end The end of the view.
  23714. * @param {Array} transforms The transformations to apply to the view.
  23715. * @returns {Object} Returns an object containing the `start` and `end`
  23716. * positions of the view.
  23717. */
  23718. function getView(start, end, transforms) {
  23719. var index = -1,
  23720. length = transforms.length;
  23721. while (++index < length) {
  23722. var data = transforms[index],
  23723. size = data.size;
  23724. switch (data.type) {
  23725. case 'drop': start += size; break;
  23726. case 'dropRight': end -= size; break;
  23727. case 'take': end = nativeMin(end, start + size); break;
  23728. case 'takeRight': start = nativeMax(start, end - size); break;
  23729. }
  23730. }
  23731. return { 'start': start, 'end': end };
  23732. }
  23733. /**
  23734. * Extracts wrapper details from the `source` body comment.
  23735. *
  23736. * @private
  23737. * @param {string} source The source to inspect.
  23738. * @returns {Array} Returns the wrapper details.
  23739. */
  23740. function getWrapDetails(source) {
  23741. var match = source.match(reWrapDetails);
  23742. return match ? match[1].split(reSplitDetails) : [];
  23743. }
  23744. /**
  23745. * Checks if `path` exists on `object`.
  23746. *
  23747. * @private
  23748. * @param {Object} object The object to query.
  23749. * @param {Array|string} path The path to check.
  23750. * @param {Function} hasFunc The function to check properties.
  23751. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23752. */
  23753. function hasPath(object, path, hasFunc) {
  23754. path = castPath(path, object);
  23755. var index = -1,
  23756. length = path.length,
  23757. result = false;
  23758. while (++index < length) {
  23759. var key = toKey(path[index]);
  23760. if (!(result = object != null && hasFunc(object, key))) {
  23761. break;
  23762. }
  23763. object = object[key];
  23764. }
  23765. if (result || ++index != length) {
  23766. return result;
  23767. }
  23768. length = object == null ? 0 : object.length;
  23769. return !!length && isLength(length) && isIndex(key, length) &&
  23770. (isArray(object) || isArguments(object));
  23771. }
  23772. /**
  23773. * Initializes an array clone.
  23774. *
  23775. * @private
  23776. * @param {Array} array The array to clone.
  23777. * @returns {Array} Returns the initialized clone.
  23778. */
  23779. function initCloneArray(array) {
  23780. var length = array.length,
  23781. result = new array.constructor(length);
  23782. // Add properties assigned by `RegExp#exec`.
  23783. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23784. result.index = array.index;
  23785. result.input = array.input;
  23786. }
  23787. return result;
  23788. }
  23789. /**
  23790. * Initializes an object clone.
  23791. *
  23792. * @private
  23793. * @param {Object} object The object to clone.
  23794. * @returns {Object} Returns the initialized clone.
  23795. */
  23796. function initCloneObject(object) {
  23797. return (typeof object.constructor == 'function' && !isPrototype(object))
  23798. ? baseCreate(getPrototype(object))
  23799. : {};
  23800. }
  23801. /**
  23802. * Initializes an object clone based on its `toStringTag`.
  23803. *
  23804. * **Note:** This function only supports cloning values with tags of
  23805. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23806. *
  23807. * @private
  23808. * @param {Object} object The object to clone.
  23809. * @param {string} tag The `toStringTag` of the object to clone.
  23810. * @param {boolean} [isDeep] Specify a deep clone.
  23811. * @returns {Object} Returns the initialized clone.
  23812. */
  23813. function initCloneByTag(object, tag, isDeep) {
  23814. var Ctor = object.constructor;
  23815. switch (tag) {
  23816. case arrayBufferTag:
  23817. return cloneArrayBuffer(object);
  23818. case boolTag:
  23819. case dateTag:
  23820. return new Ctor(+object);
  23821. case dataViewTag:
  23822. return cloneDataView(object, isDeep);
  23823. case float32Tag: case float64Tag:
  23824. case int8Tag: case int16Tag: case int32Tag:
  23825. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23826. return cloneTypedArray(object, isDeep);
  23827. case mapTag:
  23828. return new Ctor;
  23829. case numberTag:
  23830. case stringTag:
  23831. return new Ctor(object);
  23832. case regexpTag:
  23833. return cloneRegExp(object);
  23834. case setTag:
  23835. return new Ctor;
  23836. case symbolTag:
  23837. return cloneSymbol(object);
  23838. }
  23839. }
  23840. /**
  23841. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23842. *
  23843. * @private
  23844. * @param {string} source The source to modify.
  23845. * @returns {Array} details The details to insert.
  23846. * @returns {string} Returns the modified source.
  23847. */
  23848. function insertWrapDetails(source, details) {
  23849. var length = details.length;
  23850. if (!length) {
  23851. return source;
  23852. }
  23853. var lastIndex = length - 1;
  23854. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23855. details = details.join(length > 2 ? ', ' : ' ');
  23856. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23857. }
  23858. /**
  23859. * Checks if `value` is a flattenable `arguments` object or array.
  23860. *
  23861. * @private
  23862. * @param {*} value The value to check.
  23863. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23864. */
  23865. function isFlattenable(value) {
  23866. return isArray(value) || isArguments(value) ||
  23867. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23868. }
  23869. /**
  23870. * Checks if `value` is a valid array-like index.
  23871. *
  23872. * @private
  23873. * @param {*} value The value to check.
  23874. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23875. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23876. */
  23877. function isIndex(value, length) {
  23878. var type = typeof value;
  23879. length = length == null ? MAX_SAFE_INTEGER : length;
  23880. return !!length &&
  23881. (type == 'number' ||
  23882. (type != 'symbol' && reIsUint.test(value))) &&
  23883. (value > -1 && value % 1 == 0 && value < length);
  23884. }
  23885. /**
  23886. * Checks if the given arguments are from an iteratee call.
  23887. *
  23888. * @private
  23889. * @param {*} value The potential iteratee value argument.
  23890. * @param {*} index The potential iteratee index or key argument.
  23891. * @param {*} object The potential iteratee object argument.
  23892. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23893. * else `false`.
  23894. */
  23895. function isIterateeCall(value, index, object) {
  23896. if (!isObject(object)) {
  23897. return false;
  23898. }
  23899. var type = typeof index;
  23900. if (type == 'number'
  23901. ? (isArrayLike(object) && isIndex(index, object.length))
  23902. : (type == 'string' && index in object)
  23903. ) {
  23904. return eq(object[index], value);
  23905. }
  23906. return false;
  23907. }
  23908. /**
  23909. * Checks if `value` is a property name and not a property path.
  23910. *
  23911. * @private
  23912. * @param {*} value The value to check.
  23913. * @param {Object} [object] The object to query keys on.
  23914. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  23915. */
  23916. function isKey(value, object) {
  23917. if (isArray(value)) {
  23918. return false;
  23919. }
  23920. var type = typeof value;
  23921. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  23922. value == null || isSymbol(value)) {
  23923. return true;
  23924. }
  23925. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  23926. (object != null && value in Object(object));
  23927. }
  23928. /**
  23929. * Checks if `value` is suitable for use as unique object key.
  23930. *
  23931. * @private
  23932. * @param {*} value The value to check.
  23933. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  23934. */
  23935. function isKeyable(value) {
  23936. var type = typeof value;
  23937. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  23938. ? (value !== '__proto__')
  23939. : (value === null);
  23940. }
  23941. /**
  23942. * Checks if `func` has a lazy counterpart.
  23943. *
  23944. * @private
  23945. * @param {Function} func The function to check.
  23946. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  23947. * else `false`.
  23948. */
  23949. function isLaziable(func) {
  23950. var funcName = getFuncName(func),
  23951. other = lodash[funcName];
  23952. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  23953. return false;
  23954. }
  23955. if (func === other) {
  23956. return true;
  23957. }
  23958. var data = getData(other);
  23959. return !!data && func === data[0];
  23960. }
  23961. /**
  23962. * Checks if `func` has its source masked.
  23963. *
  23964. * @private
  23965. * @param {Function} func The function to check.
  23966. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  23967. */
  23968. function isMasked(func) {
  23969. return !!maskSrcKey && (maskSrcKey in func);
  23970. }
  23971. /**
  23972. * Checks if `func` is capable of being masked.
  23973. *
  23974. * @private
  23975. * @param {*} value The value to check.
  23976. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  23977. */
  23978. var isMaskable = coreJsData ? isFunction : stubFalse;
  23979. /**
  23980. * Checks if `value` is likely a prototype object.
  23981. *
  23982. * @private
  23983. * @param {*} value The value to check.
  23984. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  23985. */
  23986. function isPrototype(value) {
  23987. var Ctor = value && value.constructor,
  23988. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  23989. return value === proto;
  23990. }
  23991. /**
  23992. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  23993. *
  23994. * @private
  23995. * @param {*} value The value to check.
  23996. * @returns {boolean} Returns `true` if `value` if suitable for strict
  23997. * equality comparisons, else `false`.
  23998. */
  23999. function isStrictComparable(value) {
  24000. return value === value && !isObject(value);
  24001. }
  24002. /**
  24003. * A specialized version of `matchesProperty` for source values suitable
  24004. * for strict equality comparisons, i.e. `===`.
  24005. *
  24006. * @private
  24007. * @param {string} key The key of the property to get.
  24008. * @param {*} srcValue The value to match.
  24009. * @returns {Function} Returns the new spec function.
  24010. */
  24011. function matchesStrictComparable(key, srcValue) {
  24012. return function(object) {
  24013. if (object == null) {
  24014. return false;
  24015. }
  24016. return object[key] === srcValue &&
  24017. (srcValue !== undefined || (key in Object(object)));
  24018. };
  24019. }
  24020. /**
  24021. * A specialized version of `_.memoize` which clears the memoized function's
  24022. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24023. *
  24024. * @private
  24025. * @param {Function} func The function to have its output memoized.
  24026. * @returns {Function} Returns the new memoized function.
  24027. */
  24028. function memoizeCapped(func) {
  24029. var result = memoize(func, function(key) {
  24030. if (cache.size === MAX_MEMOIZE_SIZE) {
  24031. cache.clear();
  24032. }
  24033. return key;
  24034. });
  24035. var cache = result.cache;
  24036. return result;
  24037. }
  24038. /**
  24039. * Merges the function metadata of `source` into `data`.
  24040. *
  24041. * Merging metadata reduces the number of wrappers used to invoke a function.
  24042. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24043. * may be applied regardless of execution order. Methods like `_.ary` and
  24044. * `_.rearg` modify function arguments, making the order in which they are
  24045. * executed important, preventing the merging of metadata. However, we make
  24046. * an exception for a safe combined case where curried functions have `_.ary`
  24047. * and or `_.rearg` applied.
  24048. *
  24049. * @private
  24050. * @param {Array} data The destination metadata.
  24051. * @param {Array} source The source metadata.
  24052. * @returns {Array} Returns `data`.
  24053. */
  24054. function mergeData(data, source) {
  24055. var bitmask = data[1],
  24056. srcBitmask = source[1],
  24057. newBitmask = bitmask | srcBitmask,
  24058. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24059. var isCombo =
  24060. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24061. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24062. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24063. // Exit early if metadata can't be merged.
  24064. if (!(isCommon || isCombo)) {
  24065. return data;
  24066. }
  24067. // Use source `thisArg` if available.
  24068. if (srcBitmask & WRAP_BIND_FLAG) {
  24069. data[2] = source[2];
  24070. // Set when currying a bound function.
  24071. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24072. }
  24073. // Compose partial arguments.
  24074. var value = source[3];
  24075. if (value) {
  24076. var partials = data[3];
  24077. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24078. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24079. }
  24080. // Compose partial right arguments.
  24081. value = source[5];
  24082. if (value) {
  24083. partials = data[5];
  24084. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24085. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24086. }
  24087. // Use source `argPos` if available.
  24088. value = source[7];
  24089. if (value) {
  24090. data[7] = value;
  24091. }
  24092. // Use source `ary` if it's smaller.
  24093. if (srcBitmask & WRAP_ARY_FLAG) {
  24094. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24095. }
  24096. // Use source `arity` if one is not provided.
  24097. if (data[9] == null) {
  24098. data[9] = source[9];
  24099. }
  24100. // Use source `func` and merge bitmasks.
  24101. data[0] = source[0];
  24102. data[1] = newBitmask;
  24103. return data;
  24104. }
  24105. /**
  24106. * This function is like
  24107. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24108. * except that it includes inherited enumerable properties.
  24109. *
  24110. * @private
  24111. * @param {Object} object The object to query.
  24112. * @returns {Array} Returns the array of property names.
  24113. */
  24114. function nativeKeysIn(object) {
  24115. var result = [];
  24116. if (object != null) {
  24117. for (var key in Object(object)) {
  24118. result.push(key);
  24119. }
  24120. }
  24121. return result;
  24122. }
  24123. /**
  24124. * Converts `value` to a string using `Object.prototype.toString`.
  24125. *
  24126. * @private
  24127. * @param {*} value The value to convert.
  24128. * @returns {string} Returns the converted string.
  24129. */
  24130. function objectToString(value) {
  24131. return nativeObjectToString.call(value);
  24132. }
  24133. /**
  24134. * A specialized version of `baseRest` which transforms the rest array.
  24135. *
  24136. * @private
  24137. * @param {Function} func The function to apply a rest parameter to.
  24138. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24139. * @param {Function} transform The rest array transform.
  24140. * @returns {Function} Returns the new function.
  24141. */
  24142. function overRest(func, start, transform) {
  24143. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24144. return function() {
  24145. var args = arguments,
  24146. index = -1,
  24147. length = nativeMax(args.length - start, 0),
  24148. array = Array(length);
  24149. while (++index < length) {
  24150. array[index] = args[start + index];
  24151. }
  24152. index = -1;
  24153. var otherArgs = Array(start + 1);
  24154. while (++index < start) {
  24155. otherArgs[index] = args[index];
  24156. }
  24157. otherArgs[start] = transform(array);
  24158. return apply(func, this, otherArgs);
  24159. };
  24160. }
  24161. /**
  24162. * Gets the parent value at `path` of `object`.
  24163. *
  24164. * @private
  24165. * @param {Object} object The object to query.
  24166. * @param {Array} path The path to get the parent value of.
  24167. * @returns {*} Returns the parent value.
  24168. */
  24169. function parent(object, path) {
  24170. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24171. }
  24172. /**
  24173. * Reorder `array` according to the specified indexes where the element at
  24174. * the first index is assigned as the first element, the element at
  24175. * the second index is assigned as the second element, and so on.
  24176. *
  24177. * @private
  24178. * @param {Array} array The array to reorder.
  24179. * @param {Array} indexes The arranged array indexes.
  24180. * @returns {Array} Returns `array`.
  24181. */
  24182. function reorder(array, indexes) {
  24183. var arrLength = array.length,
  24184. length = nativeMin(indexes.length, arrLength),
  24185. oldArray = copyArray(array);
  24186. while (length--) {
  24187. var index = indexes[length];
  24188. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24189. }
  24190. return array;
  24191. }
  24192. /**
  24193. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24194. *
  24195. * @private
  24196. * @param {Object} object The object to query.
  24197. * @param {string} key The key of the property to get.
  24198. * @returns {*} Returns the property value.
  24199. */
  24200. function safeGet(object, key) {
  24201. if (key === 'constructor' && typeof object[key] === 'function') {
  24202. return;
  24203. }
  24204. if (key == '__proto__') {
  24205. return;
  24206. }
  24207. return object[key];
  24208. }
  24209. /**
  24210. * Sets metadata for `func`.
  24211. *
  24212. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24213. * period of time, it will trip its breaker and transition to an identity
  24214. * function to avoid garbage collection pauses in V8. See
  24215. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24216. * for more details.
  24217. *
  24218. * @private
  24219. * @param {Function} func The function to associate metadata with.
  24220. * @param {*} data The metadata.
  24221. * @returns {Function} Returns `func`.
  24222. */
  24223. var setData = shortOut(baseSetData);
  24224. /**
  24225. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24226. *
  24227. * @private
  24228. * @param {Function} func The function to delay.
  24229. * @param {number} wait The number of milliseconds to delay invocation.
  24230. * @returns {number|Object} Returns the timer id or timeout object.
  24231. */
  24232. var setTimeout = ctxSetTimeout || function(func, wait) {
  24233. return root.setTimeout(func, wait);
  24234. };
  24235. /**
  24236. * Sets the `toString` method of `func` to return `string`.
  24237. *
  24238. * @private
  24239. * @param {Function} func The function to modify.
  24240. * @param {Function} string The `toString` result.
  24241. * @returns {Function} Returns `func`.
  24242. */
  24243. var setToString = shortOut(baseSetToString);
  24244. /**
  24245. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24246. * with wrapper details in a comment at the top of the source body.
  24247. *
  24248. * @private
  24249. * @param {Function} wrapper The function to modify.
  24250. * @param {Function} reference The reference function.
  24251. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24252. * @returns {Function} Returns `wrapper`.
  24253. */
  24254. function setWrapToString(wrapper, reference, bitmask) {
  24255. var source = (reference + '');
  24256. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24257. }
  24258. /**
  24259. * Creates a function that'll short out and invoke `identity` instead
  24260. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24261. * milliseconds.
  24262. *
  24263. * @private
  24264. * @param {Function} func The function to restrict.
  24265. * @returns {Function} Returns the new shortable function.
  24266. */
  24267. function shortOut(func) {
  24268. var count = 0,
  24269. lastCalled = 0;
  24270. return function() {
  24271. var stamp = nativeNow(),
  24272. remaining = HOT_SPAN - (stamp - lastCalled);
  24273. lastCalled = stamp;
  24274. if (remaining > 0) {
  24275. if (++count >= HOT_COUNT) {
  24276. return arguments[0];
  24277. }
  24278. } else {
  24279. count = 0;
  24280. }
  24281. return func.apply(undefined, arguments);
  24282. };
  24283. }
  24284. /**
  24285. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24286. *
  24287. * @private
  24288. * @param {Array} array The array to shuffle.
  24289. * @param {number} [size=array.length] The size of `array`.
  24290. * @returns {Array} Returns `array`.
  24291. */
  24292. function shuffleSelf(array, size) {
  24293. var index = -1,
  24294. length = array.length,
  24295. lastIndex = length - 1;
  24296. size = size === undefined ? length : size;
  24297. while (++index < size) {
  24298. var rand = baseRandom(index, lastIndex),
  24299. value = array[rand];
  24300. array[rand] = array[index];
  24301. array[index] = value;
  24302. }
  24303. array.length = size;
  24304. return array;
  24305. }
  24306. /**
  24307. * Converts `string` to a property path array.
  24308. *
  24309. * @private
  24310. * @param {string} string The string to convert.
  24311. * @returns {Array} Returns the property path array.
  24312. */
  24313. var stringToPath = memoizeCapped(function(string) {
  24314. var result = [];
  24315. if (string.charCodeAt(0) === 46 /* . */) {
  24316. result.push('');
  24317. }
  24318. string.replace(rePropName, function(match, number, quote, subString) {
  24319. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24320. });
  24321. return result;
  24322. });
  24323. /**
  24324. * Converts `value` to a string key if it's not a string or symbol.
  24325. *
  24326. * @private
  24327. * @param {*} value The value to inspect.
  24328. * @returns {string|symbol} Returns the key.
  24329. */
  24330. function toKey(value) {
  24331. if (typeof value == 'string' || isSymbol(value)) {
  24332. return value;
  24333. }
  24334. var result = (value + '');
  24335. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24336. }
  24337. /**
  24338. * Converts `func` to its source code.
  24339. *
  24340. * @private
  24341. * @param {Function} func The function to convert.
  24342. * @returns {string} Returns the source code.
  24343. */
  24344. function toSource(func) {
  24345. if (func != null) {
  24346. try {
  24347. return funcToString.call(func);
  24348. } catch (e) {}
  24349. try {
  24350. return (func + '');
  24351. } catch (e) {}
  24352. }
  24353. return '';
  24354. }
  24355. /**
  24356. * Updates wrapper `details` based on `bitmask` flags.
  24357. *
  24358. * @private
  24359. * @returns {Array} details The details to modify.
  24360. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24361. * @returns {Array} Returns `details`.
  24362. */
  24363. function updateWrapDetails(details, bitmask) {
  24364. arrayEach(wrapFlags, function(pair) {
  24365. var value = '_.' + pair[0];
  24366. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24367. details.push(value);
  24368. }
  24369. });
  24370. return details.sort();
  24371. }
  24372. /**
  24373. * Creates a clone of `wrapper`.
  24374. *
  24375. * @private
  24376. * @param {Object} wrapper The wrapper to clone.
  24377. * @returns {Object} Returns the cloned wrapper.
  24378. */
  24379. function wrapperClone(wrapper) {
  24380. if (wrapper instanceof LazyWrapper) {
  24381. return wrapper.clone();
  24382. }
  24383. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24384. result.__actions__ = copyArray(wrapper.__actions__);
  24385. result.__index__ = wrapper.__index__;
  24386. result.__values__ = wrapper.__values__;
  24387. return result;
  24388. }
  24389. /*------------------------------------------------------------------------*/
  24390. /**
  24391. * Creates an array of elements split into groups the length of `size`.
  24392. * If `array` can't be split evenly, the final chunk will be the remaining
  24393. * elements.
  24394. *
  24395. * @static
  24396. * @memberOf _
  24397. * @since 3.0.0
  24398. * @category Array
  24399. * @param {Array} array The array to process.
  24400. * @param {number} [size=1] The length of each chunk
  24401. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24402. * @returns {Array} Returns the new array of chunks.
  24403. * @example
  24404. *
  24405. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24406. * // => [['a', 'b'], ['c', 'd']]
  24407. *
  24408. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24409. * // => [['a', 'b', 'c'], ['d']]
  24410. */
  24411. function chunk(array, size, guard) {
  24412. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24413. size = 1;
  24414. } else {
  24415. size = nativeMax(toInteger(size), 0);
  24416. }
  24417. var length = array == null ? 0 : array.length;
  24418. if (!length || size < 1) {
  24419. return [];
  24420. }
  24421. var index = 0,
  24422. resIndex = 0,
  24423. result = Array(nativeCeil(length / size));
  24424. while (index < length) {
  24425. result[resIndex++] = baseSlice(array, index, (index += size));
  24426. }
  24427. return result;
  24428. }
  24429. /**
  24430. * Creates an array with all falsey values removed. The values `false`, `null`,
  24431. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24432. *
  24433. * @static
  24434. * @memberOf _
  24435. * @since 0.1.0
  24436. * @category Array
  24437. * @param {Array} array The array to compact.
  24438. * @returns {Array} Returns the new array of filtered values.
  24439. * @example
  24440. *
  24441. * _.compact([0, 1, false, 2, '', 3]);
  24442. * // => [1, 2, 3]
  24443. */
  24444. function compact(array) {
  24445. var index = -1,
  24446. length = array == null ? 0 : array.length,
  24447. resIndex = 0,
  24448. result = [];
  24449. while (++index < length) {
  24450. var value = array[index];
  24451. if (value) {
  24452. result[resIndex++] = value;
  24453. }
  24454. }
  24455. return result;
  24456. }
  24457. /**
  24458. * Creates a new array concatenating `array` with any additional arrays
  24459. * and/or values.
  24460. *
  24461. * @static
  24462. * @memberOf _
  24463. * @since 4.0.0
  24464. * @category Array
  24465. * @param {Array} array The array to concatenate.
  24466. * @param {...*} [values] The values to concatenate.
  24467. * @returns {Array} Returns the new concatenated array.
  24468. * @example
  24469. *
  24470. * var array = [1];
  24471. * var other = _.concat(array, 2, [3], [[4]]);
  24472. *
  24473. * console.log(other);
  24474. * // => [1, 2, 3, [4]]
  24475. *
  24476. * console.log(array);
  24477. * // => [1]
  24478. */
  24479. function concat() {
  24480. var length = arguments.length;
  24481. if (!length) {
  24482. return [];
  24483. }
  24484. var args = Array(length - 1),
  24485. array = arguments[0],
  24486. index = length;
  24487. while (index--) {
  24488. args[index - 1] = arguments[index];
  24489. }
  24490. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24491. }
  24492. /**
  24493. * Creates an array of `array` values not included in the other given arrays
  24494. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24495. * for equality comparisons. The order and references of result values are
  24496. * determined by the first array.
  24497. *
  24498. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24499. *
  24500. * @static
  24501. * @memberOf _
  24502. * @since 0.1.0
  24503. * @category Array
  24504. * @param {Array} array The array to inspect.
  24505. * @param {...Array} [values] The values to exclude.
  24506. * @returns {Array} Returns the new array of filtered values.
  24507. * @see _.without, _.xor
  24508. * @example
  24509. *
  24510. * _.difference([2, 1], [2, 3]);
  24511. * // => [1]
  24512. */
  24513. var difference = baseRest(function(array, values) {
  24514. return isArrayLikeObject(array)
  24515. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24516. : [];
  24517. });
  24518. /**
  24519. * This method is like `_.difference` except that it accepts `iteratee` which
  24520. * is invoked for each element of `array` and `values` to generate the criterion
  24521. * by which they're compared. The order and references of result values are
  24522. * determined by the first array. The iteratee is invoked with one argument:
  24523. * (value).
  24524. *
  24525. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24526. *
  24527. * @static
  24528. * @memberOf _
  24529. * @since 4.0.0
  24530. * @category Array
  24531. * @param {Array} array The array to inspect.
  24532. * @param {...Array} [values] The values to exclude.
  24533. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24534. * @returns {Array} Returns the new array of filtered values.
  24535. * @example
  24536. *
  24537. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24538. * // => [1.2]
  24539. *
  24540. * // The `_.property` iteratee shorthand.
  24541. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24542. * // => [{ 'x': 2 }]
  24543. */
  24544. var differenceBy = baseRest(function(array, values) {
  24545. var iteratee = last(values);
  24546. if (isArrayLikeObject(iteratee)) {
  24547. iteratee = undefined;
  24548. }
  24549. return isArrayLikeObject(array)
  24550. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24551. : [];
  24552. });
  24553. /**
  24554. * This method is like `_.difference` except that it accepts `comparator`
  24555. * which is invoked to compare elements of `array` to `values`. The order and
  24556. * references of result values are determined by the first array. The comparator
  24557. * is invoked with two arguments: (arrVal, othVal).
  24558. *
  24559. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24560. *
  24561. * @static
  24562. * @memberOf _
  24563. * @since 4.0.0
  24564. * @category Array
  24565. * @param {Array} array The array to inspect.
  24566. * @param {...Array} [values] The values to exclude.
  24567. * @param {Function} [comparator] The comparator invoked per element.
  24568. * @returns {Array} Returns the new array of filtered values.
  24569. * @example
  24570. *
  24571. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24572. *
  24573. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24574. * // => [{ 'x': 2, 'y': 1 }]
  24575. */
  24576. var differenceWith = baseRest(function(array, values) {
  24577. var comparator = last(values);
  24578. if (isArrayLikeObject(comparator)) {
  24579. comparator = undefined;
  24580. }
  24581. return isArrayLikeObject(array)
  24582. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24583. : [];
  24584. });
  24585. /**
  24586. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24587. *
  24588. * @static
  24589. * @memberOf _
  24590. * @since 0.5.0
  24591. * @category Array
  24592. * @param {Array} array The array to query.
  24593. * @param {number} [n=1] The number of elements to drop.
  24594. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24595. * @returns {Array} Returns the slice of `array`.
  24596. * @example
  24597. *
  24598. * _.drop([1, 2, 3]);
  24599. * // => [2, 3]
  24600. *
  24601. * _.drop([1, 2, 3], 2);
  24602. * // => [3]
  24603. *
  24604. * _.drop([1, 2, 3], 5);
  24605. * // => []
  24606. *
  24607. * _.drop([1, 2, 3], 0);
  24608. * // => [1, 2, 3]
  24609. */
  24610. function drop(array, n, guard) {
  24611. var length = array == null ? 0 : array.length;
  24612. if (!length) {
  24613. return [];
  24614. }
  24615. n = (guard || n === undefined) ? 1 : toInteger(n);
  24616. return baseSlice(array, n < 0 ? 0 : n, length);
  24617. }
  24618. /**
  24619. * Creates a slice of `array` with `n` elements dropped from the end.
  24620. *
  24621. * @static
  24622. * @memberOf _
  24623. * @since 3.0.0
  24624. * @category Array
  24625. * @param {Array} array The array to query.
  24626. * @param {number} [n=1] The number of elements to drop.
  24627. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24628. * @returns {Array} Returns the slice of `array`.
  24629. * @example
  24630. *
  24631. * _.dropRight([1, 2, 3]);
  24632. * // => [1, 2]
  24633. *
  24634. * _.dropRight([1, 2, 3], 2);
  24635. * // => [1]
  24636. *
  24637. * _.dropRight([1, 2, 3], 5);
  24638. * // => []
  24639. *
  24640. * _.dropRight([1, 2, 3], 0);
  24641. * // => [1, 2, 3]
  24642. */
  24643. function dropRight(array, n, guard) {
  24644. var length = array == null ? 0 : array.length;
  24645. if (!length) {
  24646. return [];
  24647. }
  24648. n = (guard || n === undefined) ? 1 : toInteger(n);
  24649. n = length - n;
  24650. return baseSlice(array, 0, n < 0 ? 0 : n);
  24651. }
  24652. /**
  24653. * Creates a slice of `array` excluding elements dropped from the end.
  24654. * Elements are dropped until `predicate` returns falsey. The predicate is
  24655. * invoked with three arguments: (value, index, array).
  24656. *
  24657. * @static
  24658. * @memberOf _
  24659. * @since 3.0.0
  24660. * @category Array
  24661. * @param {Array} array The array to query.
  24662. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24663. * @returns {Array} Returns the slice of `array`.
  24664. * @example
  24665. *
  24666. * var users = [
  24667. * { 'user': 'barney', 'active': true },
  24668. * { 'user': 'fred', 'active': false },
  24669. * { 'user': 'pebbles', 'active': false }
  24670. * ];
  24671. *
  24672. * _.dropRightWhile(users, function(o) { return !o.active; });
  24673. * // => objects for ['barney']
  24674. *
  24675. * // The `_.matches` iteratee shorthand.
  24676. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24677. * // => objects for ['barney', 'fred']
  24678. *
  24679. * // The `_.matchesProperty` iteratee shorthand.
  24680. * _.dropRightWhile(users, ['active', false]);
  24681. * // => objects for ['barney']
  24682. *
  24683. * // The `_.property` iteratee shorthand.
  24684. * _.dropRightWhile(users, 'active');
  24685. * // => objects for ['barney', 'fred', 'pebbles']
  24686. */
  24687. function dropRightWhile(array, predicate) {
  24688. return (array && array.length)
  24689. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24690. : [];
  24691. }
  24692. /**
  24693. * Creates a slice of `array` excluding elements dropped from the beginning.
  24694. * Elements are dropped until `predicate` returns falsey. The predicate is
  24695. * invoked with three arguments: (value, index, array).
  24696. *
  24697. * @static
  24698. * @memberOf _
  24699. * @since 3.0.0
  24700. * @category Array
  24701. * @param {Array} array The array to query.
  24702. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24703. * @returns {Array} Returns the slice of `array`.
  24704. * @example
  24705. *
  24706. * var users = [
  24707. * { 'user': 'barney', 'active': false },
  24708. * { 'user': 'fred', 'active': false },
  24709. * { 'user': 'pebbles', 'active': true }
  24710. * ];
  24711. *
  24712. * _.dropWhile(users, function(o) { return !o.active; });
  24713. * // => objects for ['pebbles']
  24714. *
  24715. * // The `_.matches` iteratee shorthand.
  24716. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24717. * // => objects for ['fred', 'pebbles']
  24718. *
  24719. * // The `_.matchesProperty` iteratee shorthand.
  24720. * _.dropWhile(users, ['active', false]);
  24721. * // => objects for ['pebbles']
  24722. *
  24723. * // The `_.property` iteratee shorthand.
  24724. * _.dropWhile(users, 'active');
  24725. * // => objects for ['barney', 'fred', 'pebbles']
  24726. */
  24727. function dropWhile(array, predicate) {
  24728. return (array && array.length)
  24729. ? baseWhile(array, getIteratee(predicate, 3), true)
  24730. : [];
  24731. }
  24732. /**
  24733. * Fills elements of `array` with `value` from `start` up to, but not
  24734. * including, `end`.
  24735. *
  24736. * **Note:** This method mutates `array`.
  24737. *
  24738. * @static
  24739. * @memberOf _
  24740. * @since 3.2.0
  24741. * @category Array
  24742. * @param {Array} array The array to fill.
  24743. * @param {*} value The value to fill `array` with.
  24744. * @param {number} [start=0] The start position.
  24745. * @param {number} [end=array.length] The end position.
  24746. * @returns {Array} Returns `array`.
  24747. * @example
  24748. *
  24749. * var array = [1, 2, 3];
  24750. *
  24751. * _.fill(array, 'a');
  24752. * console.log(array);
  24753. * // => ['a', 'a', 'a']
  24754. *
  24755. * _.fill(Array(3), 2);
  24756. * // => [2, 2, 2]
  24757. *
  24758. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24759. * // => [4, '*', '*', 10]
  24760. */
  24761. function fill(array, value, start, end) {
  24762. var length = array == null ? 0 : array.length;
  24763. if (!length) {
  24764. return [];
  24765. }
  24766. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24767. start = 0;
  24768. end = length;
  24769. }
  24770. return baseFill(array, value, start, end);
  24771. }
  24772. /**
  24773. * This method is like `_.find` except that it returns the index of the first
  24774. * element `predicate` returns truthy for instead of the element itself.
  24775. *
  24776. * @static
  24777. * @memberOf _
  24778. * @since 1.1.0
  24779. * @category Array
  24780. * @param {Array} array The array to inspect.
  24781. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24782. * @param {number} [fromIndex=0] The index to search from.
  24783. * @returns {number} Returns the index of the found element, else `-1`.
  24784. * @example
  24785. *
  24786. * var users = [
  24787. * { 'user': 'barney', 'active': false },
  24788. * { 'user': 'fred', 'active': false },
  24789. * { 'user': 'pebbles', 'active': true }
  24790. * ];
  24791. *
  24792. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24793. * // => 0
  24794. *
  24795. * // The `_.matches` iteratee shorthand.
  24796. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24797. * // => 1
  24798. *
  24799. * // The `_.matchesProperty` iteratee shorthand.
  24800. * _.findIndex(users, ['active', false]);
  24801. * // => 0
  24802. *
  24803. * // The `_.property` iteratee shorthand.
  24804. * _.findIndex(users, 'active');
  24805. * // => 2
  24806. */
  24807. function findIndex(array, predicate, fromIndex) {
  24808. var length = array == null ? 0 : array.length;
  24809. if (!length) {
  24810. return -1;
  24811. }
  24812. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24813. if (index < 0) {
  24814. index = nativeMax(length + index, 0);
  24815. }
  24816. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24817. }
  24818. /**
  24819. * This method is like `_.findIndex` except that it iterates over elements
  24820. * of `collection` from right to left.
  24821. *
  24822. * @static
  24823. * @memberOf _
  24824. * @since 2.0.0
  24825. * @category Array
  24826. * @param {Array} array The array to inspect.
  24827. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24828. * @param {number} [fromIndex=array.length-1] The index to search from.
  24829. * @returns {number} Returns the index of the found element, else `-1`.
  24830. * @example
  24831. *
  24832. * var users = [
  24833. * { 'user': 'barney', 'active': true },
  24834. * { 'user': 'fred', 'active': false },
  24835. * { 'user': 'pebbles', 'active': false }
  24836. * ];
  24837. *
  24838. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24839. * // => 2
  24840. *
  24841. * // The `_.matches` iteratee shorthand.
  24842. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24843. * // => 0
  24844. *
  24845. * // The `_.matchesProperty` iteratee shorthand.
  24846. * _.findLastIndex(users, ['active', false]);
  24847. * // => 2
  24848. *
  24849. * // The `_.property` iteratee shorthand.
  24850. * _.findLastIndex(users, 'active');
  24851. * // => 0
  24852. */
  24853. function findLastIndex(array, predicate, fromIndex) {
  24854. var length = array == null ? 0 : array.length;
  24855. if (!length) {
  24856. return -1;
  24857. }
  24858. var index = length - 1;
  24859. if (fromIndex !== undefined) {
  24860. index = toInteger(fromIndex);
  24861. index = fromIndex < 0
  24862. ? nativeMax(length + index, 0)
  24863. : nativeMin(index, length - 1);
  24864. }
  24865. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24866. }
  24867. /**
  24868. * Flattens `array` a single level deep.
  24869. *
  24870. * @static
  24871. * @memberOf _
  24872. * @since 0.1.0
  24873. * @category Array
  24874. * @param {Array} array The array to flatten.
  24875. * @returns {Array} Returns the new flattened array.
  24876. * @example
  24877. *
  24878. * _.flatten([1, [2, [3, [4]], 5]]);
  24879. * // => [1, 2, [3, [4]], 5]
  24880. */
  24881. function flatten(array) {
  24882. var length = array == null ? 0 : array.length;
  24883. return length ? baseFlatten(array, 1) : [];
  24884. }
  24885. /**
  24886. * Recursively flattens `array`.
  24887. *
  24888. * @static
  24889. * @memberOf _
  24890. * @since 3.0.0
  24891. * @category Array
  24892. * @param {Array} array The array to flatten.
  24893. * @returns {Array} Returns the new flattened array.
  24894. * @example
  24895. *
  24896. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24897. * // => [1, 2, 3, 4, 5]
  24898. */
  24899. function flattenDeep(array) {
  24900. var length = array == null ? 0 : array.length;
  24901. return length ? baseFlatten(array, INFINITY) : [];
  24902. }
  24903. /**
  24904. * Recursively flatten `array` up to `depth` times.
  24905. *
  24906. * @static
  24907. * @memberOf _
  24908. * @since 4.4.0
  24909. * @category Array
  24910. * @param {Array} array The array to flatten.
  24911. * @param {number} [depth=1] The maximum recursion depth.
  24912. * @returns {Array} Returns the new flattened array.
  24913. * @example
  24914. *
  24915. * var array = [1, [2, [3, [4]], 5]];
  24916. *
  24917. * _.flattenDepth(array, 1);
  24918. * // => [1, 2, [3, [4]], 5]
  24919. *
  24920. * _.flattenDepth(array, 2);
  24921. * // => [1, 2, 3, [4], 5]
  24922. */
  24923. function flattenDepth(array, depth) {
  24924. var length = array == null ? 0 : array.length;
  24925. if (!length) {
  24926. return [];
  24927. }
  24928. depth = depth === undefined ? 1 : toInteger(depth);
  24929. return baseFlatten(array, depth);
  24930. }
  24931. /**
  24932. * The inverse of `_.toPairs`; this method returns an object composed
  24933. * from key-value `pairs`.
  24934. *
  24935. * @static
  24936. * @memberOf _
  24937. * @since 4.0.0
  24938. * @category Array
  24939. * @param {Array} pairs The key-value pairs.
  24940. * @returns {Object} Returns the new object.
  24941. * @example
  24942. *
  24943. * _.fromPairs([['a', 1], ['b', 2]]);
  24944. * // => { 'a': 1, 'b': 2 }
  24945. */
  24946. function fromPairs(pairs) {
  24947. var index = -1,
  24948. length = pairs == null ? 0 : pairs.length,
  24949. result = {};
  24950. while (++index < length) {
  24951. var pair = pairs[index];
  24952. result[pair[0]] = pair[1];
  24953. }
  24954. return result;
  24955. }
  24956. /**
  24957. * Gets the first element of `array`.
  24958. *
  24959. * @static
  24960. * @memberOf _
  24961. * @since 0.1.0
  24962. * @alias first
  24963. * @category Array
  24964. * @param {Array} array The array to query.
  24965. * @returns {*} Returns the first element of `array`.
  24966. * @example
  24967. *
  24968. * _.head([1, 2, 3]);
  24969. * // => 1
  24970. *
  24971. * _.head([]);
  24972. * // => undefined
  24973. */
  24974. function head(array) {
  24975. return (array && array.length) ? array[0] : undefined;
  24976. }
  24977. /**
  24978. * Gets the index at which the first occurrence of `value` is found in `array`
  24979. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24980. * for equality comparisons. If `fromIndex` is negative, it's used as the
  24981. * offset from the end of `array`.
  24982. *
  24983. * @static
  24984. * @memberOf _
  24985. * @since 0.1.0
  24986. * @category Array
  24987. * @param {Array} array The array to inspect.
  24988. * @param {*} value The value to search for.
  24989. * @param {number} [fromIndex=0] The index to search from.
  24990. * @returns {number} Returns the index of the matched value, else `-1`.
  24991. * @example
  24992. *
  24993. * _.indexOf([1, 2, 1, 2], 2);
  24994. * // => 1
  24995. *
  24996. * // Search from the `fromIndex`.
  24997. * _.indexOf([1, 2, 1, 2], 2, 2);
  24998. * // => 3
  24999. */
  25000. function indexOf(array, value, fromIndex) {
  25001. var length = array == null ? 0 : array.length;
  25002. if (!length) {
  25003. return -1;
  25004. }
  25005. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25006. if (index < 0) {
  25007. index = nativeMax(length + index, 0);
  25008. }
  25009. return baseIndexOf(array, value, index);
  25010. }
  25011. /**
  25012. * Gets all but the last element of `array`.
  25013. *
  25014. * @static
  25015. * @memberOf _
  25016. * @since 0.1.0
  25017. * @category Array
  25018. * @param {Array} array The array to query.
  25019. * @returns {Array} Returns the slice of `array`.
  25020. * @example
  25021. *
  25022. * _.initial([1, 2, 3]);
  25023. * // => [1, 2]
  25024. */
  25025. function initial(array) {
  25026. var length = array == null ? 0 : array.length;
  25027. return length ? baseSlice(array, 0, -1) : [];
  25028. }
  25029. /**
  25030. * Creates an array of unique values that are included in all given arrays
  25031. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25032. * for equality comparisons. The order and references of result values are
  25033. * determined by the first array.
  25034. *
  25035. * @static
  25036. * @memberOf _
  25037. * @since 0.1.0
  25038. * @category Array
  25039. * @param {...Array} [arrays] The arrays to inspect.
  25040. * @returns {Array} Returns the new array of intersecting values.
  25041. * @example
  25042. *
  25043. * _.intersection([2, 1], [2, 3]);
  25044. * // => [2]
  25045. */
  25046. var intersection = baseRest(function(arrays) {
  25047. var mapped = arrayMap(arrays, castArrayLikeObject);
  25048. return (mapped.length && mapped[0] === arrays[0])
  25049. ? baseIntersection(mapped)
  25050. : [];
  25051. });
  25052. /**
  25053. * This method is like `_.intersection` except that it accepts `iteratee`
  25054. * which is invoked for each element of each `arrays` to generate the criterion
  25055. * by which they're compared. The order and references of result values are
  25056. * determined by the first array. The iteratee is invoked with one argument:
  25057. * (value).
  25058. *
  25059. * @static
  25060. * @memberOf _
  25061. * @since 4.0.0
  25062. * @category Array
  25063. * @param {...Array} [arrays] The arrays to inspect.
  25064. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25065. * @returns {Array} Returns the new array of intersecting values.
  25066. * @example
  25067. *
  25068. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25069. * // => [2.1]
  25070. *
  25071. * // The `_.property` iteratee shorthand.
  25072. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25073. * // => [{ 'x': 1 }]
  25074. */
  25075. var intersectionBy = baseRest(function(arrays) {
  25076. var iteratee = last(arrays),
  25077. mapped = arrayMap(arrays, castArrayLikeObject);
  25078. if (iteratee === last(mapped)) {
  25079. iteratee = undefined;
  25080. } else {
  25081. mapped.pop();
  25082. }
  25083. return (mapped.length && mapped[0] === arrays[0])
  25084. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25085. : [];
  25086. });
  25087. /**
  25088. * This method is like `_.intersection` except that it accepts `comparator`
  25089. * which is invoked to compare elements of `arrays`. The order and references
  25090. * of result values are determined by the first array. The comparator is
  25091. * invoked with two arguments: (arrVal, othVal).
  25092. *
  25093. * @static
  25094. * @memberOf _
  25095. * @since 4.0.0
  25096. * @category Array
  25097. * @param {...Array} [arrays] The arrays to inspect.
  25098. * @param {Function} [comparator] The comparator invoked per element.
  25099. * @returns {Array} Returns the new array of intersecting values.
  25100. * @example
  25101. *
  25102. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25103. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25104. *
  25105. * _.intersectionWith(objects, others, _.isEqual);
  25106. * // => [{ 'x': 1, 'y': 2 }]
  25107. */
  25108. var intersectionWith = baseRest(function(arrays) {
  25109. var comparator = last(arrays),
  25110. mapped = arrayMap(arrays, castArrayLikeObject);
  25111. comparator = typeof comparator == 'function' ? comparator : undefined;
  25112. if (comparator) {
  25113. mapped.pop();
  25114. }
  25115. return (mapped.length && mapped[0] === arrays[0])
  25116. ? baseIntersection(mapped, undefined, comparator)
  25117. : [];
  25118. });
  25119. /**
  25120. * Converts all elements in `array` into a string separated by `separator`.
  25121. *
  25122. * @static
  25123. * @memberOf _
  25124. * @since 4.0.0
  25125. * @category Array
  25126. * @param {Array} array The array to convert.
  25127. * @param {string} [separator=','] The element separator.
  25128. * @returns {string} Returns the joined string.
  25129. * @example
  25130. *
  25131. * _.join(['a', 'b', 'c'], '~');
  25132. * // => 'a~b~c'
  25133. */
  25134. function join(array, separator) {
  25135. return array == null ? '' : nativeJoin.call(array, separator);
  25136. }
  25137. /**
  25138. * Gets the last element of `array`.
  25139. *
  25140. * @static
  25141. * @memberOf _
  25142. * @since 0.1.0
  25143. * @category Array
  25144. * @param {Array} array The array to query.
  25145. * @returns {*} Returns the last element of `array`.
  25146. * @example
  25147. *
  25148. * _.last([1, 2, 3]);
  25149. * // => 3
  25150. */
  25151. function last(array) {
  25152. var length = array == null ? 0 : array.length;
  25153. return length ? array[length - 1] : undefined;
  25154. }
  25155. /**
  25156. * This method is like `_.indexOf` except that it iterates over elements of
  25157. * `array` from right to left.
  25158. *
  25159. * @static
  25160. * @memberOf _
  25161. * @since 0.1.0
  25162. * @category Array
  25163. * @param {Array} array The array to inspect.
  25164. * @param {*} value The value to search for.
  25165. * @param {number} [fromIndex=array.length-1] The index to search from.
  25166. * @returns {number} Returns the index of the matched value, else `-1`.
  25167. * @example
  25168. *
  25169. * _.lastIndexOf([1, 2, 1, 2], 2);
  25170. * // => 3
  25171. *
  25172. * // Search from the `fromIndex`.
  25173. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25174. * // => 1
  25175. */
  25176. function lastIndexOf(array, value, fromIndex) {
  25177. var length = array == null ? 0 : array.length;
  25178. if (!length) {
  25179. return -1;
  25180. }
  25181. var index = length;
  25182. if (fromIndex !== undefined) {
  25183. index = toInteger(fromIndex);
  25184. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25185. }
  25186. return value === value
  25187. ? strictLastIndexOf(array, value, index)
  25188. : baseFindIndex(array, baseIsNaN, index, true);
  25189. }
  25190. /**
  25191. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25192. * element from the end is returned.
  25193. *
  25194. * @static
  25195. * @memberOf _
  25196. * @since 4.11.0
  25197. * @category Array
  25198. * @param {Array} array The array to query.
  25199. * @param {number} [n=0] The index of the element to return.
  25200. * @returns {*} Returns the nth element of `array`.
  25201. * @example
  25202. *
  25203. * var array = ['a', 'b', 'c', 'd'];
  25204. *
  25205. * _.nth(array, 1);
  25206. * // => 'b'
  25207. *
  25208. * _.nth(array, -2);
  25209. * // => 'c';
  25210. */
  25211. function nth(array, n) {
  25212. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25213. }
  25214. /**
  25215. * Removes all given values from `array` using
  25216. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25217. * for equality comparisons.
  25218. *
  25219. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25220. * to remove elements from an array by predicate.
  25221. *
  25222. * @static
  25223. * @memberOf _
  25224. * @since 2.0.0
  25225. * @category Array
  25226. * @param {Array} array The array to modify.
  25227. * @param {...*} [values] The values to remove.
  25228. * @returns {Array} Returns `array`.
  25229. * @example
  25230. *
  25231. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25232. *
  25233. * _.pull(array, 'a', 'c');
  25234. * console.log(array);
  25235. * // => ['b', 'b']
  25236. */
  25237. var pull = baseRest(pullAll);
  25238. /**
  25239. * This method is like `_.pull` except that it accepts an array of values to remove.
  25240. *
  25241. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25242. *
  25243. * @static
  25244. * @memberOf _
  25245. * @since 4.0.0
  25246. * @category Array
  25247. * @param {Array} array The array to modify.
  25248. * @param {Array} values The values to remove.
  25249. * @returns {Array} Returns `array`.
  25250. * @example
  25251. *
  25252. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25253. *
  25254. * _.pullAll(array, ['a', 'c']);
  25255. * console.log(array);
  25256. * // => ['b', 'b']
  25257. */
  25258. function pullAll(array, values) {
  25259. return (array && array.length && values && values.length)
  25260. ? basePullAll(array, values)
  25261. : array;
  25262. }
  25263. /**
  25264. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25265. * invoked for each element of `array` and `values` to generate the criterion
  25266. * by which they're compared. The iteratee is invoked with one argument: (value).
  25267. *
  25268. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25269. *
  25270. * @static
  25271. * @memberOf _
  25272. * @since 4.0.0
  25273. * @category Array
  25274. * @param {Array} array The array to modify.
  25275. * @param {Array} values The values to remove.
  25276. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25277. * @returns {Array} Returns `array`.
  25278. * @example
  25279. *
  25280. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25281. *
  25282. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25283. * console.log(array);
  25284. * // => [{ 'x': 2 }]
  25285. */
  25286. function pullAllBy(array, values, iteratee) {
  25287. return (array && array.length && values && values.length)
  25288. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25289. : array;
  25290. }
  25291. /**
  25292. * This method is like `_.pullAll` except that it accepts `comparator` which
  25293. * is invoked to compare elements of `array` to `values`. The comparator is
  25294. * invoked with two arguments: (arrVal, othVal).
  25295. *
  25296. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25297. *
  25298. * @static
  25299. * @memberOf _
  25300. * @since 4.6.0
  25301. * @category Array
  25302. * @param {Array} array The array to modify.
  25303. * @param {Array} values The values to remove.
  25304. * @param {Function} [comparator] The comparator invoked per element.
  25305. * @returns {Array} Returns `array`.
  25306. * @example
  25307. *
  25308. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25309. *
  25310. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25311. * console.log(array);
  25312. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25313. */
  25314. function pullAllWith(array, values, comparator) {
  25315. return (array && array.length && values && values.length)
  25316. ? basePullAll(array, values, undefined, comparator)
  25317. : array;
  25318. }
  25319. /**
  25320. * Removes elements from `array` corresponding to `indexes` and returns an
  25321. * array of removed elements.
  25322. *
  25323. * **Note:** Unlike `_.at`, this method mutates `array`.
  25324. *
  25325. * @static
  25326. * @memberOf _
  25327. * @since 3.0.0
  25328. * @category Array
  25329. * @param {Array} array The array to modify.
  25330. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25331. * @returns {Array} Returns the new array of removed elements.
  25332. * @example
  25333. *
  25334. * var array = ['a', 'b', 'c', 'd'];
  25335. * var pulled = _.pullAt(array, [1, 3]);
  25336. *
  25337. * console.log(array);
  25338. * // => ['a', 'c']
  25339. *
  25340. * console.log(pulled);
  25341. * // => ['b', 'd']
  25342. */
  25343. var pullAt = flatRest(function(array, indexes) {
  25344. var length = array == null ? 0 : array.length,
  25345. result = baseAt(array, indexes);
  25346. basePullAt(array, arrayMap(indexes, function(index) {
  25347. return isIndex(index, length) ? +index : index;
  25348. }).sort(compareAscending));
  25349. return result;
  25350. });
  25351. /**
  25352. * Removes all elements from `array` that `predicate` returns truthy for
  25353. * and returns an array of the removed elements. The predicate is invoked
  25354. * with three arguments: (value, index, array).
  25355. *
  25356. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25357. * to pull elements from an array by value.
  25358. *
  25359. * @static
  25360. * @memberOf _
  25361. * @since 2.0.0
  25362. * @category Array
  25363. * @param {Array} array The array to modify.
  25364. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25365. * @returns {Array} Returns the new array of removed elements.
  25366. * @example
  25367. *
  25368. * var array = [1, 2, 3, 4];
  25369. * var evens = _.remove(array, function(n) {
  25370. * return n % 2 == 0;
  25371. * });
  25372. *
  25373. * console.log(array);
  25374. * // => [1, 3]
  25375. *
  25376. * console.log(evens);
  25377. * // => [2, 4]
  25378. */
  25379. function remove(array, predicate) {
  25380. var result = [];
  25381. if (!(array && array.length)) {
  25382. return result;
  25383. }
  25384. var index = -1,
  25385. indexes = [],
  25386. length = array.length;
  25387. predicate = getIteratee(predicate, 3);
  25388. while (++index < length) {
  25389. var value = array[index];
  25390. if (predicate(value, index, array)) {
  25391. result.push(value);
  25392. indexes.push(index);
  25393. }
  25394. }
  25395. basePullAt(array, indexes);
  25396. return result;
  25397. }
  25398. /**
  25399. * Reverses `array` so that the first element becomes the last, the second
  25400. * element becomes the second to last, and so on.
  25401. *
  25402. * **Note:** This method mutates `array` and is based on
  25403. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25404. *
  25405. * @static
  25406. * @memberOf _
  25407. * @since 4.0.0
  25408. * @category Array
  25409. * @param {Array} array The array to modify.
  25410. * @returns {Array} Returns `array`.
  25411. * @example
  25412. *
  25413. * var array = [1, 2, 3];
  25414. *
  25415. * _.reverse(array);
  25416. * // => [3, 2, 1]
  25417. *
  25418. * console.log(array);
  25419. * // => [3, 2, 1]
  25420. */
  25421. function reverse(array) {
  25422. return array == null ? array : nativeReverse.call(array);
  25423. }
  25424. /**
  25425. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25426. *
  25427. * **Note:** This method is used instead of
  25428. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25429. * returned.
  25430. *
  25431. * @static
  25432. * @memberOf _
  25433. * @since 3.0.0
  25434. * @category Array
  25435. * @param {Array} array The array to slice.
  25436. * @param {number} [start=0] The start position.
  25437. * @param {number} [end=array.length] The end position.
  25438. * @returns {Array} Returns the slice of `array`.
  25439. */
  25440. function slice(array, start, end) {
  25441. var length = array == null ? 0 : array.length;
  25442. if (!length) {
  25443. return [];
  25444. }
  25445. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25446. start = 0;
  25447. end = length;
  25448. }
  25449. else {
  25450. start = start == null ? 0 : toInteger(start);
  25451. end = end === undefined ? length : toInteger(end);
  25452. }
  25453. return baseSlice(array, start, end);
  25454. }
  25455. /**
  25456. * Uses a binary search to determine the lowest index at which `value`
  25457. * should be inserted into `array` in order to maintain its sort order.
  25458. *
  25459. * @static
  25460. * @memberOf _
  25461. * @since 0.1.0
  25462. * @category Array
  25463. * @param {Array} array The sorted array to inspect.
  25464. * @param {*} value The value to evaluate.
  25465. * @returns {number} Returns the index at which `value` should be inserted
  25466. * into `array`.
  25467. * @example
  25468. *
  25469. * _.sortedIndex([30, 50], 40);
  25470. * // => 1
  25471. */
  25472. function sortedIndex(array, value) {
  25473. return baseSortedIndex(array, value);
  25474. }
  25475. /**
  25476. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25477. * which is invoked for `value` and each element of `array` to compute their
  25478. * sort ranking. The iteratee is invoked with one argument: (value).
  25479. *
  25480. * @static
  25481. * @memberOf _
  25482. * @since 4.0.0
  25483. * @category Array
  25484. * @param {Array} array The sorted array to inspect.
  25485. * @param {*} value The value to evaluate.
  25486. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25487. * @returns {number} Returns the index at which `value` should be inserted
  25488. * into `array`.
  25489. * @example
  25490. *
  25491. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25492. *
  25493. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25494. * // => 0
  25495. *
  25496. * // The `_.property` iteratee shorthand.
  25497. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25498. * // => 0
  25499. */
  25500. function sortedIndexBy(array, value, iteratee) {
  25501. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25502. }
  25503. /**
  25504. * This method is like `_.indexOf` except that it performs a binary
  25505. * search on a sorted `array`.
  25506. *
  25507. * @static
  25508. * @memberOf _
  25509. * @since 4.0.0
  25510. * @category Array
  25511. * @param {Array} array The array to inspect.
  25512. * @param {*} value The value to search for.
  25513. * @returns {number} Returns the index of the matched value, else `-1`.
  25514. * @example
  25515. *
  25516. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25517. * // => 1
  25518. */
  25519. function sortedIndexOf(array, value) {
  25520. var length = array == null ? 0 : array.length;
  25521. if (length) {
  25522. var index = baseSortedIndex(array, value);
  25523. if (index < length && eq(array[index], value)) {
  25524. return index;
  25525. }
  25526. }
  25527. return -1;
  25528. }
  25529. /**
  25530. * This method is like `_.sortedIndex` except that it returns the highest
  25531. * index at which `value` should be inserted into `array` in order to
  25532. * maintain its sort order.
  25533. *
  25534. * @static
  25535. * @memberOf _
  25536. * @since 3.0.0
  25537. * @category Array
  25538. * @param {Array} array The sorted array to inspect.
  25539. * @param {*} value The value to evaluate.
  25540. * @returns {number} Returns the index at which `value` should be inserted
  25541. * into `array`.
  25542. * @example
  25543. *
  25544. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25545. * // => 4
  25546. */
  25547. function sortedLastIndex(array, value) {
  25548. return baseSortedIndex(array, value, true);
  25549. }
  25550. /**
  25551. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25552. * which is invoked for `value` and each element of `array` to compute their
  25553. * sort ranking. The iteratee is invoked with one argument: (value).
  25554. *
  25555. * @static
  25556. * @memberOf _
  25557. * @since 4.0.0
  25558. * @category Array
  25559. * @param {Array} array The sorted array to inspect.
  25560. * @param {*} value The value to evaluate.
  25561. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25562. * @returns {number} Returns the index at which `value` should be inserted
  25563. * into `array`.
  25564. * @example
  25565. *
  25566. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25567. *
  25568. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25569. * // => 1
  25570. *
  25571. * // The `_.property` iteratee shorthand.
  25572. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25573. * // => 1
  25574. */
  25575. function sortedLastIndexBy(array, value, iteratee) {
  25576. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25577. }
  25578. /**
  25579. * This method is like `_.lastIndexOf` except that it performs a binary
  25580. * search on a sorted `array`.
  25581. *
  25582. * @static
  25583. * @memberOf _
  25584. * @since 4.0.0
  25585. * @category Array
  25586. * @param {Array} array The array to inspect.
  25587. * @param {*} value The value to search for.
  25588. * @returns {number} Returns the index of the matched value, else `-1`.
  25589. * @example
  25590. *
  25591. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25592. * // => 3
  25593. */
  25594. function sortedLastIndexOf(array, value) {
  25595. var length = array == null ? 0 : array.length;
  25596. if (length) {
  25597. var index = baseSortedIndex(array, value, true) - 1;
  25598. if (eq(array[index], value)) {
  25599. return index;
  25600. }
  25601. }
  25602. return -1;
  25603. }
  25604. /**
  25605. * This method is like `_.uniq` except that it's designed and optimized
  25606. * for sorted arrays.
  25607. *
  25608. * @static
  25609. * @memberOf _
  25610. * @since 4.0.0
  25611. * @category Array
  25612. * @param {Array} array The array to inspect.
  25613. * @returns {Array} Returns the new duplicate free array.
  25614. * @example
  25615. *
  25616. * _.sortedUniq([1, 1, 2]);
  25617. * // => [1, 2]
  25618. */
  25619. function sortedUniq(array) {
  25620. return (array && array.length)
  25621. ? baseSortedUniq(array)
  25622. : [];
  25623. }
  25624. /**
  25625. * This method is like `_.uniqBy` except that it's designed and optimized
  25626. * for sorted arrays.
  25627. *
  25628. * @static
  25629. * @memberOf _
  25630. * @since 4.0.0
  25631. * @category Array
  25632. * @param {Array} array The array to inspect.
  25633. * @param {Function} [iteratee] The iteratee invoked per element.
  25634. * @returns {Array} Returns the new duplicate free array.
  25635. * @example
  25636. *
  25637. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25638. * // => [1.1, 2.3]
  25639. */
  25640. function sortedUniqBy(array, iteratee) {
  25641. return (array && array.length)
  25642. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25643. : [];
  25644. }
  25645. /**
  25646. * Gets all but the first element of `array`.
  25647. *
  25648. * @static
  25649. * @memberOf _
  25650. * @since 4.0.0
  25651. * @category Array
  25652. * @param {Array} array The array to query.
  25653. * @returns {Array} Returns the slice of `array`.
  25654. * @example
  25655. *
  25656. * _.tail([1, 2, 3]);
  25657. * // => [2, 3]
  25658. */
  25659. function tail(array) {
  25660. var length = array == null ? 0 : array.length;
  25661. return length ? baseSlice(array, 1, length) : [];
  25662. }
  25663. /**
  25664. * Creates a slice of `array` with `n` elements taken from the beginning.
  25665. *
  25666. * @static
  25667. * @memberOf _
  25668. * @since 0.1.0
  25669. * @category Array
  25670. * @param {Array} array The array to query.
  25671. * @param {number} [n=1] The number of elements to take.
  25672. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25673. * @returns {Array} Returns the slice of `array`.
  25674. * @example
  25675. *
  25676. * _.take([1, 2, 3]);
  25677. * // => [1]
  25678. *
  25679. * _.take([1, 2, 3], 2);
  25680. * // => [1, 2]
  25681. *
  25682. * _.take([1, 2, 3], 5);
  25683. * // => [1, 2, 3]
  25684. *
  25685. * _.take([1, 2, 3], 0);
  25686. * // => []
  25687. */
  25688. function take(array, n, guard) {
  25689. if (!(array && array.length)) {
  25690. return [];
  25691. }
  25692. n = (guard || n === undefined) ? 1 : toInteger(n);
  25693. return baseSlice(array, 0, n < 0 ? 0 : n);
  25694. }
  25695. /**
  25696. * Creates a slice of `array` with `n` elements taken from the end.
  25697. *
  25698. * @static
  25699. * @memberOf _
  25700. * @since 3.0.0
  25701. * @category Array
  25702. * @param {Array} array The array to query.
  25703. * @param {number} [n=1] The number of elements to take.
  25704. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25705. * @returns {Array} Returns the slice of `array`.
  25706. * @example
  25707. *
  25708. * _.takeRight([1, 2, 3]);
  25709. * // => [3]
  25710. *
  25711. * _.takeRight([1, 2, 3], 2);
  25712. * // => [2, 3]
  25713. *
  25714. * _.takeRight([1, 2, 3], 5);
  25715. * // => [1, 2, 3]
  25716. *
  25717. * _.takeRight([1, 2, 3], 0);
  25718. * // => []
  25719. */
  25720. function takeRight(array, n, guard) {
  25721. var length = array == null ? 0 : array.length;
  25722. if (!length) {
  25723. return [];
  25724. }
  25725. n = (guard || n === undefined) ? 1 : toInteger(n);
  25726. n = length - n;
  25727. return baseSlice(array, n < 0 ? 0 : n, length);
  25728. }
  25729. /**
  25730. * Creates a slice of `array` with elements taken from the end. Elements are
  25731. * taken until `predicate` returns falsey. The predicate is invoked with
  25732. * three arguments: (value, index, array).
  25733. *
  25734. * @static
  25735. * @memberOf _
  25736. * @since 3.0.0
  25737. * @category Array
  25738. * @param {Array} array The array to query.
  25739. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25740. * @returns {Array} Returns the slice of `array`.
  25741. * @example
  25742. *
  25743. * var users = [
  25744. * { 'user': 'barney', 'active': true },
  25745. * { 'user': 'fred', 'active': false },
  25746. * { 'user': 'pebbles', 'active': false }
  25747. * ];
  25748. *
  25749. * _.takeRightWhile(users, function(o) { return !o.active; });
  25750. * // => objects for ['fred', 'pebbles']
  25751. *
  25752. * // The `_.matches` iteratee shorthand.
  25753. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25754. * // => objects for ['pebbles']
  25755. *
  25756. * // The `_.matchesProperty` iteratee shorthand.
  25757. * _.takeRightWhile(users, ['active', false]);
  25758. * // => objects for ['fred', 'pebbles']
  25759. *
  25760. * // The `_.property` iteratee shorthand.
  25761. * _.takeRightWhile(users, 'active');
  25762. * // => []
  25763. */
  25764. function takeRightWhile(array, predicate) {
  25765. return (array && array.length)
  25766. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25767. : [];
  25768. }
  25769. /**
  25770. * Creates a slice of `array` with elements taken from the beginning. Elements
  25771. * are taken until `predicate` returns falsey. The predicate is invoked with
  25772. * three arguments: (value, index, array).
  25773. *
  25774. * @static
  25775. * @memberOf _
  25776. * @since 3.0.0
  25777. * @category Array
  25778. * @param {Array} array The array to query.
  25779. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25780. * @returns {Array} Returns the slice of `array`.
  25781. * @example
  25782. *
  25783. * var users = [
  25784. * { 'user': 'barney', 'active': false },
  25785. * { 'user': 'fred', 'active': false },
  25786. * { 'user': 'pebbles', 'active': true }
  25787. * ];
  25788. *
  25789. * _.takeWhile(users, function(o) { return !o.active; });
  25790. * // => objects for ['barney', 'fred']
  25791. *
  25792. * // The `_.matches` iteratee shorthand.
  25793. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25794. * // => objects for ['barney']
  25795. *
  25796. * // The `_.matchesProperty` iteratee shorthand.
  25797. * _.takeWhile(users, ['active', false]);
  25798. * // => objects for ['barney', 'fred']
  25799. *
  25800. * // The `_.property` iteratee shorthand.
  25801. * _.takeWhile(users, 'active');
  25802. * // => []
  25803. */
  25804. function takeWhile(array, predicate) {
  25805. return (array && array.length)
  25806. ? baseWhile(array, getIteratee(predicate, 3))
  25807. : [];
  25808. }
  25809. /**
  25810. * Creates an array of unique values, in order, from all given arrays using
  25811. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25812. * for equality comparisons.
  25813. *
  25814. * @static
  25815. * @memberOf _
  25816. * @since 0.1.0
  25817. * @category Array
  25818. * @param {...Array} [arrays] The arrays to inspect.
  25819. * @returns {Array} Returns the new array of combined values.
  25820. * @example
  25821. *
  25822. * _.union([2], [1, 2]);
  25823. * // => [2, 1]
  25824. */
  25825. var union = baseRest(function(arrays) {
  25826. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25827. });
  25828. /**
  25829. * This method is like `_.union` except that it accepts `iteratee` which is
  25830. * invoked for each element of each `arrays` to generate the criterion by
  25831. * which uniqueness is computed. Result values are chosen from the first
  25832. * array in which the value occurs. The iteratee is invoked with one argument:
  25833. * (value).
  25834. *
  25835. * @static
  25836. * @memberOf _
  25837. * @since 4.0.0
  25838. * @category Array
  25839. * @param {...Array} [arrays] The arrays to inspect.
  25840. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25841. * @returns {Array} Returns the new array of combined values.
  25842. * @example
  25843. *
  25844. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25845. * // => [2.1, 1.2]
  25846. *
  25847. * // The `_.property` iteratee shorthand.
  25848. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25849. * // => [{ 'x': 1 }, { 'x': 2 }]
  25850. */
  25851. var unionBy = baseRest(function(arrays) {
  25852. var iteratee = last(arrays);
  25853. if (isArrayLikeObject(iteratee)) {
  25854. iteratee = undefined;
  25855. }
  25856. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25857. });
  25858. /**
  25859. * This method is like `_.union` except that it accepts `comparator` which
  25860. * is invoked to compare elements of `arrays`. Result values are chosen from
  25861. * the first array in which the value occurs. The comparator is invoked
  25862. * with two arguments: (arrVal, othVal).
  25863. *
  25864. * @static
  25865. * @memberOf _
  25866. * @since 4.0.0
  25867. * @category Array
  25868. * @param {...Array} [arrays] The arrays to inspect.
  25869. * @param {Function} [comparator] The comparator invoked per element.
  25870. * @returns {Array} Returns the new array of combined values.
  25871. * @example
  25872. *
  25873. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25874. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25875. *
  25876. * _.unionWith(objects, others, _.isEqual);
  25877. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25878. */
  25879. var unionWith = baseRest(function(arrays) {
  25880. var comparator = last(arrays);
  25881. comparator = typeof comparator == 'function' ? comparator : undefined;
  25882. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25883. });
  25884. /**
  25885. * Creates a duplicate-free version of an array, using
  25886. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25887. * for equality comparisons, in which only the first occurrence of each element
  25888. * is kept. The order of result values is determined by the order they occur
  25889. * in the array.
  25890. *
  25891. * @static
  25892. * @memberOf _
  25893. * @since 0.1.0
  25894. * @category Array
  25895. * @param {Array} array The array to inspect.
  25896. * @returns {Array} Returns the new duplicate free array.
  25897. * @example
  25898. *
  25899. * _.uniq([2, 1, 2]);
  25900. * // => [2, 1]
  25901. */
  25902. function uniq(array) {
  25903. return (array && array.length) ? baseUniq(array) : [];
  25904. }
  25905. /**
  25906. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25907. * invoked for each element in `array` to generate the criterion by which
  25908. * uniqueness is computed. The order of result values is determined by the
  25909. * order they occur in the array. The iteratee is invoked with one argument:
  25910. * (value).
  25911. *
  25912. * @static
  25913. * @memberOf _
  25914. * @since 4.0.0
  25915. * @category Array
  25916. * @param {Array} array The array to inspect.
  25917. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25918. * @returns {Array} Returns the new duplicate free array.
  25919. * @example
  25920. *
  25921. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  25922. * // => [2.1, 1.2]
  25923. *
  25924. * // The `_.property` iteratee shorthand.
  25925. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  25926. * // => [{ 'x': 1 }, { 'x': 2 }]
  25927. */
  25928. function uniqBy(array, iteratee) {
  25929. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  25930. }
  25931. /**
  25932. * This method is like `_.uniq` except that it accepts `comparator` which
  25933. * is invoked to compare elements of `array`. The order of result values is
  25934. * determined by the order they occur in the array.The comparator is invoked
  25935. * with two arguments: (arrVal, othVal).
  25936. *
  25937. * @static
  25938. * @memberOf _
  25939. * @since 4.0.0
  25940. * @category Array
  25941. * @param {Array} array The array to inspect.
  25942. * @param {Function} [comparator] The comparator invoked per element.
  25943. * @returns {Array} Returns the new duplicate free array.
  25944. * @example
  25945. *
  25946. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25947. *
  25948. * _.uniqWith(objects, _.isEqual);
  25949. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  25950. */
  25951. function uniqWith(array, comparator) {
  25952. comparator = typeof comparator == 'function' ? comparator : undefined;
  25953. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  25954. }
  25955. /**
  25956. * This method is like `_.zip` except that it accepts an array of grouped
  25957. * elements and creates an array regrouping the elements to their pre-zip
  25958. * configuration.
  25959. *
  25960. * @static
  25961. * @memberOf _
  25962. * @since 1.2.0
  25963. * @category Array
  25964. * @param {Array} array The array of grouped elements to process.
  25965. * @returns {Array} Returns the new array of regrouped elements.
  25966. * @example
  25967. *
  25968. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  25969. * // => [['a', 1, true], ['b', 2, false]]
  25970. *
  25971. * _.unzip(zipped);
  25972. * // => [['a', 'b'], [1, 2], [true, false]]
  25973. */
  25974. function unzip(array) {
  25975. if (!(array && array.length)) {
  25976. return [];
  25977. }
  25978. var length = 0;
  25979. array = arrayFilter(array, function(group) {
  25980. if (isArrayLikeObject(group)) {
  25981. length = nativeMax(group.length, length);
  25982. return true;
  25983. }
  25984. });
  25985. return baseTimes(length, function(index) {
  25986. return arrayMap(array, baseProperty(index));
  25987. });
  25988. }
  25989. /**
  25990. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  25991. * how regrouped values should be combined. The iteratee is invoked with the
  25992. * elements of each group: (...group).
  25993. *
  25994. * @static
  25995. * @memberOf _
  25996. * @since 3.8.0
  25997. * @category Array
  25998. * @param {Array} array The array of grouped elements to process.
  25999. * @param {Function} [iteratee=_.identity] The function to combine
  26000. * regrouped values.
  26001. * @returns {Array} Returns the new array of regrouped elements.
  26002. * @example
  26003. *
  26004. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26005. * // => [[1, 10, 100], [2, 20, 200]]
  26006. *
  26007. * _.unzipWith(zipped, _.add);
  26008. * // => [3, 30, 300]
  26009. */
  26010. function unzipWith(array, iteratee) {
  26011. if (!(array && array.length)) {
  26012. return [];
  26013. }
  26014. var result = unzip(array);
  26015. if (iteratee == null) {
  26016. return result;
  26017. }
  26018. return arrayMap(result, function(group) {
  26019. return apply(iteratee, undefined, group);
  26020. });
  26021. }
  26022. /**
  26023. * Creates an array excluding all given values using
  26024. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26025. * for equality comparisons.
  26026. *
  26027. * **Note:** Unlike `_.pull`, this method returns a new array.
  26028. *
  26029. * @static
  26030. * @memberOf _
  26031. * @since 0.1.0
  26032. * @category Array
  26033. * @param {Array} array The array to inspect.
  26034. * @param {...*} [values] The values to exclude.
  26035. * @returns {Array} Returns the new array of filtered values.
  26036. * @see _.difference, _.xor
  26037. * @example
  26038. *
  26039. * _.without([2, 1, 2, 3], 1, 2);
  26040. * // => [3]
  26041. */
  26042. var without = baseRest(function(array, values) {
  26043. return isArrayLikeObject(array)
  26044. ? baseDifference(array, values)
  26045. : [];
  26046. });
  26047. /**
  26048. * Creates an array of unique values that is the
  26049. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26050. * of the given arrays. The order of result values is determined by the order
  26051. * they occur in the arrays.
  26052. *
  26053. * @static
  26054. * @memberOf _
  26055. * @since 2.4.0
  26056. * @category Array
  26057. * @param {...Array} [arrays] The arrays to inspect.
  26058. * @returns {Array} Returns the new array of filtered values.
  26059. * @see _.difference, _.without
  26060. * @example
  26061. *
  26062. * _.xor([2, 1], [2, 3]);
  26063. * // => [1, 3]
  26064. */
  26065. var xor = baseRest(function(arrays) {
  26066. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26067. });
  26068. /**
  26069. * This method is like `_.xor` except that it accepts `iteratee` which is
  26070. * invoked for each element of each `arrays` to generate the criterion by
  26071. * which by which they're compared. The order of result values is determined
  26072. * by the order they occur in the arrays. The iteratee is invoked with one
  26073. * argument: (value).
  26074. *
  26075. * @static
  26076. * @memberOf _
  26077. * @since 4.0.0
  26078. * @category Array
  26079. * @param {...Array} [arrays] The arrays to inspect.
  26080. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26081. * @returns {Array} Returns the new array of filtered values.
  26082. * @example
  26083. *
  26084. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26085. * // => [1.2, 3.4]
  26086. *
  26087. * // The `_.property` iteratee shorthand.
  26088. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26089. * // => [{ 'x': 2 }]
  26090. */
  26091. var xorBy = baseRest(function(arrays) {
  26092. var iteratee = last(arrays);
  26093. if (isArrayLikeObject(iteratee)) {
  26094. iteratee = undefined;
  26095. }
  26096. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26097. });
  26098. /**
  26099. * This method is like `_.xor` except that it accepts `comparator` which is
  26100. * invoked to compare elements of `arrays`. The order of result values is
  26101. * determined by the order they occur in the arrays. The comparator is invoked
  26102. * with two arguments: (arrVal, othVal).
  26103. *
  26104. * @static
  26105. * @memberOf _
  26106. * @since 4.0.0
  26107. * @category Array
  26108. * @param {...Array} [arrays] The arrays to inspect.
  26109. * @param {Function} [comparator] The comparator invoked per element.
  26110. * @returns {Array} Returns the new array of filtered values.
  26111. * @example
  26112. *
  26113. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26114. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26115. *
  26116. * _.xorWith(objects, others, _.isEqual);
  26117. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26118. */
  26119. var xorWith = baseRest(function(arrays) {
  26120. var comparator = last(arrays);
  26121. comparator = typeof comparator == 'function' ? comparator : undefined;
  26122. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26123. });
  26124. /**
  26125. * Creates an array of grouped elements, the first of which contains the
  26126. * first elements of the given arrays, the second of which contains the
  26127. * second elements of the given arrays, and so on.
  26128. *
  26129. * @static
  26130. * @memberOf _
  26131. * @since 0.1.0
  26132. * @category Array
  26133. * @param {...Array} [arrays] The arrays to process.
  26134. * @returns {Array} Returns the new array of grouped elements.
  26135. * @example
  26136. *
  26137. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26138. * // => [['a', 1, true], ['b', 2, false]]
  26139. */
  26140. var zip = baseRest(unzip);
  26141. /**
  26142. * This method is like `_.fromPairs` except that it accepts two arrays,
  26143. * one of property identifiers and one of corresponding values.
  26144. *
  26145. * @static
  26146. * @memberOf _
  26147. * @since 0.4.0
  26148. * @category Array
  26149. * @param {Array} [props=[]] The property identifiers.
  26150. * @param {Array} [values=[]] The property values.
  26151. * @returns {Object} Returns the new object.
  26152. * @example
  26153. *
  26154. * _.zipObject(['a', 'b'], [1, 2]);
  26155. * // => { 'a': 1, 'b': 2 }
  26156. */
  26157. function zipObject(props, values) {
  26158. return baseZipObject(props || [], values || [], assignValue);
  26159. }
  26160. /**
  26161. * This method is like `_.zipObject` except that it supports property paths.
  26162. *
  26163. * @static
  26164. * @memberOf _
  26165. * @since 4.1.0
  26166. * @category Array
  26167. * @param {Array} [props=[]] The property identifiers.
  26168. * @param {Array} [values=[]] The property values.
  26169. * @returns {Object} Returns the new object.
  26170. * @example
  26171. *
  26172. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26173. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26174. */
  26175. function zipObjectDeep(props, values) {
  26176. return baseZipObject(props || [], values || [], baseSet);
  26177. }
  26178. /**
  26179. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26180. * how grouped values should be combined. The iteratee is invoked with the
  26181. * elements of each group: (...group).
  26182. *
  26183. * @static
  26184. * @memberOf _
  26185. * @since 3.8.0
  26186. * @category Array
  26187. * @param {...Array} [arrays] The arrays to process.
  26188. * @param {Function} [iteratee=_.identity] The function to combine
  26189. * grouped values.
  26190. * @returns {Array} Returns the new array of grouped elements.
  26191. * @example
  26192. *
  26193. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26194. * return a + b + c;
  26195. * });
  26196. * // => [111, 222]
  26197. */
  26198. var zipWith = baseRest(function(arrays) {
  26199. var length = arrays.length,
  26200. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26201. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26202. return unzipWith(arrays, iteratee);
  26203. });
  26204. /*------------------------------------------------------------------------*/
  26205. /**
  26206. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26207. * chain sequences enabled. The result of such sequences must be unwrapped
  26208. * with `_#value`.
  26209. *
  26210. * @static
  26211. * @memberOf _
  26212. * @since 1.3.0
  26213. * @category Seq
  26214. * @param {*} value The value to wrap.
  26215. * @returns {Object} Returns the new `lodash` wrapper instance.
  26216. * @example
  26217. *
  26218. * var users = [
  26219. * { 'user': 'barney', 'age': 36 },
  26220. * { 'user': 'fred', 'age': 40 },
  26221. * { 'user': 'pebbles', 'age': 1 }
  26222. * ];
  26223. *
  26224. * var youngest = _
  26225. * .chain(users)
  26226. * .sortBy('age')
  26227. * .map(function(o) {
  26228. * return o.user + ' is ' + o.age;
  26229. * })
  26230. * .head()
  26231. * .value();
  26232. * // => 'pebbles is 1'
  26233. */
  26234. function chain(value) {
  26235. var result = lodash(value);
  26236. result.__chain__ = true;
  26237. return result;
  26238. }
  26239. /**
  26240. * This method invokes `interceptor` and returns `value`. The interceptor
  26241. * is invoked with one argument; (value). The purpose of this method is to
  26242. * "tap into" a method chain sequence in order to modify intermediate results.
  26243. *
  26244. * @static
  26245. * @memberOf _
  26246. * @since 0.1.0
  26247. * @category Seq
  26248. * @param {*} value The value to provide to `interceptor`.
  26249. * @param {Function} interceptor The function to invoke.
  26250. * @returns {*} Returns `value`.
  26251. * @example
  26252. *
  26253. * _([1, 2, 3])
  26254. * .tap(function(array) {
  26255. * // Mutate input array.
  26256. * array.pop();
  26257. * })
  26258. * .reverse()
  26259. * .value();
  26260. * // => [2, 1]
  26261. */
  26262. function tap(value, interceptor) {
  26263. interceptor(value);
  26264. return value;
  26265. }
  26266. /**
  26267. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26268. * The purpose of this method is to "pass thru" values replacing intermediate
  26269. * results in a method chain sequence.
  26270. *
  26271. * @static
  26272. * @memberOf _
  26273. * @since 3.0.0
  26274. * @category Seq
  26275. * @param {*} value The value to provide to `interceptor`.
  26276. * @param {Function} interceptor The function to invoke.
  26277. * @returns {*} Returns the result of `interceptor`.
  26278. * @example
  26279. *
  26280. * _(' abc ')
  26281. * .chain()
  26282. * .trim()
  26283. * .thru(function(value) {
  26284. * return [value];
  26285. * })
  26286. * .value();
  26287. * // => ['abc']
  26288. */
  26289. function thru(value, interceptor) {
  26290. return interceptor(value);
  26291. }
  26292. /**
  26293. * This method is the wrapper version of `_.at`.
  26294. *
  26295. * @name at
  26296. * @memberOf _
  26297. * @since 1.0.0
  26298. * @category Seq
  26299. * @param {...(string|string[])} [paths] The property paths to pick.
  26300. * @returns {Object} Returns the new `lodash` wrapper instance.
  26301. * @example
  26302. *
  26303. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26304. *
  26305. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26306. * // => [3, 4]
  26307. */
  26308. var wrapperAt = flatRest(function(paths) {
  26309. var length = paths.length,
  26310. start = length ? paths[0] : 0,
  26311. value = this.__wrapped__,
  26312. interceptor = function(object) { return baseAt(object, paths); };
  26313. if (length > 1 || this.__actions__.length ||
  26314. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26315. return this.thru(interceptor);
  26316. }
  26317. value = value.slice(start, +start + (length ? 1 : 0));
  26318. value.__actions__.push({
  26319. 'func': thru,
  26320. 'args': [interceptor],
  26321. 'thisArg': undefined
  26322. });
  26323. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26324. if (length && !array.length) {
  26325. array.push(undefined);
  26326. }
  26327. return array;
  26328. });
  26329. });
  26330. /**
  26331. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26332. *
  26333. * @name chain
  26334. * @memberOf _
  26335. * @since 0.1.0
  26336. * @category Seq
  26337. * @returns {Object} Returns the new `lodash` wrapper instance.
  26338. * @example
  26339. *
  26340. * var users = [
  26341. * { 'user': 'barney', 'age': 36 },
  26342. * { 'user': 'fred', 'age': 40 }
  26343. * ];
  26344. *
  26345. * // A sequence without explicit chaining.
  26346. * _(users).head();
  26347. * // => { 'user': 'barney', 'age': 36 }
  26348. *
  26349. * // A sequence with explicit chaining.
  26350. * _(users)
  26351. * .chain()
  26352. * .head()
  26353. * .pick('user')
  26354. * .value();
  26355. * // => { 'user': 'barney' }
  26356. */
  26357. function wrapperChain() {
  26358. return chain(this);
  26359. }
  26360. /**
  26361. * Executes the chain sequence and returns the wrapped result.
  26362. *
  26363. * @name commit
  26364. * @memberOf _
  26365. * @since 3.2.0
  26366. * @category Seq
  26367. * @returns {Object} Returns the new `lodash` wrapper instance.
  26368. * @example
  26369. *
  26370. * var array = [1, 2];
  26371. * var wrapped = _(array).push(3);
  26372. *
  26373. * console.log(array);
  26374. * // => [1, 2]
  26375. *
  26376. * wrapped = wrapped.commit();
  26377. * console.log(array);
  26378. * // => [1, 2, 3]
  26379. *
  26380. * wrapped.last();
  26381. * // => 3
  26382. *
  26383. * console.log(array);
  26384. * // => [1, 2, 3]
  26385. */
  26386. function wrapperCommit() {
  26387. return new LodashWrapper(this.value(), this.__chain__);
  26388. }
  26389. /**
  26390. * Gets the next value on a wrapped object following the
  26391. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26392. *
  26393. * @name next
  26394. * @memberOf _
  26395. * @since 4.0.0
  26396. * @category Seq
  26397. * @returns {Object} Returns the next iterator value.
  26398. * @example
  26399. *
  26400. * var wrapped = _([1, 2]);
  26401. *
  26402. * wrapped.next();
  26403. * // => { 'done': false, 'value': 1 }
  26404. *
  26405. * wrapped.next();
  26406. * // => { 'done': false, 'value': 2 }
  26407. *
  26408. * wrapped.next();
  26409. * // => { 'done': true, 'value': undefined }
  26410. */
  26411. function wrapperNext() {
  26412. if (this.__values__ === undefined) {
  26413. this.__values__ = toArray(this.value());
  26414. }
  26415. var done = this.__index__ >= this.__values__.length,
  26416. value = done ? undefined : this.__values__[this.__index__++];
  26417. return { 'done': done, 'value': value };
  26418. }
  26419. /**
  26420. * Enables the wrapper to be iterable.
  26421. *
  26422. * @name Symbol.iterator
  26423. * @memberOf _
  26424. * @since 4.0.0
  26425. * @category Seq
  26426. * @returns {Object} Returns the wrapper object.
  26427. * @example
  26428. *
  26429. * var wrapped = _([1, 2]);
  26430. *
  26431. * wrapped[Symbol.iterator]() === wrapped;
  26432. * // => true
  26433. *
  26434. * Array.from(wrapped);
  26435. * // => [1, 2]
  26436. */
  26437. function wrapperToIterator() {
  26438. return this;
  26439. }
  26440. /**
  26441. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26442. *
  26443. * @name plant
  26444. * @memberOf _
  26445. * @since 3.2.0
  26446. * @category Seq
  26447. * @param {*} value The value to plant.
  26448. * @returns {Object} Returns the new `lodash` wrapper instance.
  26449. * @example
  26450. *
  26451. * function square(n) {
  26452. * return n * n;
  26453. * }
  26454. *
  26455. * var wrapped = _([1, 2]).map(square);
  26456. * var other = wrapped.plant([3, 4]);
  26457. *
  26458. * other.value();
  26459. * // => [9, 16]
  26460. *
  26461. * wrapped.value();
  26462. * // => [1, 4]
  26463. */
  26464. function wrapperPlant(value) {
  26465. var result,
  26466. parent = this;
  26467. while (parent instanceof baseLodash) {
  26468. var clone = wrapperClone(parent);
  26469. clone.__index__ = 0;
  26470. clone.__values__ = undefined;
  26471. if (result) {
  26472. previous.__wrapped__ = clone;
  26473. } else {
  26474. result = clone;
  26475. }
  26476. var previous = clone;
  26477. parent = parent.__wrapped__;
  26478. }
  26479. previous.__wrapped__ = value;
  26480. return result;
  26481. }
  26482. /**
  26483. * This method is the wrapper version of `_.reverse`.
  26484. *
  26485. * **Note:** This method mutates the wrapped array.
  26486. *
  26487. * @name reverse
  26488. * @memberOf _
  26489. * @since 0.1.0
  26490. * @category Seq
  26491. * @returns {Object} Returns the new `lodash` wrapper instance.
  26492. * @example
  26493. *
  26494. * var array = [1, 2, 3];
  26495. *
  26496. * _(array).reverse().value()
  26497. * // => [3, 2, 1]
  26498. *
  26499. * console.log(array);
  26500. * // => [3, 2, 1]
  26501. */
  26502. function wrapperReverse() {
  26503. var value = this.__wrapped__;
  26504. if (value instanceof LazyWrapper) {
  26505. var wrapped = value;
  26506. if (this.__actions__.length) {
  26507. wrapped = new LazyWrapper(this);
  26508. }
  26509. wrapped = wrapped.reverse();
  26510. wrapped.__actions__.push({
  26511. 'func': thru,
  26512. 'args': [reverse],
  26513. 'thisArg': undefined
  26514. });
  26515. return new LodashWrapper(wrapped, this.__chain__);
  26516. }
  26517. return this.thru(reverse);
  26518. }
  26519. /**
  26520. * Executes the chain sequence to resolve the unwrapped value.
  26521. *
  26522. * @name value
  26523. * @memberOf _
  26524. * @since 0.1.0
  26525. * @alias toJSON, valueOf
  26526. * @category Seq
  26527. * @returns {*} Returns the resolved unwrapped value.
  26528. * @example
  26529. *
  26530. * _([1, 2, 3]).value();
  26531. * // => [1, 2, 3]
  26532. */
  26533. function wrapperValue() {
  26534. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26535. }
  26536. /*------------------------------------------------------------------------*/
  26537. /**
  26538. * Creates an object composed of keys generated from the results of running
  26539. * each element of `collection` thru `iteratee`. The corresponding value of
  26540. * each key is the number of times the key was returned by `iteratee`. The
  26541. * iteratee is invoked with one argument: (value).
  26542. *
  26543. * @static
  26544. * @memberOf _
  26545. * @since 0.5.0
  26546. * @category Collection
  26547. * @param {Array|Object} collection The collection to iterate over.
  26548. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26549. * @returns {Object} Returns the composed aggregate object.
  26550. * @example
  26551. *
  26552. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26553. * // => { '4': 1, '6': 2 }
  26554. *
  26555. * // The `_.property` iteratee shorthand.
  26556. * _.countBy(['one', 'two', 'three'], 'length');
  26557. * // => { '3': 2, '5': 1 }
  26558. */
  26559. var countBy = createAggregator(function(result, value, key) {
  26560. if (hasOwnProperty.call(result, key)) {
  26561. ++result[key];
  26562. } else {
  26563. baseAssignValue(result, key, 1);
  26564. }
  26565. });
  26566. /**
  26567. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26568. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26569. * invoked with three arguments: (value, index|key, collection).
  26570. *
  26571. * **Note:** This method returns `true` for
  26572. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26573. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26574. * elements of empty collections.
  26575. *
  26576. * @static
  26577. * @memberOf _
  26578. * @since 0.1.0
  26579. * @category Collection
  26580. * @param {Array|Object} collection The collection to iterate over.
  26581. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26582. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26583. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26584. * else `false`.
  26585. * @example
  26586. *
  26587. * _.every([true, 1, null, 'yes'], Boolean);
  26588. * // => false
  26589. *
  26590. * var users = [
  26591. * { 'user': 'barney', 'age': 36, 'active': false },
  26592. * { 'user': 'fred', 'age': 40, 'active': false }
  26593. * ];
  26594. *
  26595. * // The `_.matches` iteratee shorthand.
  26596. * _.every(users, { 'user': 'barney', 'active': false });
  26597. * // => false
  26598. *
  26599. * // The `_.matchesProperty` iteratee shorthand.
  26600. * _.every(users, ['active', false]);
  26601. * // => true
  26602. *
  26603. * // The `_.property` iteratee shorthand.
  26604. * _.every(users, 'active');
  26605. * // => false
  26606. */
  26607. function every(collection, predicate, guard) {
  26608. var func = isArray(collection) ? arrayEvery : baseEvery;
  26609. if (guard && isIterateeCall(collection, predicate, guard)) {
  26610. predicate = undefined;
  26611. }
  26612. return func(collection, getIteratee(predicate, 3));
  26613. }
  26614. /**
  26615. * Iterates over elements of `collection`, returning an array of all elements
  26616. * `predicate` returns truthy for. The predicate is invoked with three
  26617. * arguments: (value, index|key, collection).
  26618. *
  26619. * **Note:** Unlike `_.remove`, this method returns a new array.
  26620. *
  26621. * @static
  26622. * @memberOf _
  26623. * @since 0.1.0
  26624. * @category Collection
  26625. * @param {Array|Object} collection The collection to iterate over.
  26626. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26627. * @returns {Array} Returns the new filtered array.
  26628. * @see _.reject
  26629. * @example
  26630. *
  26631. * var users = [
  26632. * { 'user': 'barney', 'age': 36, 'active': true },
  26633. * { 'user': 'fred', 'age': 40, 'active': false }
  26634. * ];
  26635. *
  26636. * _.filter(users, function(o) { return !o.active; });
  26637. * // => objects for ['fred']
  26638. *
  26639. * // The `_.matches` iteratee shorthand.
  26640. * _.filter(users, { 'age': 36, 'active': true });
  26641. * // => objects for ['barney']
  26642. *
  26643. * // The `_.matchesProperty` iteratee shorthand.
  26644. * _.filter(users, ['active', false]);
  26645. * // => objects for ['fred']
  26646. *
  26647. * // The `_.property` iteratee shorthand.
  26648. * _.filter(users, 'active');
  26649. * // => objects for ['barney']
  26650. */
  26651. function filter(collection, predicate) {
  26652. var func = isArray(collection) ? arrayFilter : baseFilter;
  26653. return func(collection, getIteratee(predicate, 3));
  26654. }
  26655. /**
  26656. * Iterates over elements of `collection`, returning the first element
  26657. * `predicate` returns truthy for. The predicate is invoked with three
  26658. * arguments: (value, index|key, collection).
  26659. *
  26660. * @static
  26661. * @memberOf _
  26662. * @since 0.1.0
  26663. * @category Collection
  26664. * @param {Array|Object} collection The collection to inspect.
  26665. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26666. * @param {number} [fromIndex=0] The index to search from.
  26667. * @returns {*} Returns the matched element, else `undefined`.
  26668. * @example
  26669. *
  26670. * var users = [
  26671. * { 'user': 'barney', 'age': 36, 'active': true },
  26672. * { 'user': 'fred', 'age': 40, 'active': false },
  26673. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26674. * ];
  26675. *
  26676. * _.find(users, function(o) { return o.age < 40; });
  26677. * // => object for 'barney'
  26678. *
  26679. * // The `_.matches` iteratee shorthand.
  26680. * _.find(users, { 'age': 1, 'active': true });
  26681. * // => object for 'pebbles'
  26682. *
  26683. * // The `_.matchesProperty` iteratee shorthand.
  26684. * _.find(users, ['active', false]);
  26685. * // => object for 'fred'
  26686. *
  26687. * // The `_.property` iteratee shorthand.
  26688. * _.find(users, 'active');
  26689. * // => object for 'barney'
  26690. */
  26691. var find = createFind(findIndex);
  26692. /**
  26693. * This method is like `_.find` except that it iterates over elements of
  26694. * `collection` from right to left.
  26695. *
  26696. * @static
  26697. * @memberOf _
  26698. * @since 2.0.0
  26699. * @category Collection
  26700. * @param {Array|Object} collection The collection to inspect.
  26701. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26702. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26703. * @returns {*} Returns the matched element, else `undefined`.
  26704. * @example
  26705. *
  26706. * _.findLast([1, 2, 3, 4], function(n) {
  26707. * return n % 2 == 1;
  26708. * });
  26709. * // => 3
  26710. */
  26711. var findLast = createFind(findLastIndex);
  26712. /**
  26713. * Creates a flattened array of values by running each element in `collection`
  26714. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26715. * with three arguments: (value, index|key, collection).
  26716. *
  26717. * @static
  26718. * @memberOf _
  26719. * @since 4.0.0
  26720. * @category Collection
  26721. * @param {Array|Object} collection The collection to iterate over.
  26722. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26723. * @returns {Array} Returns the new flattened array.
  26724. * @example
  26725. *
  26726. * function duplicate(n) {
  26727. * return [n, n];
  26728. * }
  26729. *
  26730. * _.flatMap([1, 2], duplicate);
  26731. * // => [1, 1, 2, 2]
  26732. */
  26733. function flatMap(collection, iteratee) {
  26734. return baseFlatten(map(collection, iteratee), 1);
  26735. }
  26736. /**
  26737. * This method is like `_.flatMap` except that it recursively flattens the
  26738. * mapped results.
  26739. *
  26740. * @static
  26741. * @memberOf _
  26742. * @since 4.7.0
  26743. * @category Collection
  26744. * @param {Array|Object} collection The collection to iterate over.
  26745. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26746. * @returns {Array} Returns the new flattened array.
  26747. * @example
  26748. *
  26749. * function duplicate(n) {
  26750. * return [[[n, n]]];
  26751. * }
  26752. *
  26753. * _.flatMapDeep([1, 2], duplicate);
  26754. * // => [1, 1, 2, 2]
  26755. */
  26756. function flatMapDeep(collection, iteratee) {
  26757. return baseFlatten(map(collection, iteratee), INFINITY);
  26758. }
  26759. /**
  26760. * This method is like `_.flatMap` except that it recursively flattens the
  26761. * mapped results up to `depth` times.
  26762. *
  26763. * @static
  26764. * @memberOf _
  26765. * @since 4.7.0
  26766. * @category Collection
  26767. * @param {Array|Object} collection The collection to iterate over.
  26768. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26769. * @param {number} [depth=1] The maximum recursion depth.
  26770. * @returns {Array} Returns the new flattened array.
  26771. * @example
  26772. *
  26773. * function duplicate(n) {
  26774. * return [[[n, n]]];
  26775. * }
  26776. *
  26777. * _.flatMapDepth([1, 2], duplicate, 2);
  26778. * // => [[1, 1], [2, 2]]
  26779. */
  26780. function flatMapDepth(collection, iteratee, depth) {
  26781. depth = depth === undefined ? 1 : toInteger(depth);
  26782. return baseFlatten(map(collection, iteratee), depth);
  26783. }
  26784. /**
  26785. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26786. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26787. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26788. *
  26789. * **Note:** As with other "Collections" methods, objects with a "length"
  26790. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26791. * or `_.forOwn` for object iteration.
  26792. *
  26793. * @static
  26794. * @memberOf _
  26795. * @since 0.1.0
  26796. * @alias each
  26797. * @category Collection
  26798. * @param {Array|Object} collection The collection to iterate over.
  26799. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26800. * @returns {Array|Object} Returns `collection`.
  26801. * @see _.forEachRight
  26802. * @example
  26803. *
  26804. * _.forEach([1, 2], function(value) {
  26805. * console.log(value);
  26806. * });
  26807. * // => Logs `1` then `2`.
  26808. *
  26809. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26810. * console.log(key);
  26811. * });
  26812. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26813. */
  26814. function forEach(collection, iteratee) {
  26815. var func = isArray(collection) ? arrayEach : baseEach;
  26816. return func(collection, getIteratee(iteratee, 3));
  26817. }
  26818. /**
  26819. * This method is like `_.forEach` except that it iterates over elements of
  26820. * `collection` from right to left.
  26821. *
  26822. * @static
  26823. * @memberOf _
  26824. * @since 2.0.0
  26825. * @alias eachRight
  26826. * @category Collection
  26827. * @param {Array|Object} collection The collection to iterate over.
  26828. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26829. * @returns {Array|Object} Returns `collection`.
  26830. * @see _.forEach
  26831. * @example
  26832. *
  26833. * _.forEachRight([1, 2], function(value) {
  26834. * console.log(value);
  26835. * });
  26836. * // => Logs `2` then `1`.
  26837. */
  26838. function forEachRight(collection, iteratee) {
  26839. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26840. return func(collection, getIteratee(iteratee, 3));
  26841. }
  26842. /**
  26843. * Creates an object composed of keys generated from the results of running
  26844. * each element of `collection` thru `iteratee`. The order of grouped values
  26845. * is determined by the order they occur in `collection`. The corresponding
  26846. * value of each key is an array of elements responsible for generating the
  26847. * key. The iteratee is invoked with one argument: (value).
  26848. *
  26849. * @static
  26850. * @memberOf _
  26851. * @since 0.1.0
  26852. * @category Collection
  26853. * @param {Array|Object} collection The collection to iterate over.
  26854. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26855. * @returns {Object} Returns the composed aggregate object.
  26856. * @example
  26857. *
  26858. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26859. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26860. *
  26861. * // The `_.property` iteratee shorthand.
  26862. * _.groupBy(['one', 'two', 'three'], 'length');
  26863. * // => { '3': ['one', 'two'], '5': ['three'] }
  26864. */
  26865. var groupBy = createAggregator(function(result, value, key) {
  26866. if (hasOwnProperty.call(result, key)) {
  26867. result[key].push(value);
  26868. } else {
  26869. baseAssignValue(result, key, [value]);
  26870. }
  26871. });
  26872. /**
  26873. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26874. * checked for a substring of `value`, otherwise
  26875. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26876. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26877. * the offset from the end of `collection`.
  26878. *
  26879. * @static
  26880. * @memberOf _
  26881. * @since 0.1.0
  26882. * @category Collection
  26883. * @param {Array|Object|string} collection The collection to inspect.
  26884. * @param {*} value The value to search for.
  26885. * @param {number} [fromIndex=0] The index to search from.
  26886. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26887. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26888. * @example
  26889. *
  26890. * _.includes([1, 2, 3], 1);
  26891. * // => true
  26892. *
  26893. * _.includes([1, 2, 3], 1, 2);
  26894. * // => false
  26895. *
  26896. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26897. * // => true
  26898. *
  26899. * _.includes('abcd', 'bc');
  26900. * // => true
  26901. */
  26902. function includes(collection, value, fromIndex, guard) {
  26903. collection = isArrayLike(collection) ? collection : values(collection);
  26904. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26905. var length = collection.length;
  26906. if (fromIndex < 0) {
  26907. fromIndex = nativeMax(length + fromIndex, 0);
  26908. }
  26909. return isString(collection)
  26910. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  26911. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  26912. }
  26913. /**
  26914. * Invokes the method at `path` of each element in `collection`, returning
  26915. * an array of the results of each invoked method. Any additional arguments
  26916. * are provided to each invoked method. If `path` is a function, it's invoked
  26917. * for, and `this` bound to, each element in `collection`.
  26918. *
  26919. * @static
  26920. * @memberOf _
  26921. * @since 4.0.0
  26922. * @category Collection
  26923. * @param {Array|Object} collection The collection to iterate over.
  26924. * @param {Array|Function|string} path The path of the method to invoke or
  26925. * the function invoked per iteration.
  26926. * @param {...*} [args] The arguments to invoke each method with.
  26927. * @returns {Array} Returns the array of results.
  26928. * @example
  26929. *
  26930. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  26931. * // => [[1, 5, 7], [1, 2, 3]]
  26932. *
  26933. * _.invokeMap([123, 456], String.prototype.split, '');
  26934. * // => [['1', '2', '3'], ['4', '5', '6']]
  26935. */
  26936. var invokeMap = baseRest(function(collection, path, args) {
  26937. var index = -1,
  26938. isFunc = typeof path == 'function',
  26939. result = isArrayLike(collection) ? Array(collection.length) : [];
  26940. baseEach(collection, function(value) {
  26941. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  26942. });
  26943. return result;
  26944. });
  26945. /**
  26946. * Creates an object composed of keys generated from the results of running
  26947. * each element of `collection` thru `iteratee`. The corresponding value of
  26948. * each key is the last element responsible for generating the key. The
  26949. * iteratee is invoked with one argument: (value).
  26950. *
  26951. * @static
  26952. * @memberOf _
  26953. * @since 4.0.0
  26954. * @category Collection
  26955. * @param {Array|Object} collection The collection to iterate over.
  26956. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26957. * @returns {Object} Returns the composed aggregate object.
  26958. * @example
  26959. *
  26960. * var array = [
  26961. * { 'dir': 'left', 'code': 97 },
  26962. * { 'dir': 'right', 'code': 100 }
  26963. * ];
  26964. *
  26965. * _.keyBy(array, function(o) {
  26966. * return String.fromCharCode(o.code);
  26967. * });
  26968. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  26969. *
  26970. * _.keyBy(array, 'dir');
  26971. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  26972. */
  26973. var keyBy = createAggregator(function(result, value, key) {
  26974. baseAssignValue(result, key, value);
  26975. });
  26976. /**
  26977. * Creates an array of values by running each element in `collection` thru
  26978. * `iteratee`. The iteratee is invoked with three arguments:
  26979. * (value, index|key, collection).
  26980. *
  26981. * Many lodash methods are guarded to work as iteratees for methods like
  26982. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  26983. *
  26984. * The guarded methods are:
  26985. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  26986. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  26987. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  26988. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  26989. *
  26990. * @static
  26991. * @memberOf _
  26992. * @since 0.1.0
  26993. * @category Collection
  26994. * @param {Array|Object} collection The collection to iterate over.
  26995. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26996. * @returns {Array} Returns the new mapped array.
  26997. * @example
  26998. *
  26999. * function square(n) {
  27000. * return n * n;
  27001. * }
  27002. *
  27003. * _.map([4, 8], square);
  27004. * // => [16, 64]
  27005. *
  27006. * _.map({ 'a': 4, 'b': 8 }, square);
  27007. * // => [16, 64] (iteration order is not guaranteed)
  27008. *
  27009. * var users = [
  27010. * { 'user': 'barney' },
  27011. * { 'user': 'fred' }
  27012. * ];
  27013. *
  27014. * // The `_.property` iteratee shorthand.
  27015. * _.map(users, 'user');
  27016. * // => ['barney', 'fred']
  27017. */
  27018. function map(collection, iteratee) {
  27019. var func = isArray(collection) ? arrayMap : baseMap;
  27020. return func(collection, getIteratee(iteratee, 3));
  27021. }
  27022. /**
  27023. * This method is like `_.sortBy` except that it allows specifying the sort
  27024. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27025. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27026. * descending or "asc" for ascending sort order of corresponding values.
  27027. *
  27028. * @static
  27029. * @memberOf _
  27030. * @since 4.0.0
  27031. * @category Collection
  27032. * @param {Array|Object} collection The collection to iterate over.
  27033. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27034. * The iteratees to sort by.
  27035. * @param {string[]} [orders] The sort orders of `iteratees`.
  27036. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27037. * @returns {Array} Returns the new sorted array.
  27038. * @example
  27039. *
  27040. * var users = [
  27041. * { 'user': 'fred', 'age': 48 },
  27042. * { 'user': 'barney', 'age': 34 },
  27043. * { 'user': 'fred', 'age': 40 },
  27044. * { 'user': 'barney', 'age': 36 }
  27045. * ];
  27046. *
  27047. * // Sort by `user` in ascending order and by `age` in descending order.
  27048. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27049. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27050. */
  27051. function orderBy(collection, iteratees, orders, guard) {
  27052. if (collection == null) {
  27053. return [];
  27054. }
  27055. if (!isArray(iteratees)) {
  27056. iteratees = iteratees == null ? [] : [iteratees];
  27057. }
  27058. orders = guard ? undefined : orders;
  27059. if (!isArray(orders)) {
  27060. orders = orders == null ? [] : [orders];
  27061. }
  27062. return baseOrderBy(collection, iteratees, orders);
  27063. }
  27064. /**
  27065. * Creates an array of elements split into two groups, the first of which
  27066. * contains elements `predicate` returns truthy for, the second of which
  27067. * contains elements `predicate` returns falsey for. The predicate is
  27068. * invoked with one argument: (value).
  27069. *
  27070. * @static
  27071. * @memberOf _
  27072. * @since 3.0.0
  27073. * @category Collection
  27074. * @param {Array|Object} collection The collection to iterate over.
  27075. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27076. * @returns {Array} Returns the array of grouped elements.
  27077. * @example
  27078. *
  27079. * var users = [
  27080. * { 'user': 'barney', 'age': 36, 'active': false },
  27081. * { 'user': 'fred', 'age': 40, 'active': true },
  27082. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27083. * ];
  27084. *
  27085. * _.partition(users, function(o) { return o.active; });
  27086. * // => objects for [['fred'], ['barney', 'pebbles']]
  27087. *
  27088. * // The `_.matches` iteratee shorthand.
  27089. * _.partition(users, { 'age': 1, 'active': false });
  27090. * // => objects for [['pebbles'], ['barney', 'fred']]
  27091. *
  27092. * // The `_.matchesProperty` iteratee shorthand.
  27093. * _.partition(users, ['active', false]);
  27094. * // => objects for [['barney', 'pebbles'], ['fred']]
  27095. *
  27096. * // The `_.property` iteratee shorthand.
  27097. * _.partition(users, 'active');
  27098. * // => objects for [['fred'], ['barney', 'pebbles']]
  27099. */
  27100. var partition = createAggregator(function(result, value, key) {
  27101. result[key ? 0 : 1].push(value);
  27102. }, function() { return [[], []]; });
  27103. /**
  27104. * Reduces `collection` to a value which is the accumulated result of running
  27105. * each element in `collection` thru `iteratee`, where each successive
  27106. * invocation is supplied the return value of the previous. If `accumulator`
  27107. * is not given, the first element of `collection` is used as the initial
  27108. * value. The iteratee is invoked with four arguments:
  27109. * (accumulator, value, index|key, collection).
  27110. *
  27111. * Many lodash methods are guarded to work as iteratees for methods like
  27112. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27113. *
  27114. * The guarded methods are:
  27115. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27116. * and `sortBy`
  27117. *
  27118. * @static
  27119. * @memberOf _
  27120. * @since 0.1.0
  27121. * @category Collection
  27122. * @param {Array|Object} collection The collection to iterate over.
  27123. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27124. * @param {*} [accumulator] The initial value.
  27125. * @returns {*} Returns the accumulated value.
  27126. * @see _.reduceRight
  27127. * @example
  27128. *
  27129. * _.reduce([1, 2], function(sum, n) {
  27130. * return sum + n;
  27131. * }, 0);
  27132. * // => 3
  27133. *
  27134. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27135. * (result[value] || (result[value] = [])).push(key);
  27136. * return result;
  27137. * }, {});
  27138. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27139. */
  27140. function reduce(collection, iteratee, accumulator) {
  27141. var func = isArray(collection) ? arrayReduce : baseReduce,
  27142. initAccum = arguments.length < 3;
  27143. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27144. }
  27145. /**
  27146. * This method is like `_.reduce` except that it iterates over elements of
  27147. * `collection` from right to left.
  27148. *
  27149. * @static
  27150. * @memberOf _
  27151. * @since 0.1.0
  27152. * @category Collection
  27153. * @param {Array|Object} collection The collection to iterate over.
  27154. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27155. * @param {*} [accumulator] The initial value.
  27156. * @returns {*} Returns the accumulated value.
  27157. * @see _.reduce
  27158. * @example
  27159. *
  27160. * var array = [[0, 1], [2, 3], [4, 5]];
  27161. *
  27162. * _.reduceRight(array, function(flattened, other) {
  27163. * return flattened.concat(other);
  27164. * }, []);
  27165. * // => [4, 5, 2, 3, 0, 1]
  27166. */
  27167. function reduceRight(collection, iteratee, accumulator) {
  27168. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27169. initAccum = arguments.length < 3;
  27170. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27171. }
  27172. /**
  27173. * The opposite of `_.filter`; this method returns the elements of `collection`
  27174. * that `predicate` does **not** return truthy for.
  27175. *
  27176. * @static
  27177. * @memberOf _
  27178. * @since 0.1.0
  27179. * @category Collection
  27180. * @param {Array|Object} collection The collection to iterate over.
  27181. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27182. * @returns {Array} Returns the new filtered array.
  27183. * @see _.filter
  27184. * @example
  27185. *
  27186. * var users = [
  27187. * { 'user': 'barney', 'age': 36, 'active': false },
  27188. * { 'user': 'fred', 'age': 40, 'active': true }
  27189. * ];
  27190. *
  27191. * _.reject(users, function(o) { return !o.active; });
  27192. * // => objects for ['fred']
  27193. *
  27194. * // The `_.matches` iteratee shorthand.
  27195. * _.reject(users, { 'age': 40, 'active': true });
  27196. * // => objects for ['barney']
  27197. *
  27198. * // The `_.matchesProperty` iteratee shorthand.
  27199. * _.reject(users, ['active', false]);
  27200. * // => objects for ['fred']
  27201. *
  27202. * // The `_.property` iteratee shorthand.
  27203. * _.reject(users, 'active');
  27204. * // => objects for ['barney']
  27205. */
  27206. function reject(collection, predicate) {
  27207. var func = isArray(collection) ? arrayFilter : baseFilter;
  27208. return func(collection, negate(getIteratee(predicate, 3)));
  27209. }
  27210. /**
  27211. * Gets a random element from `collection`.
  27212. *
  27213. * @static
  27214. * @memberOf _
  27215. * @since 2.0.0
  27216. * @category Collection
  27217. * @param {Array|Object} collection The collection to sample.
  27218. * @returns {*} Returns the random element.
  27219. * @example
  27220. *
  27221. * _.sample([1, 2, 3, 4]);
  27222. * // => 2
  27223. */
  27224. function sample(collection) {
  27225. var func = isArray(collection) ? arraySample : baseSample;
  27226. return func(collection);
  27227. }
  27228. /**
  27229. * Gets `n` random elements at unique keys from `collection` up to the
  27230. * size of `collection`.
  27231. *
  27232. * @static
  27233. * @memberOf _
  27234. * @since 4.0.0
  27235. * @category Collection
  27236. * @param {Array|Object} collection The collection to sample.
  27237. * @param {number} [n=1] The number of elements to sample.
  27238. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27239. * @returns {Array} Returns the random elements.
  27240. * @example
  27241. *
  27242. * _.sampleSize([1, 2, 3], 2);
  27243. * // => [3, 1]
  27244. *
  27245. * _.sampleSize([1, 2, 3], 4);
  27246. * // => [2, 3, 1]
  27247. */
  27248. function sampleSize(collection, n, guard) {
  27249. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27250. n = 1;
  27251. } else {
  27252. n = toInteger(n);
  27253. }
  27254. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27255. return func(collection, n);
  27256. }
  27257. /**
  27258. * Creates an array of shuffled values, using a version of the
  27259. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27260. *
  27261. * @static
  27262. * @memberOf _
  27263. * @since 0.1.0
  27264. * @category Collection
  27265. * @param {Array|Object} collection The collection to shuffle.
  27266. * @returns {Array} Returns the new shuffled array.
  27267. * @example
  27268. *
  27269. * _.shuffle([1, 2, 3, 4]);
  27270. * // => [4, 1, 3, 2]
  27271. */
  27272. function shuffle(collection) {
  27273. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27274. return func(collection);
  27275. }
  27276. /**
  27277. * Gets the size of `collection` by returning its length for array-like
  27278. * values or the number of own enumerable string keyed properties for objects.
  27279. *
  27280. * @static
  27281. * @memberOf _
  27282. * @since 0.1.0
  27283. * @category Collection
  27284. * @param {Array|Object|string} collection The collection to inspect.
  27285. * @returns {number} Returns the collection size.
  27286. * @example
  27287. *
  27288. * _.size([1, 2, 3]);
  27289. * // => 3
  27290. *
  27291. * _.size({ 'a': 1, 'b': 2 });
  27292. * // => 2
  27293. *
  27294. * _.size('pebbles');
  27295. * // => 7
  27296. */
  27297. function size(collection) {
  27298. if (collection == null) {
  27299. return 0;
  27300. }
  27301. if (isArrayLike(collection)) {
  27302. return isString(collection) ? stringSize(collection) : collection.length;
  27303. }
  27304. var tag = getTag(collection);
  27305. if (tag == mapTag || tag == setTag) {
  27306. return collection.size;
  27307. }
  27308. return baseKeys(collection).length;
  27309. }
  27310. /**
  27311. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27312. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27313. * invoked with three arguments: (value, index|key, collection).
  27314. *
  27315. * @static
  27316. * @memberOf _
  27317. * @since 0.1.0
  27318. * @category Collection
  27319. * @param {Array|Object} collection The collection to iterate over.
  27320. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27321. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27322. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27323. * else `false`.
  27324. * @example
  27325. *
  27326. * _.some([null, 0, 'yes', false], Boolean);
  27327. * // => true
  27328. *
  27329. * var users = [
  27330. * { 'user': 'barney', 'active': true },
  27331. * { 'user': 'fred', 'active': false }
  27332. * ];
  27333. *
  27334. * // The `_.matches` iteratee shorthand.
  27335. * _.some(users, { 'user': 'barney', 'active': false });
  27336. * // => false
  27337. *
  27338. * // The `_.matchesProperty` iteratee shorthand.
  27339. * _.some(users, ['active', false]);
  27340. * // => true
  27341. *
  27342. * // The `_.property` iteratee shorthand.
  27343. * _.some(users, 'active');
  27344. * // => true
  27345. */
  27346. function some(collection, predicate, guard) {
  27347. var func = isArray(collection) ? arraySome : baseSome;
  27348. if (guard && isIterateeCall(collection, predicate, guard)) {
  27349. predicate = undefined;
  27350. }
  27351. return func(collection, getIteratee(predicate, 3));
  27352. }
  27353. /**
  27354. * Creates an array of elements, sorted in ascending order by the results of
  27355. * running each element in a collection thru each iteratee. This method
  27356. * performs a stable sort, that is, it preserves the original sort order of
  27357. * equal elements. The iteratees are invoked with one argument: (value).
  27358. *
  27359. * @static
  27360. * @memberOf _
  27361. * @since 0.1.0
  27362. * @category Collection
  27363. * @param {Array|Object} collection The collection to iterate over.
  27364. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27365. * The iteratees to sort by.
  27366. * @returns {Array} Returns the new sorted array.
  27367. * @example
  27368. *
  27369. * var users = [
  27370. * { 'user': 'fred', 'age': 48 },
  27371. * { 'user': 'barney', 'age': 36 },
  27372. * { 'user': 'fred', 'age': 40 },
  27373. * { 'user': 'barney', 'age': 34 }
  27374. * ];
  27375. *
  27376. * _.sortBy(users, [function(o) { return o.user; }]);
  27377. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27378. *
  27379. * _.sortBy(users, ['user', 'age']);
  27380. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27381. */
  27382. var sortBy = baseRest(function(collection, iteratees) {
  27383. if (collection == null) {
  27384. return [];
  27385. }
  27386. var length = iteratees.length;
  27387. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27388. iteratees = [];
  27389. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27390. iteratees = [iteratees[0]];
  27391. }
  27392. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27393. });
  27394. /*------------------------------------------------------------------------*/
  27395. /**
  27396. * Gets the timestamp of the number of milliseconds that have elapsed since
  27397. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27398. *
  27399. * @static
  27400. * @memberOf _
  27401. * @since 2.4.0
  27402. * @category Date
  27403. * @returns {number} Returns the timestamp.
  27404. * @example
  27405. *
  27406. * _.defer(function(stamp) {
  27407. * console.log(_.now() - stamp);
  27408. * }, _.now());
  27409. * // => Logs the number of milliseconds it took for the deferred invocation.
  27410. */
  27411. var now = ctxNow || function() {
  27412. return root.Date.now();
  27413. };
  27414. /*------------------------------------------------------------------------*/
  27415. /**
  27416. * The opposite of `_.before`; this method creates a function that invokes
  27417. * `func` once it's called `n` or more times.
  27418. *
  27419. * @static
  27420. * @memberOf _
  27421. * @since 0.1.0
  27422. * @category Function
  27423. * @param {number} n The number of calls before `func` is invoked.
  27424. * @param {Function} func The function to restrict.
  27425. * @returns {Function} Returns the new restricted function.
  27426. * @example
  27427. *
  27428. * var saves = ['profile', 'settings'];
  27429. *
  27430. * var done = _.after(saves.length, function() {
  27431. * console.log('done saving!');
  27432. * });
  27433. *
  27434. * _.forEach(saves, function(type) {
  27435. * asyncSave({ 'type': type, 'complete': done });
  27436. * });
  27437. * // => Logs 'done saving!' after the two async saves have completed.
  27438. */
  27439. function after(n, func) {
  27440. if (typeof func != 'function') {
  27441. throw new TypeError(FUNC_ERROR_TEXT);
  27442. }
  27443. n = toInteger(n);
  27444. return function() {
  27445. if (--n < 1) {
  27446. return func.apply(this, arguments);
  27447. }
  27448. };
  27449. }
  27450. /**
  27451. * Creates a function that invokes `func`, with up to `n` arguments,
  27452. * ignoring any additional arguments.
  27453. *
  27454. * @static
  27455. * @memberOf _
  27456. * @since 3.0.0
  27457. * @category Function
  27458. * @param {Function} func The function to cap arguments for.
  27459. * @param {number} [n=func.length] The arity cap.
  27460. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27461. * @returns {Function} Returns the new capped function.
  27462. * @example
  27463. *
  27464. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27465. * // => [6, 8, 10]
  27466. */
  27467. function ary(func, n, guard) {
  27468. n = guard ? undefined : n;
  27469. n = (func && n == null) ? func.length : n;
  27470. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27471. }
  27472. /**
  27473. * Creates a function that invokes `func`, with the `this` binding and arguments
  27474. * of the created function, while it's called less than `n` times. Subsequent
  27475. * calls to the created function return the result of the last `func` invocation.
  27476. *
  27477. * @static
  27478. * @memberOf _
  27479. * @since 3.0.0
  27480. * @category Function
  27481. * @param {number} n The number of calls at which `func` is no longer invoked.
  27482. * @param {Function} func The function to restrict.
  27483. * @returns {Function} Returns the new restricted function.
  27484. * @example
  27485. *
  27486. * jQuery(element).on('click', _.before(5, addContactToList));
  27487. * // => Allows adding up to 4 contacts to the list.
  27488. */
  27489. function before(n, func) {
  27490. var result;
  27491. if (typeof func != 'function') {
  27492. throw new TypeError(FUNC_ERROR_TEXT);
  27493. }
  27494. n = toInteger(n);
  27495. return function() {
  27496. if (--n > 0) {
  27497. result = func.apply(this, arguments);
  27498. }
  27499. if (n <= 1) {
  27500. func = undefined;
  27501. }
  27502. return result;
  27503. };
  27504. }
  27505. /**
  27506. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27507. * and `partials` prepended to the arguments it receives.
  27508. *
  27509. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27510. * may be used as a placeholder for partially applied arguments.
  27511. *
  27512. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27513. * property of bound functions.
  27514. *
  27515. * @static
  27516. * @memberOf _
  27517. * @since 0.1.0
  27518. * @category Function
  27519. * @param {Function} func The function to bind.
  27520. * @param {*} thisArg The `this` binding of `func`.
  27521. * @param {...*} [partials] The arguments to be partially applied.
  27522. * @returns {Function} Returns the new bound function.
  27523. * @example
  27524. *
  27525. * function greet(greeting, punctuation) {
  27526. * return greeting + ' ' + this.user + punctuation;
  27527. * }
  27528. *
  27529. * var object = { 'user': 'fred' };
  27530. *
  27531. * var bound = _.bind(greet, object, 'hi');
  27532. * bound('!');
  27533. * // => 'hi fred!'
  27534. *
  27535. * // Bound with placeholders.
  27536. * var bound = _.bind(greet, object, _, '!');
  27537. * bound('hi');
  27538. * // => 'hi fred!'
  27539. */
  27540. var bind = baseRest(function(func, thisArg, partials) {
  27541. var bitmask = WRAP_BIND_FLAG;
  27542. if (partials.length) {
  27543. var holders = replaceHolders(partials, getHolder(bind));
  27544. bitmask |= WRAP_PARTIAL_FLAG;
  27545. }
  27546. return createWrap(func, bitmask, thisArg, partials, holders);
  27547. });
  27548. /**
  27549. * Creates a function that invokes the method at `object[key]` with `partials`
  27550. * prepended to the arguments it receives.
  27551. *
  27552. * This method differs from `_.bind` by allowing bound functions to reference
  27553. * methods that may be redefined or don't yet exist. See
  27554. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27555. * for more details.
  27556. *
  27557. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27558. * builds, may be used as a placeholder for partially applied arguments.
  27559. *
  27560. * @static
  27561. * @memberOf _
  27562. * @since 0.10.0
  27563. * @category Function
  27564. * @param {Object} object The object to invoke the method on.
  27565. * @param {string} key The key of the method.
  27566. * @param {...*} [partials] The arguments to be partially applied.
  27567. * @returns {Function} Returns the new bound function.
  27568. * @example
  27569. *
  27570. * var object = {
  27571. * 'user': 'fred',
  27572. * 'greet': function(greeting, punctuation) {
  27573. * return greeting + ' ' + this.user + punctuation;
  27574. * }
  27575. * };
  27576. *
  27577. * var bound = _.bindKey(object, 'greet', 'hi');
  27578. * bound('!');
  27579. * // => 'hi fred!'
  27580. *
  27581. * object.greet = function(greeting, punctuation) {
  27582. * return greeting + 'ya ' + this.user + punctuation;
  27583. * };
  27584. *
  27585. * bound('!');
  27586. * // => 'hiya fred!'
  27587. *
  27588. * // Bound with placeholders.
  27589. * var bound = _.bindKey(object, 'greet', _, '!');
  27590. * bound('hi');
  27591. * // => 'hiya fred!'
  27592. */
  27593. var bindKey = baseRest(function(object, key, partials) {
  27594. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27595. if (partials.length) {
  27596. var holders = replaceHolders(partials, getHolder(bindKey));
  27597. bitmask |= WRAP_PARTIAL_FLAG;
  27598. }
  27599. return createWrap(key, bitmask, object, partials, holders);
  27600. });
  27601. /**
  27602. * Creates a function that accepts arguments of `func` and either invokes
  27603. * `func` returning its result, if at least `arity` number of arguments have
  27604. * been provided, or returns a function that accepts the remaining `func`
  27605. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27606. * is not sufficient.
  27607. *
  27608. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27609. * may be used as a placeholder for provided arguments.
  27610. *
  27611. * **Note:** This method doesn't set the "length" property of curried functions.
  27612. *
  27613. * @static
  27614. * @memberOf _
  27615. * @since 2.0.0
  27616. * @category Function
  27617. * @param {Function} func The function to curry.
  27618. * @param {number} [arity=func.length] The arity of `func`.
  27619. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27620. * @returns {Function} Returns the new curried function.
  27621. * @example
  27622. *
  27623. * var abc = function(a, b, c) {
  27624. * return [a, b, c];
  27625. * };
  27626. *
  27627. * var curried = _.curry(abc);
  27628. *
  27629. * curried(1)(2)(3);
  27630. * // => [1, 2, 3]
  27631. *
  27632. * curried(1, 2)(3);
  27633. * // => [1, 2, 3]
  27634. *
  27635. * curried(1, 2, 3);
  27636. * // => [1, 2, 3]
  27637. *
  27638. * // Curried with placeholders.
  27639. * curried(1)(_, 3)(2);
  27640. * // => [1, 2, 3]
  27641. */
  27642. function curry(func, arity, guard) {
  27643. arity = guard ? undefined : arity;
  27644. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27645. result.placeholder = curry.placeholder;
  27646. return result;
  27647. }
  27648. /**
  27649. * This method is like `_.curry` except that arguments are applied to `func`
  27650. * in the manner of `_.partialRight` instead of `_.partial`.
  27651. *
  27652. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27653. * builds, may be used as a placeholder for provided arguments.
  27654. *
  27655. * **Note:** This method doesn't set the "length" property of curried functions.
  27656. *
  27657. * @static
  27658. * @memberOf _
  27659. * @since 3.0.0
  27660. * @category Function
  27661. * @param {Function} func The function to curry.
  27662. * @param {number} [arity=func.length] The arity of `func`.
  27663. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27664. * @returns {Function} Returns the new curried function.
  27665. * @example
  27666. *
  27667. * var abc = function(a, b, c) {
  27668. * return [a, b, c];
  27669. * };
  27670. *
  27671. * var curried = _.curryRight(abc);
  27672. *
  27673. * curried(3)(2)(1);
  27674. * // => [1, 2, 3]
  27675. *
  27676. * curried(2, 3)(1);
  27677. * // => [1, 2, 3]
  27678. *
  27679. * curried(1, 2, 3);
  27680. * // => [1, 2, 3]
  27681. *
  27682. * // Curried with placeholders.
  27683. * curried(3)(1, _)(2);
  27684. * // => [1, 2, 3]
  27685. */
  27686. function curryRight(func, arity, guard) {
  27687. arity = guard ? undefined : arity;
  27688. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27689. result.placeholder = curryRight.placeholder;
  27690. return result;
  27691. }
  27692. /**
  27693. * Creates a debounced function that delays invoking `func` until after `wait`
  27694. * milliseconds have elapsed since the last time the debounced function was
  27695. * invoked. The debounced function comes with a `cancel` method to cancel
  27696. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27697. * Provide `options` to indicate whether `func` should be invoked on the
  27698. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27699. * with the last arguments provided to the debounced function. Subsequent
  27700. * calls to the debounced function return the result of the last `func`
  27701. * invocation.
  27702. *
  27703. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27704. * invoked on the trailing edge of the timeout only if the debounced function
  27705. * is invoked more than once during the `wait` timeout.
  27706. *
  27707. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27708. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27709. *
  27710. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27711. * for details over the differences between `_.debounce` and `_.throttle`.
  27712. *
  27713. * @static
  27714. * @memberOf _
  27715. * @since 0.1.0
  27716. * @category Function
  27717. * @param {Function} func The function to debounce.
  27718. * @param {number} [wait=0] The number of milliseconds to delay.
  27719. * @param {Object} [options={}] The options object.
  27720. * @param {boolean} [options.leading=false]
  27721. * Specify invoking on the leading edge of the timeout.
  27722. * @param {number} [options.maxWait]
  27723. * The maximum time `func` is allowed to be delayed before it's invoked.
  27724. * @param {boolean} [options.trailing=true]
  27725. * Specify invoking on the trailing edge of the timeout.
  27726. * @returns {Function} Returns the new debounced function.
  27727. * @example
  27728. *
  27729. * // Avoid costly calculations while the window size is in flux.
  27730. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27731. *
  27732. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27733. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27734. * 'leading': true,
  27735. * 'trailing': false
  27736. * }));
  27737. *
  27738. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27739. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27740. * var source = new EventSource('/stream');
  27741. * jQuery(source).on('message', debounced);
  27742. *
  27743. * // Cancel the trailing debounced invocation.
  27744. * jQuery(window).on('popstate', debounced.cancel);
  27745. */
  27746. function debounce(func, wait, options) {
  27747. var lastArgs,
  27748. lastThis,
  27749. maxWait,
  27750. result,
  27751. timerId,
  27752. lastCallTime,
  27753. lastInvokeTime = 0,
  27754. leading = false,
  27755. maxing = false,
  27756. trailing = true;
  27757. if (typeof func != 'function') {
  27758. throw new TypeError(FUNC_ERROR_TEXT);
  27759. }
  27760. wait = toNumber(wait) || 0;
  27761. if (isObject(options)) {
  27762. leading = !!options.leading;
  27763. maxing = 'maxWait' in options;
  27764. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27765. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27766. }
  27767. function invokeFunc(time) {
  27768. var args = lastArgs,
  27769. thisArg = lastThis;
  27770. lastArgs = lastThis = undefined;
  27771. lastInvokeTime = time;
  27772. result = func.apply(thisArg, args);
  27773. return result;
  27774. }
  27775. function leadingEdge(time) {
  27776. // Reset any `maxWait` timer.
  27777. lastInvokeTime = time;
  27778. // Start the timer for the trailing edge.
  27779. timerId = setTimeout(timerExpired, wait);
  27780. // Invoke the leading edge.
  27781. return leading ? invokeFunc(time) : result;
  27782. }
  27783. function remainingWait(time) {
  27784. var timeSinceLastCall = time - lastCallTime,
  27785. timeSinceLastInvoke = time - lastInvokeTime,
  27786. timeWaiting = wait - timeSinceLastCall;
  27787. return maxing
  27788. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27789. : timeWaiting;
  27790. }
  27791. function shouldInvoke(time) {
  27792. var timeSinceLastCall = time - lastCallTime,
  27793. timeSinceLastInvoke = time - lastInvokeTime;
  27794. // Either this is the first call, activity has stopped and we're at the
  27795. // trailing edge, the system time has gone backwards and we're treating
  27796. // it as the trailing edge, or we've hit the `maxWait` limit.
  27797. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27798. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27799. }
  27800. function timerExpired() {
  27801. var time = now();
  27802. if (shouldInvoke(time)) {
  27803. return trailingEdge(time);
  27804. }
  27805. // Restart the timer.
  27806. timerId = setTimeout(timerExpired, remainingWait(time));
  27807. }
  27808. function trailingEdge(time) {
  27809. timerId = undefined;
  27810. // Only invoke if we have `lastArgs` which means `func` has been
  27811. // debounced at least once.
  27812. if (trailing && lastArgs) {
  27813. return invokeFunc(time);
  27814. }
  27815. lastArgs = lastThis = undefined;
  27816. return result;
  27817. }
  27818. function cancel() {
  27819. if (timerId !== undefined) {
  27820. clearTimeout(timerId);
  27821. }
  27822. lastInvokeTime = 0;
  27823. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27824. }
  27825. function flush() {
  27826. return timerId === undefined ? result : trailingEdge(now());
  27827. }
  27828. function debounced() {
  27829. var time = now(),
  27830. isInvoking = shouldInvoke(time);
  27831. lastArgs = arguments;
  27832. lastThis = this;
  27833. lastCallTime = time;
  27834. if (isInvoking) {
  27835. if (timerId === undefined) {
  27836. return leadingEdge(lastCallTime);
  27837. }
  27838. if (maxing) {
  27839. // Handle invocations in a tight loop.
  27840. clearTimeout(timerId);
  27841. timerId = setTimeout(timerExpired, wait);
  27842. return invokeFunc(lastCallTime);
  27843. }
  27844. }
  27845. if (timerId === undefined) {
  27846. timerId = setTimeout(timerExpired, wait);
  27847. }
  27848. return result;
  27849. }
  27850. debounced.cancel = cancel;
  27851. debounced.flush = flush;
  27852. return debounced;
  27853. }
  27854. /**
  27855. * Defers invoking the `func` until the current call stack has cleared. Any
  27856. * additional arguments are provided to `func` when it's invoked.
  27857. *
  27858. * @static
  27859. * @memberOf _
  27860. * @since 0.1.0
  27861. * @category Function
  27862. * @param {Function} func The function to defer.
  27863. * @param {...*} [args] The arguments to invoke `func` with.
  27864. * @returns {number} Returns the timer id.
  27865. * @example
  27866. *
  27867. * _.defer(function(text) {
  27868. * console.log(text);
  27869. * }, 'deferred');
  27870. * // => Logs 'deferred' after one millisecond.
  27871. */
  27872. var defer = baseRest(function(func, args) {
  27873. return baseDelay(func, 1, args);
  27874. });
  27875. /**
  27876. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27877. * provided to `func` when it's invoked.
  27878. *
  27879. * @static
  27880. * @memberOf _
  27881. * @since 0.1.0
  27882. * @category Function
  27883. * @param {Function} func The function to delay.
  27884. * @param {number} wait The number of milliseconds to delay invocation.
  27885. * @param {...*} [args] The arguments to invoke `func` with.
  27886. * @returns {number} Returns the timer id.
  27887. * @example
  27888. *
  27889. * _.delay(function(text) {
  27890. * console.log(text);
  27891. * }, 1000, 'later');
  27892. * // => Logs 'later' after one second.
  27893. */
  27894. var delay = baseRest(function(func, wait, args) {
  27895. return baseDelay(func, toNumber(wait) || 0, args);
  27896. });
  27897. /**
  27898. * Creates a function that invokes `func` with arguments reversed.
  27899. *
  27900. * @static
  27901. * @memberOf _
  27902. * @since 4.0.0
  27903. * @category Function
  27904. * @param {Function} func The function to flip arguments for.
  27905. * @returns {Function} Returns the new flipped function.
  27906. * @example
  27907. *
  27908. * var flipped = _.flip(function() {
  27909. * return _.toArray(arguments);
  27910. * });
  27911. *
  27912. * flipped('a', 'b', 'c', 'd');
  27913. * // => ['d', 'c', 'b', 'a']
  27914. */
  27915. function flip(func) {
  27916. return createWrap(func, WRAP_FLIP_FLAG);
  27917. }
  27918. /**
  27919. * Creates a function that memoizes the result of `func`. If `resolver` is
  27920. * provided, it determines the cache key for storing the result based on the
  27921. * arguments provided to the memoized function. By default, the first argument
  27922. * provided to the memoized function is used as the map cache key. The `func`
  27923. * is invoked with the `this` binding of the memoized function.
  27924. *
  27925. * **Note:** The cache is exposed as the `cache` property on the memoized
  27926. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  27927. * constructor with one whose instances implement the
  27928. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  27929. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  27930. *
  27931. * @static
  27932. * @memberOf _
  27933. * @since 0.1.0
  27934. * @category Function
  27935. * @param {Function} func The function to have its output memoized.
  27936. * @param {Function} [resolver] The function to resolve the cache key.
  27937. * @returns {Function} Returns the new memoized function.
  27938. * @example
  27939. *
  27940. * var object = { 'a': 1, 'b': 2 };
  27941. * var other = { 'c': 3, 'd': 4 };
  27942. *
  27943. * var values = _.memoize(_.values);
  27944. * values(object);
  27945. * // => [1, 2]
  27946. *
  27947. * values(other);
  27948. * // => [3, 4]
  27949. *
  27950. * object.a = 2;
  27951. * values(object);
  27952. * // => [1, 2]
  27953. *
  27954. * // Modify the result cache.
  27955. * values.cache.set(object, ['a', 'b']);
  27956. * values(object);
  27957. * // => ['a', 'b']
  27958. *
  27959. * // Replace `_.memoize.Cache`.
  27960. * _.memoize.Cache = WeakMap;
  27961. */
  27962. function memoize(func, resolver) {
  27963. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  27964. throw new TypeError(FUNC_ERROR_TEXT);
  27965. }
  27966. var memoized = function() {
  27967. var args = arguments,
  27968. key = resolver ? resolver.apply(this, args) : args[0],
  27969. cache = memoized.cache;
  27970. if (cache.has(key)) {
  27971. return cache.get(key);
  27972. }
  27973. var result = func.apply(this, args);
  27974. memoized.cache = cache.set(key, result) || cache;
  27975. return result;
  27976. };
  27977. memoized.cache = new (memoize.Cache || MapCache);
  27978. return memoized;
  27979. }
  27980. // Expose `MapCache`.
  27981. memoize.Cache = MapCache;
  27982. /**
  27983. * Creates a function that negates the result of the predicate `func`. The
  27984. * `func` predicate is invoked with the `this` binding and arguments of the
  27985. * created function.
  27986. *
  27987. * @static
  27988. * @memberOf _
  27989. * @since 3.0.0
  27990. * @category Function
  27991. * @param {Function} predicate The predicate to negate.
  27992. * @returns {Function} Returns the new negated function.
  27993. * @example
  27994. *
  27995. * function isEven(n) {
  27996. * return n % 2 == 0;
  27997. * }
  27998. *
  27999. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28000. * // => [1, 3, 5]
  28001. */
  28002. function negate(predicate) {
  28003. if (typeof predicate != 'function') {
  28004. throw new TypeError(FUNC_ERROR_TEXT);
  28005. }
  28006. return function() {
  28007. var args = arguments;
  28008. switch (args.length) {
  28009. case 0: return !predicate.call(this);
  28010. case 1: return !predicate.call(this, args[0]);
  28011. case 2: return !predicate.call(this, args[0], args[1]);
  28012. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28013. }
  28014. return !predicate.apply(this, args);
  28015. };
  28016. }
  28017. /**
  28018. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28019. * to the function return the value of the first invocation. The `func` is
  28020. * invoked with the `this` binding and arguments of the created function.
  28021. *
  28022. * @static
  28023. * @memberOf _
  28024. * @since 0.1.0
  28025. * @category Function
  28026. * @param {Function} func The function to restrict.
  28027. * @returns {Function} Returns the new restricted function.
  28028. * @example
  28029. *
  28030. * var initialize = _.once(createApplication);
  28031. * initialize();
  28032. * initialize();
  28033. * // => `createApplication` is invoked once
  28034. */
  28035. function once(func) {
  28036. return before(2, func);
  28037. }
  28038. /**
  28039. * Creates a function that invokes `func` with its arguments transformed.
  28040. *
  28041. * @static
  28042. * @since 4.0.0
  28043. * @memberOf _
  28044. * @category Function
  28045. * @param {Function} func The function to wrap.
  28046. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28047. * The argument transforms.
  28048. * @returns {Function} Returns the new function.
  28049. * @example
  28050. *
  28051. * function doubled(n) {
  28052. * return n * 2;
  28053. * }
  28054. *
  28055. * function square(n) {
  28056. * return n * n;
  28057. * }
  28058. *
  28059. * var func = _.overArgs(function(x, y) {
  28060. * return [x, y];
  28061. * }, [square, doubled]);
  28062. *
  28063. * func(9, 3);
  28064. * // => [81, 6]
  28065. *
  28066. * func(10, 5);
  28067. * // => [100, 10]
  28068. */
  28069. var overArgs = castRest(function(func, transforms) {
  28070. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28071. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28072. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28073. var funcsLength = transforms.length;
  28074. return baseRest(function(args) {
  28075. var index = -1,
  28076. length = nativeMin(args.length, funcsLength);
  28077. while (++index < length) {
  28078. args[index] = transforms[index].call(this, args[index]);
  28079. }
  28080. return apply(func, this, args);
  28081. });
  28082. });
  28083. /**
  28084. * Creates a function that invokes `func` with `partials` prepended to the
  28085. * arguments it receives. This method is like `_.bind` except it does **not**
  28086. * alter the `this` binding.
  28087. *
  28088. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28089. * builds, may be used as a placeholder for partially applied arguments.
  28090. *
  28091. * **Note:** This method doesn't set the "length" property of partially
  28092. * applied functions.
  28093. *
  28094. * @static
  28095. * @memberOf _
  28096. * @since 0.2.0
  28097. * @category Function
  28098. * @param {Function} func The function to partially apply arguments to.
  28099. * @param {...*} [partials] The arguments to be partially applied.
  28100. * @returns {Function} Returns the new partially applied function.
  28101. * @example
  28102. *
  28103. * function greet(greeting, name) {
  28104. * return greeting + ' ' + name;
  28105. * }
  28106. *
  28107. * var sayHelloTo = _.partial(greet, 'hello');
  28108. * sayHelloTo('fred');
  28109. * // => 'hello fred'
  28110. *
  28111. * // Partially applied with placeholders.
  28112. * var greetFred = _.partial(greet, _, 'fred');
  28113. * greetFred('hi');
  28114. * // => 'hi fred'
  28115. */
  28116. var partial = baseRest(function(func, partials) {
  28117. var holders = replaceHolders(partials, getHolder(partial));
  28118. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28119. });
  28120. /**
  28121. * This method is like `_.partial` except that partially applied arguments
  28122. * are appended to the arguments it receives.
  28123. *
  28124. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28125. * builds, may be used as a placeholder for partially applied arguments.
  28126. *
  28127. * **Note:** This method doesn't set the "length" property of partially
  28128. * applied functions.
  28129. *
  28130. * @static
  28131. * @memberOf _
  28132. * @since 1.0.0
  28133. * @category Function
  28134. * @param {Function} func The function to partially apply arguments to.
  28135. * @param {...*} [partials] The arguments to be partially applied.
  28136. * @returns {Function} Returns the new partially applied function.
  28137. * @example
  28138. *
  28139. * function greet(greeting, name) {
  28140. * return greeting + ' ' + name;
  28141. * }
  28142. *
  28143. * var greetFred = _.partialRight(greet, 'fred');
  28144. * greetFred('hi');
  28145. * // => 'hi fred'
  28146. *
  28147. * // Partially applied with placeholders.
  28148. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28149. * sayHelloTo('fred');
  28150. * // => 'hello fred'
  28151. */
  28152. var partialRight = baseRest(function(func, partials) {
  28153. var holders = replaceHolders(partials, getHolder(partialRight));
  28154. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28155. });
  28156. /**
  28157. * Creates a function that invokes `func` with arguments arranged according
  28158. * to the specified `indexes` where the argument value at the first index is
  28159. * provided as the first argument, the argument value at the second index is
  28160. * provided as the second argument, and so on.
  28161. *
  28162. * @static
  28163. * @memberOf _
  28164. * @since 3.0.0
  28165. * @category Function
  28166. * @param {Function} func The function to rearrange arguments for.
  28167. * @param {...(number|number[])} indexes The arranged argument indexes.
  28168. * @returns {Function} Returns the new function.
  28169. * @example
  28170. *
  28171. * var rearged = _.rearg(function(a, b, c) {
  28172. * return [a, b, c];
  28173. * }, [2, 0, 1]);
  28174. *
  28175. * rearged('b', 'c', 'a')
  28176. * // => ['a', 'b', 'c']
  28177. */
  28178. var rearg = flatRest(function(func, indexes) {
  28179. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28180. });
  28181. /**
  28182. * Creates a function that invokes `func` with the `this` binding of the
  28183. * created function and arguments from `start` and beyond provided as
  28184. * an array.
  28185. *
  28186. * **Note:** This method is based on the
  28187. * [rest parameter](https://mdn.io/rest_parameters).
  28188. *
  28189. * @static
  28190. * @memberOf _
  28191. * @since 4.0.0
  28192. * @category Function
  28193. * @param {Function} func The function to apply a rest parameter to.
  28194. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28195. * @returns {Function} Returns the new function.
  28196. * @example
  28197. *
  28198. * var say = _.rest(function(what, names) {
  28199. * return what + ' ' + _.initial(names).join(', ') +
  28200. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28201. * });
  28202. *
  28203. * say('hello', 'fred', 'barney', 'pebbles');
  28204. * // => 'hello fred, barney, & pebbles'
  28205. */
  28206. function rest(func, start) {
  28207. if (typeof func != 'function') {
  28208. throw new TypeError(FUNC_ERROR_TEXT);
  28209. }
  28210. start = start === undefined ? start : toInteger(start);
  28211. return baseRest(func, start);
  28212. }
  28213. /**
  28214. * Creates a function that invokes `func` with the `this` binding of the
  28215. * create function and an array of arguments much like
  28216. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28217. *
  28218. * **Note:** This method is based on the
  28219. * [spread operator](https://mdn.io/spread_operator).
  28220. *
  28221. * @static
  28222. * @memberOf _
  28223. * @since 3.2.0
  28224. * @category Function
  28225. * @param {Function} func The function to spread arguments over.
  28226. * @param {number} [start=0] The start position of the spread.
  28227. * @returns {Function} Returns the new function.
  28228. * @example
  28229. *
  28230. * var say = _.spread(function(who, what) {
  28231. * return who + ' says ' + what;
  28232. * });
  28233. *
  28234. * say(['fred', 'hello']);
  28235. * // => 'fred says hello'
  28236. *
  28237. * var numbers = Promise.all([
  28238. * Promise.resolve(40),
  28239. * Promise.resolve(36)
  28240. * ]);
  28241. *
  28242. * numbers.then(_.spread(function(x, y) {
  28243. * return x + y;
  28244. * }));
  28245. * // => a Promise of 76
  28246. */
  28247. function spread(func, start) {
  28248. if (typeof func != 'function') {
  28249. throw new TypeError(FUNC_ERROR_TEXT);
  28250. }
  28251. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28252. return baseRest(function(args) {
  28253. var array = args[start],
  28254. otherArgs = castSlice(args, 0, start);
  28255. if (array) {
  28256. arrayPush(otherArgs, array);
  28257. }
  28258. return apply(func, this, otherArgs);
  28259. });
  28260. }
  28261. /**
  28262. * Creates a throttled function that only invokes `func` at most once per
  28263. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28264. * method to cancel delayed `func` invocations and a `flush` method to
  28265. * immediately invoke them. Provide `options` to indicate whether `func`
  28266. * should be invoked on the leading and/or trailing edge of the `wait`
  28267. * timeout. The `func` is invoked with the last arguments provided to the
  28268. * throttled function. Subsequent calls to the throttled function return the
  28269. * result of the last `func` invocation.
  28270. *
  28271. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28272. * invoked on the trailing edge of the timeout only if the throttled function
  28273. * is invoked more than once during the `wait` timeout.
  28274. *
  28275. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28276. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28277. *
  28278. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28279. * for details over the differences between `_.throttle` and `_.debounce`.
  28280. *
  28281. * @static
  28282. * @memberOf _
  28283. * @since 0.1.0
  28284. * @category Function
  28285. * @param {Function} func The function to throttle.
  28286. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28287. * @param {Object} [options={}] The options object.
  28288. * @param {boolean} [options.leading=true]
  28289. * Specify invoking on the leading edge of the timeout.
  28290. * @param {boolean} [options.trailing=true]
  28291. * Specify invoking on the trailing edge of the timeout.
  28292. * @returns {Function} Returns the new throttled function.
  28293. * @example
  28294. *
  28295. * // Avoid excessively updating the position while scrolling.
  28296. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28297. *
  28298. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28299. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28300. * jQuery(element).on('click', throttled);
  28301. *
  28302. * // Cancel the trailing throttled invocation.
  28303. * jQuery(window).on('popstate', throttled.cancel);
  28304. */
  28305. function throttle(func, wait, options) {
  28306. var leading = true,
  28307. trailing = true;
  28308. if (typeof func != 'function') {
  28309. throw new TypeError(FUNC_ERROR_TEXT);
  28310. }
  28311. if (isObject(options)) {
  28312. leading = 'leading' in options ? !!options.leading : leading;
  28313. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28314. }
  28315. return debounce(func, wait, {
  28316. 'leading': leading,
  28317. 'maxWait': wait,
  28318. 'trailing': trailing
  28319. });
  28320. }
  28321. /**
  28322. * Creates a function that accepts up to one argument, ignoring any
  28323. * additional arguments.
  28324. *
  28325. * @static
  28326. * @memberOf _
  28327. * @since 4.0.0
  28328. * @category Function
  28329. * @param {Function} func The function to cap arguments for.
  28330. * @returns {Function} Returns the new capped function.
  28331. * @example
  28332. *
  28333. * _.map(['6', '8', '10'], _.unary(parseInt));
  28334. * // => [6, 8, 10]
  28335. */
  28336. function unary(func) {
  28337. return ary(func, 1);
  28338. }
  28339. /**
  28340. * Creates a function that provides `value` to `wrapper` as its first
  28341. * argument. Any additional arguments provided to the function are appended
  28342. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28343. * binding of the created function.
  28344. *
  28345. * @static
  28346. * @memberOf _
  28347. * @since 0.1.0
  28348. * @category Function
  28349. * @param {*} value The value to wrap.
  28350. * @param {Function} [wrapper=identity] The wrapper function.
  28351. * @returns {Function} Returns the new function.
  28352. * @example
  28353. *
  28354. * var p = _.wrap(_.escape, function(func, text) {
  28355. * return '<p>' + func(text) + '</p>';
  28356. * });
  28357. *
  28358. * p('fred, barney, & pebbles');
  28359. * // => '<p>fred, barney, &amp; pebbles</p>'
  28360. */
  28361. function wrap(value, wrapper) {
  28362. return partial(castFunction(wrapper), value);
  28363. }
  28364. /*------------------------------------------------------------------------*/
  28365. /**
  28366. * Casts `value` as an array if it's not one.
  28367. *
  28368. * @static
  28369. * @memberOf _
  28370. * @since 4.4.0
  28371. * @category Lang
  28372. * @param {*} value The value to inspect.
  28373. * @returns {Array} Returns the cast array.
  28374. * @example
  28375. *
  28376. * _.castArray(1);
  28377. * // => [1]
  28378. *
  28379. * _.castArray({ 'a': 1 });
  28380. * // => [{ 'a': 1 }]
  28381. *
  28382. * _.castArray('abc');
  28383. * // => ['abc']
  28384. *
  28385. * _.castArray(null);
  28386. * // => [null]
  28387. *
  28388. * _.castArray(undefined);
  28389. * // => [undefined]
  28390. *
  28391. * _.castArray();
  28392. * // => []
  28393. *
  28394. * var array = [1, 2, 3];
  28395. * console.log(_.castArray(array) === array);
  28396. * // => true
  28397. */
  28398. function castArray() {
  28399. if (!arguments.length) {
  28400. return [];
  28401. }
  28402. var value = arguments[0];
  28403. return isArray(value) ? value : [value];
  28404. }
  28405. /**
  28406. * Creates a shallow clone of `value`.
  28407. *
  28408. * **Note:** This method is loosely based on the
  28409. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28410. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28411. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28412. * arrays. The own enumerable properties of `arguments` objects are cloned
  28413. * as plain objects. An empty object is returned for uncloneable values such
  28414. * as error objects, functions, DOM nodes, and WeakMaps.
  28415. *
  28416. * @static
  28417. * @memberOf _
  28418. * @since 0.1.0
  28419. * @category Lang
  28420. * @param {*} value The value to clone.
  28421. * @returns {*} Returns the cloned value.
  28422. * @see _.cloneDeep
  28423. * @example
  28424. *
  28425. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28426. *
  28427. * var shallow = _.clone(objects);
  28428. * console.log(shallow[0] === objects[0]);
  28429. * // => true
  28430. */
  28431. function clone(value) {
  28432. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28433. }
  28434. /**
  28435. * This method is like `_.clone` except that it accepts `customizer` which
  28436. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28437. * cloning is handled by the method instead. The `customizer` is invoked with
  28438. * up to four arguments; (value [, index|key, object, stack]).
  28439. *
  28440. * @static
  28441. * @memberOf _
  28442. * @since 4.0.0
  28443. * @category Lang
  28444. * @param {*} value The value to clone.
  28445. * @param {Function} [customizer] The function to customize cloning.
  28446. * @returns {*} Returns the cloned value.
  28447. * @see _.cloneDeepWith
  28448. * @example
  28449. *
  28450. * function customizer(value) {
  28451. * if (_.isElement(value)) {
  28452. * return value.cloneNode(false);
  28453. * }
  28454. * }
  28455. *
  28456. * var el = _.cloneWith(document.body, customizer);
  28457. *
  28458. * console.log(el === document.body);
  28459. * // => false
  28460. * console.log(el.nodeName);
  28461. * // => 'BODY'
  28462. * console.log(el.childNodes.length);
  28463. * // => 0
  28464. */
  28465. function cloneWith(value, customizer) {
  28466. customizer = typeof customizer == 'function' ? customizer : undefined;
  28467. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28468. }
  28469. /**
  28470. * This method is like `_.clone` except that it recursively clones `value`.
  28471. *
  28472. * @static
  28473. * @memberOf _
  28474. * @since 1.0.0
  28475. * @category Lang
  28476. * @param {*} value The value to recursively clone.
  28477. * @returns {*} Returns the deep cloned value.
  28478. * @see _.clone
  28479. * @example
  28480. *
  28481. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28482. *
  28483. * var deep = _.cloneDeep(objects);
  28484. * console.log(deep[0] === objects[0]);
  28485. * // => false
  28486. */
  28487. function cloneDeep(value) {
  28488. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28489. }
  28490. /**
  28491. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28492. *
  28493. * @static
  28494. * @memberOf _
  28495. * @since 4.0.0
  28496. * @category Lang
  28497. * @param {*} value The value to recursively clone.
  28498. * @param {Function} [customizer] The function to customize cloning.
  28499. * @returns {*} Returns the deep cloned value.
  28500. * @see _.cloneWith
  28501. * @example
  28502. *
  28503. * function customizer(value) {
  28504. * if (_.isElement(value)) {
  28505. * return value.cloneNode(true);
  28506. * }
  28507. * }
  28508. *
  28509. * var el = _.cloneDeepWith(document.body, customizer);
  28510. *
  28511. * console.log(el === document.body);
  28512. * // => false
  28513. * console.log(el.nodeName);
  28514. * // => 'BODY'
  28515. * console.log(el.childNodes.length);
  28516. * // => 20
  28517. */
  28518. function cloneDeepWith(value, customizer) {
  28519. customizer = typeof customizer == 'function' ? customizer : undefined;
  28520. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28521. }
  28522. /**
  28523. * Checks if `object` conforms to `source` by invoking the predicate
  28524. * properties of `source` with the corresponding property values of `object`.
  28525. *
  28526. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28527. * partially applied.
  28528. *
  28529. * @static
  28530. * @memberOf _
  28531. * @since 4.14.0
  28532. * @category Lang
  28533. * @param {Object} object The object to inspect.
  28534. * @param {Object} source The object of property predicates to conform to.
  28535. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28536. * @example
  28537. *
  28538. * var object = { 'a': 1, 'b': 2 };
  28539. *
  28540. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28541. * // => true
  28542. *
  28543. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28544. * // => false
  28545. */
  28546. function conformsTo(object, source) {
  28547. return source == null || baseConformsTo(object, source, keys(source));
  28548. }
  28549. /**
  28550. * Performs a
  28551. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28552. * comparison between two values to determine if they are equivalent.
  28553. *
  28554. * @static
  28555. * @memberOf _
  28556. * @since 4.0.0
  28557. * @category Lang
  28558. * @param {*} value The value to compare.
  28559. * @param {*} other The other value to compare.
  28560. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28561. * @example
  28562. *
  28563. * var object = { 'a': 1 };
  28564. * var other = { 'a': 1 };
  28565. *
  28566. * _.eq(object, object);
  28567. * // => true
  28568. *
  28569. * _.eq(object, other);
  28570. * // => false
  28571. *
  28572. * _.eq('a', 'a');
  28573. * // => true
  28574. *
  28575. * _.eq('a', Object('a'));
  28576. * // => false
  28577. *
  28578. * _.eq(NaN, NaN);
  28579. * // => true
  28580. */
  28581. function eq(value, other) {
  28582. return value === other || (value !== value && other !== other);
  28583. }
  28584. /**
  28585. * Checks if `value` is greater than `other`.
  28586. *
  28587. * @static
  28588. * @memberOf _
  28589. * @since 3.9.0
  28590. * @category Lang
  28591. * @param {*} value The value to compare.
  28592. * @param {*} other The other value to compare.
  28593. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28594. * else `false`.
  28595. * @see _.lt
  28596. * @example
  28597. *
  28598. * _.gt(3, 1);
  28599. * // => true
  28600. *
  28601. * _.gt(3, 3);
  28602. * // => false
  28603. *
  28604. * _.gt(1, 3);
  28605. * // => false
  28606. */
  28607. var gt = createRelationalOperation(baseGt);
  28608. /**
  28609. * Checks if `value` is greater than or equal to `other`.
  28610. *
  28611. * @static
  28612. * @memberOf _
  28613. * @since 3.9.0
  28614. * @category Lang
  28615. * @param {*} value The value to compare.
  28616. * @param {*} other The other value to compare.
  28617. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28618. * `other`, else `false`.
  28619. * @see _.lte
  28620. * @example
  28621. *
  28622. * _.gte(3, 1);
  28623. * // => true
  28624. *
  28625. * _.gte(3, 3);
  28626. * // => true
  28627. *
  28628. * _.gte(1, 3);
  28629. * // => false
  28630. */
  28631. var gte = createRelationalOperation(function(value, other) {
  28632. return value >= other;
  28633. });
  28634. /**
  28635. * Checks if `value` is likely an `arguments` object.
  28636. *
  28637. * @static
  28638. * @memberOf _
  28639. * @since 0.1.0
  28640. * @category Lang
  28641. * @param {*} value The value to check.
  28642. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28643. * else `false`.
  28644. * @example
  28645. *
  28646. * _.isArguments(function() { return arguments; }());
  28647. * // => true
  28648. *
  28649. * _.isArguments([1, 2, 3]);
  28650. * // => false
  28651. */
  28652. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28653. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28654. !propertyIsEnumerable.call(value, 'callee');
  28655. };
  28656. /**
  28657. * Checks if `value` is classified as an `Array` object.
  28658. *
  28659. * @static
  28660. * @memberOf _
  28661. * @since 0.1.0
  28662. * @category Lang
  28663. * @param {*} value The value to check.
  28664. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28665. * @example
  28666. *
  28667. * _.isArray([1, 2, 3]);
  28668. * // => true
  28669. *
  28670. * _.isArray(document.body.children);
  28671. * // => false
  28672. *
  28673. * _.isArray('abc');
  28674. * // => false
  28675. *
  28676. * _.isArray(_.noop);
  28677. * // => false
  28678. */
  28679. var isArray = Array.isArray;
  28680. /**
  28681. * Checks if `value` is classified as an `ArrayBuffer` object.
  28682. *
  28683. * @static
  28684. * @memberOf _
  28685. * @since 4.3.0
  28686. * @category Lang
  28687. * @param {*} value The value to check.
  28688. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28689. * @example
  28690. *
  28691. * _.isArrayBuffer(new ArrayBuffer(2));
  28692. * // => true
  28693. *
  28694. * _.isArrayBuffer(new Array(2));
  28695. * // => false
  28696. */
  28697. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28698. /**
  28699. * Checks if `value` is array-like. A value is considered array-like if it's
  28700. * not a function and has a `value.length` that's an integer greater than or
  28701. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28702. *
  28703. * @static
  28704. * @memberOf _
  28705. * @since 4.0.0
  28706. * @category Lang
  28707. * @param {*} value The value to check.
  28708. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28709. * @example
  28710. *
  28711. * _.isArrayLike([1, 2, 3]);
  28712. * // => true
  28713. *
  28714. * _.isArrayLike(document.body.children);
  28715. * // => true
  28716. *
  28717. * _.isArrayLike('abc');
  28718. * // => true
  28719. *
  28720. * _.isArrayLike(_.noop);
  28721. * // => false
  28722. */
  28723. function isArrayLike(value) {
  28724. return value != null && isLength(value.length) && !isFunction(value);
  28725. }
  28726. /**
  28727. * This method is like `_.isArrayLike` except that it also checks if `value`
  28728. * is an object.
  28729. *
  28730. * @static
  28731. * @memberOf _
  28732. * @since 4.0.0
  28733. * @category Lang
  28734. * @param {*} value The value to check.
  28735. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28736. * else `false`.
  28737. * @example
  28738. *
  28739. * _.isArrayLikeObject([1, 2, 3]);
  28740. * // => true
  28741. *
  28742. * _.isArrayLikeObject(document.body.children);
  28743. * // => true
  28744. *
  28745. * _.isArrayLikeObject('abc');
  28746. * // => false
  28747. *
  28748. * _.isArrayLikeObject(_.noop);
  28749. * // => false
  28750. */
  28751. function isArrayLikeObject(value) {
  28752. return isObjectLike(value) && isArrayLike(value);
  28753. }
  28754. /**
  28755. * Checks if `value` is classified as a boolean primitive or 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 a boolean, else `false`.
  28763. * @example
  28764. *
  28765. * _.isBoolean(false);
  28766. * // => true
  28767. *
  28768. * _.isBoolean(null);
  28769. * // => false
  28770. */
  28771. function isBoolean(value) {
  28772. return value === true || value === false ||
  28773. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28774. }
  28775. /**
  28776. * Checks if `value` is a buffer.
  28777. *
  28778. * @static
  28779. * @memberOf _
  28780. * @since 4.3.0
  28781. * @category Lang
  28782. * @param {*} value The value to check.
  28783. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28784. * @example
  28785. *
  28786. * _.isBuffer(new Buffer(2));
  28787. * // => true
  28788. *
  28789. * _.isBuffer(new Uint8Array(2));
  28790. * // => false
  28791. */
  28792. var isBuffer = nativeIsBuffer || stubFalse;
  28793. /**
  28794. * Checks if `value` is classified as a `Date` object.
  28795. *
  28796. * @static
  28797. * @memberOf _
  28798. * @since 0.1.0
  28799. * @category Lang
  28800. * @param {*} value The value to check.
  28801. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28802. * @example
  28803. *
  28804. * _.isDate(new Date);
  28805. * // => true
  28806. *
  28807. * _.isDate('Mon April 23 2012');
  28808. * // => false
  28809. */
  28810. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28811. /**
  28812. * Checks if `value` is likely a DOM element.
  28813. *
  28814. * @static
  28815. * @memberOf _
  28816. * @since 0.1.0
  28817. * @category Lang
  28818. * @param {*} value The value to check.
  28819. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28820. * @example
  28821. *
  28822. * _.isElement(document.body);
  28823. * // => true
  28824. *
  28825. * _.isElement('<body>');
  28826. * // => false
  28827. */
  28828. function isElement(value) {
  28829. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28830. }
  28831. /**
  28832. * Checks if `value` is an empty object, collection, map, or set.
  28833. *
  28834. * Objects are considered empty if they have no own enumerable string keyed
  28835. * properties.
  28836. *
  28837. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28838. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28839. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28840. *
  28841. * @static
  28842. * @memberOf _
  28843. * @since 0.1.0
  28844. * @category Lang
  28845. * @param {*} value The value to check.
  28846. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28847. * @example
  28848. *
  28849. * _.isEmpty(null);
  28850. * // => true
  28851. *
  28852. * _.isEmpty(true);
  28853. * // => true
  28854. *
  28855. * _.isEmpty(1);
  28856. * // => true
  28857. *
  28858. * _.isEmpty([1, 2, 3]);
  28859. * // => false
  28860. *
  28861. * _.isEmpty({ 'a': 1 });
  28862. * // => false
  28863. */
  28864. function isEmpty(value) {
  28865. if (value == null) {
  28866. return true;
  28867. }
  28868. if (isArrayLike(value) &&
  28869. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28870. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28871. return !value.length;
  28872. }
  28873. var tag = getTag(value);
  28874. if (tag == mapTag || tag == setTag) {
  28875. return !value.size;
  28876. }
  28877. if (isPrototype(value)) {
  28878. return !baseKeys(value).length;
  28879. }
  28880. for (var key in value) {
  28881. if (hasOwnProperty.call(value, key)) {
  28882. return false;
  28883. }
  28884. }
  28885. return true;
  28886. }
  28887. /**
  28888. * Performs a deep comparison between two values to determine if they are
  28889. * equivalent.
  28890. *
  28891. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28892. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28893. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28894. * by their own, not inherited, enumerable properties. Functions and DOM
  28895. * nodes are compared by strict equality, i.e. `===`.
  28896. *
  28897. * @static
  28898. * @memberOf _
  28899. * @since 0.1.0
  28900. * @category Lang
  28901. * @param {*} value The value to compare.
  28902. * @param {*} other The other value to compare.
  28903. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28904. * @example
  28905. *
  28906. * var object = { 'a': 1 };
  28907. * var other = { 'a': 1 };
  28908. *
  28909. * _.isEqual(object, other);
  28910. * // => true
  28911. *
  28912. * object === other;
  28913. * // => false
  28914. */
  28915. function isEqual(value, other) {
  28916. return baseIsEqual(value, other);
  28917. }
  28918. /**
  28919. * This method is like `_.isEqual` except that it accepts `customizer` which
  28920. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28921. * are handled by the method instead. The `customizer` is invoked with up to
  28922. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  28923. *
  28924. * @static
  28925. * @memberOf _
  28926. * @since 4.0.0
  28927. * @category Lang
  28928. * @param {*} value The value to compare.
  28929. * @param {*} other The other value to compare.
  28930. * @param {Function} [customizer] The function to customize comparisons.
  28931. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28932. * @example
  28933. *
  28934. * function isGreeting(value) {
  28935. * return /^h(?:i|ello)$/.test(value);
  28936. * }
  28937. *
  28938. * function customizer(objValue, othValue) {
  28939. * if (isGreeting(objValue) && isGreeting(othValue)) {
  28940. * return true;
  28941. * }
  28942. * }
  28943. *
  28944. * var array = ['hello', 'goodbye'];
  28945. * var other = ['hi', 'goodbye'];
  28946. *
  28947. * _.isEqualWith(array, other, customizer);
  28948. * // => true
  28949. */
  28950. function isEqualWith(value, other, customizer) {
  28951. customizer = typeof customizer == 'function' ? customizer : undefined;
  28952. var result = customizer ? customizer(value, other) : undefined;
  28953. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  28954. }
  28955. /**
  28956. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  28957. * `SyntaxError`, `TypeError`, or `URIError` object.
  28958. *
  28959. * @static
  28960. * @memberOf _
  28961. * @since 3.0.0
  28962. * @category Lang
  28963. * @param {*} value The value to check.
  28964. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  28965. * @example
  28966. *
  28967. * _.isError(new Error);
  28968. * // => true
  28969. *
  28970. * _.isError(Error);
  28971. * // => false
  28972. */
  28973. function isError(value) {
  28974. if (!isObjectLike(value)) {
  28975. return false;
  28976. }
  28977. var tag = baseGetTag(value);
  28978. return tag == errorTag || tag == domExcTag ||
  28979. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  28980. }
  28981. /**
  28982. * Checks if `value` is a finite primitive number.
  28983. *
  28984. * **Note:** This method is based on
  28985. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  28986. *
  28987. * @static
  28988. * @memberOf _
  28989. * @since 0.1.0
  28990. * @category Lang
  28991. * @param {*} value The value to check.
  28992. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  28993. * @example
  28994. *
  28995. * _.isFinite(3);
  28996. * // => true
  28997. *
  28998. * _.isFinite(Number.MIN_VALUE);
  28999. * // => true
  29000. *
  29001. * _.isFinite(Infinity);
  29002. * // => false
  29003. *
  29004. * _.isFinite('3');
  29005. * // => false
  29006. */
  29007. function isFinite(value) {
  29008. return typeof value == 'number' && nativeIsFinite(value);
  29009. }
  29010. /**
  29011. * Checks if `value` is classified as a `Function` object.
  29012. *
  29013. * @static
  29014. * @memberOf _
  29015. * @since 0.1.0
  29016. * @category Lang
  29017. * @param {*} value The value to check.
  29018. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29019. * @example
  29020. *
  29021. * _.isFunction(_);
  29022. * // => true
  29023. *
  29024. * _.isFunction(/abc/);
  29025. * // => false
  29026. */
  29027. function isFunction(value) {
  29028. if (!isObject(value)) {
  29029. return false;
  29030. }
  29031. // The use of `Object#toString` avoids issues with the `typeof` operator
  29032. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29033. var tag = baseGetTag(value);
  29034. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29035. }
  29036. /**
  29037. * Checks if `value` is an integer.
  29038. *
  29039. * **Note:** This method is based on
  29040. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29041. *
  29042. * @static
  29043. * @memberOf _
  29044. * @since 4.0.0
  29045. * @category Lang
  29046. * @param {*} value The value to check.
  29047. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29048. * @example
  29049. *
  29050. * _.isInteger(3);
  29051. * // => true
  29052. *
  29053. * _.isInteger(Number.MIN_VALUE);
  29054. * // => false
  29055. *
  29056. * _.isInteger(Infinity);
  29057. * // => false
  29058. *
  29059. * _.isInteger('3');
  29060. * // => false
  29061. */
  29062. function isInteger(value) {
  29063. return typeof value == 'number' && value == toInteger(value);
  29064. }
  29065. /**
  29066. * Checks if `value` is a valid array-like length.
  29067. *
  29068. * **Note:** This method is loosely based on
  29069. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29070. *
  29071. * @static
  29072. * @memberOf _
  29073. * @since 4.0.0
  29074. * @category Lang
  29075. * @param {*} value The value to check.
  29076. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29077. * @example
  29078. *
  29079. * _.isLength(3);
  29080. * // => true
  29081. *
  29082. * _.isLength(Number.MIN_VALUE);
  29083. * // => false
  29084. *
  29085. * _.isLength(Infinity);
  29086. * // => false
  29087. *
  29088. * _.isLength('3');
  29089. * // => false
  29090. */
  29091. function isLength(value) {
  29092. return typeof value == 'number' &&
  29093. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29094. }
  29095. /**
  29096. * Checks if `value` is the
  29097. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29098. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29099. *
  29100. * @static
  29101. * @memberOf _
  29102. * @since 0.1.0
  29103. * @category Lang
  29104. * @param {*} value The value to check.
  29105. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29106. * @example
  29107. *
  29108. * _.isObject({});
  29109. * // => true
  29110. *
  29111. * _.isObject([1, 2, 3]);
  29112. * // => true
  29113. *
  29114. * _.isObject(_.noop);
  29115. * // => true
  29116. *
  29117. * _.isObject(null);
  29118. * // => false
  29119. */
  29120. function isObject(value) {
  29121. var type = typeof value;
  29122. return value != null && (type == 'object' || type == 'function');
  29123. }
  29124. /**
  29125. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29126. * and has a `typeof` result of "object".
  29127. *
  29128. * @static
  29129. * @memberOf _
  29130. * @since 4.0.0
  29131. * @category Lang
  29132. * @param {*} value The value to check.
  29133. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29134. * @example
  29135. *
  29136. * _.isObjectLike({});
  29137. * // => true
  29138. *
  29139. * _.isObjectLike([1, 2, 3]);
  29140. * // => true
  29141. *
  29142. * _.isObjectLike(_.noop);
  29143. * // => false
  29144. *
  29145. * _.isObjectLike(null);
  29146. * // => false
  29147. */
  29148. function isObjectLike(value) {
  29149. return value != null && typeof value == 'object';
  29150. }
  29151. /**
  29152. * Checks if `value` is classified as a `Map` object.
  29153. *
  29154. * @static
  29155. * @memberOf _
  29156. * @since 4.3.0
  29157. * @category Lang
  29158. * @param {*} value The value to check.
  29159. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29160. * @example
  29161. *
  29162. * _.isMap(new Map);
  29163. * // => true
  29164. *
  29165. * _.isMap(new WeakMap);
  29166. * // => false
  29167. */
  29168. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29169. /**
  29170. * Performs a partial deep comparison between `object` and `source` to
  29171. * determine if `object` contains equivalent property values.
  29172. *
  29173. * **Note:** This method is equivalent to `_.matches` when `source` is
  29174. * partially applied.
  29175. *
  29176. * Partial comparisons will match empty array and empty object `source`
  29177. * values against any array or object value, respectively. See `_.isEqual`
  29178. * for a list of supported value comparisons.
  29179. *
  29180. * @static
  29181. * @memberOf _
  29182. * @since 3.0.0
  29183. * @category Lang
  29184. * @param {Object} object The object to inspect.
  29185. * @param {Object} source The object of property values to match.
  29186. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29187. * @example
  29188. *
  29189. * var object = { 'a': 1, 'b': 2 };
  29190. *
  29191. * _.isMatch(object, { 'b': 2 });
  29192. * // => true
  29193. *
  29194. * _.isMatch(object, { 'b': 1 });
  29195. * // => false
  29196. */
  29197. function isMatch(object, source) {
  29198. return object === source || baseIsMatch(object, source, getMatchData(source));
  29199. }
  29200. /**
  29201. * This method is like `_.isMatch` except that it accepts `customizer` which
  29202. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29203. * are handled by the method instead. The `customizer` is invoked with five
  29204. * arguments: (objValue, srcValue, index|key, object, source).
  29205. *
  29206. * @static
  29207. * @memberOf _
  29208. * @since 4.0.0
  29209. * @category Lang
  29210. * @param {Object} object The object to inspect.
  29211. * @param {Object} source The object of property values to match.
  29212. * @param {Function} [customizer] The function to customize comparisons.
  29213. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29214. * @example
  29215. *
  29216. * function isGreeting(value) {
  29217. * return /^h(?:i|ello)$/.test(value);
  29218. * }
  29219. *
  29220. * function customizer(objValue, srcValue) {
  29221. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29222. * return true;
  29223. * }
  29224. * }
  29225. *
  29226. * var object = { 'greeting': 'hello' };
  29227. * var source = { 'greeting': 'hi' };
  29228. *
  29229. * _.isMatchWith(object, source, customizer);
  29230. * // => true
  29231. */
  29232. function isMatchWith(object, source, customizer) {
  29233. customizer = typeof customizer == 'function' ? customizer : undefined;
  29234. return baseIsMatch(object, source, getMatchData(source), customizer);
  29235. }
  29236. /**
  29237. * Checks if `value` is `NaN`.
  29238. *
  29239. * **Note:** This method is based on
  29240. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29241. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29242. * `undefined` and other non-number values.
  29243. *
  29244. * @static
  29245. * @memberOf _
  29246. * @since 0.1.0
  29247. * @category Lang
  29248. * @param {*} value The value to check.
  29249. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29250. * @example
  29251. *
  29252. * _.isNaN(NaN);
  29253. * // => true
  29254. *
  29255. * _.isNaN(new Number(NaN));
  29256. * // => true
  29257. *
  29258. * isNaN(undefined);
  29259. * // => true
  29260. *
  29261. * _.isNaN(undefined);
  29262. * // => false
  29263. */
  29264. function isNaN(value) {
  29265. // An `NaN` primitive is the only value that is not equal to itself.
  29266. // Perform the `toStringTag` check first to avoid errors with some
  29267. // ActiveX objects in IE.
  29268. return isNumber(value) && value != +value;
  29269. }
  29270. /**
  29271. * Checks if `value` is a pristine native function.
  29272. *
  29273. * **Note:** This method can't reliably detect native functions in the presence
  29274. * of the core-js package because core-js circumvents this kind of detection.
  29275. * Despite multiple requests, the core-js maintainer has made it clear: any
  29276. * attempt to fix the detection will be obstructed. As a result, we're left
  29277. * with little choice but to throw an error. Unfortunately, this also affects
  29278. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29279. * which rely on core-js.
  29280. *
  29281. * @static
  29282. * @memberOf _
  29283. * @since 3.0.0
  29284. * @category Lang
  29285. * @param {*} value The value to check.
  29286. * @returns {boolean} Returns `true` if `value` is a native function,
  29287. * else `false`.
  29288. * @example
  29289. *
  29290. * _.isNative(Array.prototype.push);
  29291. * // => true
  29292. *
  29293. * _.isNative(_);
  29294. * // => false
  29295. */
  29296. function isNative(value) {
  29297. if (isMaskable(value)) {
  29298. throw new Error(CORE_ERROR_TEXT);
  29299. }
  29300. return baseIsNative(value);
  29301. }
  29302. /**
  29303. * Checks if `value` is `null`.
  29304. *
  29305. * @static
  29306. * @memberOf _
  29307. * @since 0.1.0
  29308. * @category Lang
  29309. * @param {*} value The value to check.
  29310. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29311. * @example
  29312. *
  29313. * _.isNull(null);
  29314. * // => true
  29315. *
  29316. * _.isNull(void 0);
  29317. * // => false
  29318. */
  29319. function isNull(value) {
  29320. return value === null;
  29321. }
  29322. /**
  29323. * Checks if `value` is `null` or `undefined`.
  29324. *
  29325. * @static
  29326. * @memberOf _
  29327. * @since 4.0.0
  29328. * @category Lang
  29329. * @param {*} value The value to check.
  29330. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29331. * @example
  29332. *
  29333. * _.isNil(null);
  29334. * // => true
  29335. *
  29336. * _.isNil(void 0);
  29337. * // => true
  29338. *
  29339. * _.isNil(NaN);
  29340. * // => false
  29341. */
  29342. function isNil(value) {
  29343. return value == null;
  29344. }
  29345. /**
  29346. * Checks if `value` is classified as a `Number` primitive or object.
  29347. *
  29348. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29349. * classified as numbers, use the `_.isFinite` method.
  29350. *
  29351. * @static
  29352. * @memberOf _
  29353. * @since 0.1.0
  29354. * @category Lang
  29355. * @param {*} value The value to check.
  29356. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29357. * @example
  29358. *
  29359. * _.isNumber(3);
  29360. * // => true
  29361. *
  29362. * _.isNumber(Number.MIN_VALUE);
  29363. * // => true
  29364. *
  29365. * _.isNumber(Infinity);
  29366. * // => true
  29367. *
  29368. * _.isNumber('3');
  29369. * // => false
  29370. */
  29371. function isNumber(value) {
  29372. return typeof value == 'number' ||
  29373. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29374. }
  29375. /**
  29376. * Checks if `value` is a plain object, that is, an object created by the
  29377. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29378. *
  29379. * @static
  29380. * @memberOf _
  29381. * @since 0.8.0
  29382. * @category Lang
  29383. * @param {*} value The value to check.
  29384. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29385. * @example
  29386. *
  29387. * function Foo() {
  29388. * this.a = 1;
  29389. * }
  29390. *
  29391. * _.isPlainObject(new Foo);
  29392. * // => false
  29393. *
  29394. * _.isPlainObject([1, 2, 3]);
  29395. * // => false
  29396. *
  29397. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29398. * // => true
  29399. *
  29400. * _.isPlainObject(Object.create(null));
  29401. * // => true
  29402. */
  29403. function isPlainObject(value) {
  29404. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29405. return false;
  29406. }
  29407. var proto = getPrototype(value);
  29408. if (proto === null) {
  29409. return true;
  29410. }
  29411. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29412. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29413. funcToString.call(Ctor) == objectCtorString;
  29414. }
  29415. /**
  29416. * Checks if `value` is classified as a `RegExp` object.
  29417. *
  29418. * @static
  29419. * @memberOf _
  29420. * @since 0.1.0
  29421. * @category Lang
  29422. * @param {*} value The value to check.
  29423. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29424. * @example
  29425. *
  29426. * _.isRegExp(/abc/);
  29427. * // => true
  29428. *
  29429. * _.isRegExp('/abc/');
  29430. * // => false
  29431. */
  29432. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29433. /**
  29434. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29435. * double precision number which isn't the result of a rounded unsafe integer.
  29436. *
  29437. * **Note:** This method is based on
  29438. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29439. *
  29440. * @static
  29441. * @memberOf _
  29442. * @since 4.0.0
  29443. * @category Lang
  29444. * @param {*} value The value to check.
  29445. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29446. * @example
  29447. *
  29448. * _.isSafeInteger(3);
  29449. * // => true
  29450. *
  29451. * _.isSafeInteger(Number.MIN_VALUE);
  29452. * // => false
  29453. *
  29454. * _.isSafeInteger(Infinity);
  29455. * // => false
  29456. *
  29457. * _.isSafeInteger('3');
  29458. * // => false
  29459. */
  29460. function isSafeInteger(value) {
  29461. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29462. }
  29463. /**
  29464. * Checks if `value` is classified as a `Set` object.
  29465. *
  29466. * @static
  29467. * @memberOf _
  29468. * @since 4.3.0
  29469. * @category Lang
  29470. * @param {*} value The value to check.
  29471. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29472. * @example
  29473. *
  29474. * _.isSet(new Set);
  29475. * // => true
  29476. *
  29477. * _.isSet(new WeakSet);
  29478. * // => false
  29479. */
  29480. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29481. /**
  29482. * Checks if `value` is classified as a `String` primitive or object.
  29483. *
  29484. * @static
  29485. * @since 0.1.0
  29486. * @memberOf _
  29487. * @category Lang
  29488. * @param {*} value The value to check.
  29489. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29490. * @example
  29491. *
  29492. * _.isString('abc');
  29493. * // => true
  29494. *
  29495. * _.isString(1);
  29496. * // => false
  29497. */
  29498. function isString(value) {
  29499. return typeof value == 'string' ||
  29500. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29501. }
  29502. /**
  29503. * Checks if `value` is classified as a `Symbol` primitive or object.
  29504. *
  29505. * @static
  29506. * @memberOf _
  29507. * @since 4.0.0
  29508. * @category Lang
  29509. * @param {*} value The value to check.
  29510. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29511. * @example
  29512. *
  29513. * _.isSymbol(Symbol.iterator);
  29514. * // => true
  29515. *
  29516. * _.isSymbol('abc');
  29517. * // => false
  29518. */
  29519. function isSymbol(value) {
  29520. return typeof value == 'symbol' ||
  29521. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29522. }
  29523. /**
  29524. * Checks if `value` is classified as a typed array.
  29525. *
  29526. * @static
  29527. * @memberOf _
  29528. * @since 3.0.0
  29529. * @category Lang
  29530. * @param {*} value The value to check.
  29531. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29532. * @example
  29533. *
  29534. * _.isTypedArray(new Uint8Array);
  29535. * // => true
  29536. *
  29537. * _.isTypedArray([]);
  29538. * // => false
  29539. */
  29540. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29541. /**
  29542. * Checks if `value` is `undefined`.
  29543. *
  29544. * @static
  29545. * @since 0.1.0
  29546. * @memberOf _
  29547. * @category Lang
  29548. * @param {*} value The value to check.
  29549. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29550. * @example
  29551. *
  29552. * _.isUndefined(void 0);
  29553. * // => true
  29554. *
  29555. * _.isUndefined(null);
  29556. * // => false
  29557. */
  29558. function isUndefined(value) {
  29559. return value === undefined;
  29560. }
  29561. /**
  29562. * Checks if `value` is classified as a `WeakMap` 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 weak map, else `false`.
  29570. * @example
  29571. *
  29572. * _.isWeakMap(new WeakMap);
  29573. * // => true
  29574. *
  29575. * _.isWeakMap(new Map);
  29576. * // => false
  29577. */
  29578. function isWeakMap(value) {
  29579. return isObjectLike(value) && getTag(value) == weakMapTag;
  29580. }
  29581. /**
  29582. * Checks if `value` is classified as a `WeakSet` object.
  29583. *
  29584. * @static
  29585. * @memberOf _
  29586. * @since 4.3.0
  29587. * @category Lang
  29588. * @param {*} value The value to check.
  29589. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29590. * @example
  29591. *
  29592. * _.isWeakSet(new WeakSet);
  29593. * // => true
  29594. *
  29595. * _.isWeakSet(new Set);
  29596. * // => false
  29597. */
  29598. function isWeakSet(value) {
  29599. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29600. }
  29601. /**
  29602. * Checks if `value` is less than `other`.
  29603. *
  29604. * @static
  29605. * @memberOf _
  29606. * @since 3.9.0
  29607. * @category Lang
  29608. * @param {*} value The value to compare.
  29609. * @param {*} other The other value to compare.
  29610. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29611. * else `false`.
  29612. * @see _.gt
  29613. * @example
  29614. *
  29615. * _.lt(1, 3);
  29616. * // => true
  29617. *
  29618. * _.lt(3, 3);
  29619. * // => false
  29620. *
  29621. * _.lt(3, 1);
  29622. * // => false
  29623. */
  29624. var lt = createRelationalOperation(baseLt);
  29625. /**
  29626. * Checks if `value` is less than or equal to `other`.
  29627. *
  29628. * @static
  29629. * @memberOf _
  29630. * @since 3.9.0
  29631. * @category Lang
  29632. * @param {*} value The value to compare.
  29633. * @param {*} other The other value to compare.
  29634. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29635. * `other`, else `false`.
  29636. * @see _.gte
  29637. * @example
  29638. *
  29639. * _.lte(1, 3);
  29640. * // => true
  29641. *
  29642. * _.lte(3, 3);
  29643. * // => true
  29644. *
  29645. * _.lte(3, 1);
  29646. * // => false
  29647. */
  29648. var lte = createRelationalOperation(function(value, other) {
  29649. return value <= other;
  29650. });
  29651. /**
  29652. * Converts `value` to an array.
  29653. *
  29654. * @static
  29655. * @since 0.1.0
  29656. * @memberOf _
  29657. * @category Lang
  29658. * @param {*} value The value to convert.
  29659. * @returns {Array} Returns the converted array.
  29660. * @example
  29661. *
  29662. * _.toArray({ 'a': 1, 'b': 2 });
  29663. * // => [1, 2]
  29664. *
  29665. * _.toArray('abc');
  29666. * // => ['a', 'b', 'c']
  29667. *
  29668. * _.toArray(1);
  29669. * // => []
  29670. *
  29671. * _.toArray(null);
  29672. * // => []
  29673. */
  29674. function toArray(value) {
  29675. if (!value) {
  29676. return [];
  29677. }
  29678. if (isArrayLike(value)) {
  29679. return isString(value) ? stringToArray(value) : copyArray(value);
  29680. }
  29681. if (symIterator && value[symIterator]) {
  29682. return iteratorToArray(value[symIterator]());
  29683. }
  29684. var tag = getTag(value),
  29685. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29686. return func(value);
  29687. }
  29688. /**
  29689. * Converts `value` to a finite number.
  29690. *
  29691. * @static
  29692. * @memberOf _
  29693. * @since 4.12.0
  29694. * @category Lang
  29695. * @param {*} value The value to convert.
  29696. * @returns {number} Returns the converted number.
  29697. * @example
  29698. *
  29699. * _.toFinite(3.2);
  29700. * // => 3.2
  29701. *
  29702. * _.toFinite(Number.MIN_VALUE);
  29703. * // => 5e-324
  29704. *
  29705. * _.toFinite(Infinity);
  29706. * // => 1.7976931348623157e+308
  29707. *
  29708. * _.toFinite('3.2');
  29709. * // => 3.2
  29710. */
  29711. function toFinite(value) {
  29712. if (!value) {
  29713. return value === 0 ? value : 0;
  29714. }
  29715. value = toNumber(value);
  29716. if (value === INFINITY || value === -INFINITY) {
  29717. var sign = (value < 0 ? -1 : 1);
  29718. return sign * MAX_INTEGER;
  29719. }
  29720. return value === value ? value : 0;
  29721. }
  29722. /**
  29723. * Converts `value` to an integer.
  29724. *
  29725. * **Note:** This method is loosely based on
  29726. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29727. *
  29728. * @static
  29729. * @memberOf _
  29730. * @since 4.0.0
  29731. * @category Lang
  29732. * @param {*} value The value to convert.
  29733. * @returns {number} Returns the converted integer.
  29734. * @example
  29735. *
  29736. * _.toInteger(3.2);
  29737. * // => 3
  29738. *
  29739. * _.toInteger(Number.MIN_VALUE);
  29740. * // => 0
  29741. *
  29742. * _.toInteger(Infinity);
  29743. * // => 1.7976931348623157e+308
  29744. *
  29745. * _.toInteger('3.2');
  29746. * // => 3
  29747. */
  29748. function toInteger(value) {
  29749. var result = toFinite(value),
  29750. remainder = result % 1;
  29751. return result === result ? (remainder ? result - remainder : result) : 0;
  29752. }
  29753. /**
  29754. * Converts `value` to an integer suitable for use as the length of an
  29755. * array-like object.
  29756. *
  29757. * **Note:** This method is based on
  29758. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29759. *
  29760. * @static
  29761. * @memberOf _
  29762. * @since 4.0.0
  29763. * @category Lang
  29764. * @param {*} value The value to convert.
  29765. * @returns {number} Returns the converted integer.
  29766. * @example
  29767. *
  29768. * _.toLength(3.2);
  29769. * // => 3
  29770. *
  29771. * _.toLength(Number.MIN_VALUE);
  29772. * // => 0
  29773. *
  29774. * _.toLength(Infinity);
  29775. * // => 4294967295
  29776. *
  29777. * _.toLength('3.2');
  29778. * // => 3
  29779. */
  29780. function toLength(value) {
  29781. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29782. }
  29783. /**
  29784. * Converts `value` to a number.
  29785. *
  29786. * @static
  29787. * @memberOf _
  29788. * @since 4.0.0
  29789. * @category Lang
  29790. * @param {*} value The value to process.
  29791. * @returns {number} Returns the number.
  29792. * @example
  29793. *
  29794. * _.toNumber(3.2);
  29795. * // => 3.2
  29796. *
  29797. * _.toNumber(Number.MIN_VALUE);
  29798. * // => 5e-324
  29799. *
  29800. * _.toNumber(Infinity);
  29801. * // => Infinity
  29802. *
  29803. * _.toNumber('3.2');
  29804. * // => 3.2
  29805. */
  29806. function toNumber(value) {
  29807. if (typeof value == 'number') {
  29808. return value;
  29809. }
  29810. if (isSymbol(value)) {
  29811. return NAN;
  29812. }
  29813. if (isObject(value)) {
  29814. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29815. value = isObject(other) ? (other + '') : other;
  29816. }
  29817. if (typeof value != 'string') {
  29818. return value === 0 ? value : +value;
  29819. }
  29820. value = value.replace(reTrim, '');
  29821. var isBinary = reIsBinary.test(value);
  29822. return (isBinary || reIsOctal.test(value))
  29823. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29824. : (reIsBadHex.test(value) ? NAN : +value);
  29825. }
  29826. /**
  29827. * Converts `value` to a plain object flattening inherited enumerable string
  29828. * keyed properties of `value` to own properties of the plain object.
  29829. *
  29830. * @static
  29831. * @memberOf _
  29832. * @since 3.0.0
  29833. * @category Lang
  29834. * @param {*} value The value to convert.
  29835. * @returns {Object} Returns the converted plain object.
  29836. * @example
  29837. *
  29838. * function Foo() {
  29839. * this.b = 2;
  29840. * }
  29841. *
  29842. * Foo.prototype.c = 3;
  29843. *
  29844. * _.assign({ 'a': 1 }, new Foo);
  29845. * // => { 'a': 1, 'b': 2 }
  29846. *
  29847. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29848. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29849. */
  29850. function toPlainObject(value) {
  29851. return copyObject(value, keysIn(value));
  29852. }
  29853. /**
  29854. * Converts `value` to a safe integer. A safe integer can be compared and
  29855. * represented correctly.
  29856. *
  29857. * @static
  29858. * @memberOf _
  29859. * @since 4.0.0
  29860. * @category Lang
  29861. * @param {*} value The value to convert.
  29862. * @returns {number} Returns the converted integer.
  29863. * @example
  29864. *
  29865. * _.toSafeInteger(3.2);
  29866. * // => 3
  29867. *
  29868. * _.toSafeInteger(Number.MIN_VALUE);
  29869. * // => 0
  29870. *
  29871. * _.toSafeInteger(Infinity);
  29872. * // => 9007199254740991
  29873. *
  29874. * _.toSafeInteger('3.2');
  29875. * // => 3
  29876. */
  29877. function toSafeInteger(value) {
  29878. return value
  29879. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29880. : (value === 0 ? value : 0);
  29881. }
  29882. /**
  29883. * Converts `value` to a string. An empty string is returned for `null`
  29884. * and `undefined` values. The sign of `-0` is preserved.
  29885. *
  29886. * @static
  29887. * @memberOf _
  29888. * @since 4.0.0
  29889. * @category Lang
  29890. * @param {*} value The value to convert.
  29891. * @returns {string} Returns the converted string.
  29892. * @example
  29893. *
  29894. * _.toString(null);
  29895. * // => ''
  29896. *
  29897. * _.toString(-0);
  29898. * // => '-0'
  29899. *
  29900. * _.toString([1, 2, 3]);
  29901. * // => '1,2,3'
  29902. */
  29903. function toString(value) {
  29904. return value == null ? '' : baseToString(value);
  29905. }
  29906. /*------------------------------------------------------------------------*/
  29907. /**
  29908. * Assigns own enumerable string keyed properties of source objects to the
  29909. * destination object. Source objects are applied from left to right.
  29910. * Subsequent sources overwrite property assignments of previous sources.
  29911. *
  29912. * **Note:** This method mutates `object` and is loosely based on
  29913. * [`Object.assign`](https://mdn.io/Object/assign).
  29914. *
  29915. * @static
  29916. * @memberOf _
  29917. * @since 0.10.0
  29918. * @category Object
  29919. * @param {Object} object The destination object.
  29920. * @param {...Object} [sources] The source objects.
  29921. * @returns {Object} Returns `object`.
  29922. * @see _.assignIn
  29923. * @example
  29924. *
  29925. * function Foo() {
  29926. * this.a = 1;
  29927. * }
  29928. *
  29929. * function Bar() {
  29930. * this.c = 3;
  29931. * }
  29932. *
  29933. * Foo.prototype.b = 2;
  29934. * Bar.prototype.d = 4;
  29935. *
  29936. * _.assign({ 'a': 0 }, new Foo, new Bar);
  29937. * // => { 'a': 1, 'c': 3 }
  29938. */
  29939. var assign = createAssigner(function(object, source) {
  29940. if (isPrototype(source) || isArrayLike(source)) {
  29941. copyObject(source, keys(source), object);
  29942. return;
  29943. }
  29944. for (var key in source) {
  29945. if (hasOwnProperty.call(source, key)) {
  29946. assignValue(object, key, source[key]);
  29947. }
  29948. }
  29949. });
  29950. /**
  29951. * This method is like `_.assign` except that it iterates over own and
  29952. * inherited source properties.
  29953. *
  29954. * **Note:** This method mutates `object`.
  29955. *
  29956. * @static
  29957. * @memberOf _
  29958. * @since 4.0.0
  29959. * @alias extend
  29960. * @category Object
  29961. * @param {Object} object The destination object.
  29962. * @param {...Object} [sources] The source objects.
  29963. * @returns {Object} Returns `object`.
  29964. * @see _.assign
  29965. * @example
  29966. *
  29967. * function Foo() {
  29968. * this.a = 1;
  29969. * }
  29970. *
  29971. * function Bar() {
  29972. * this.c = 3;
  29973. * }
  29974. *
  29975. * Foo.prototype.b = 2;
  29976. * Bar.prototype.d = 4;
  29977. *
  29978. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  29979. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  29980. */
  29981. var assignIn = createAssigner(function(object, source) {
  29982. copyObject(source, keysIn(source), object);
  29983. });
  29984. /**
  29985. * This method is like `_.assignIn` except that it accepts `customizer`
  29986. * which is invoked to produce the assigned values. If `customizer` returns
  29987. * `undefined`, assignment is handled by the method instead. The `customizer`
  29988. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29989. *
  29990. * **Note:** This method mutates `object`.
  29991. *
  29992. * @static
  29993. * @memberOf _
  29994. * @since 4.0.0
  29995. * @alias extendWith
  29996. * @category Object
  29997. * @param {Object} object The destination object.
  29998. * @param {...Object} sources The source objects.
  29999. * @param {Function} [customizer] The function to customize assigned values.
  30000. * @returns {Object} Returns `object`.
  30001. * @see _.assignWith
  30002. * @example
  30003. *
  30004. * function customizer(objValue, srcValue) {
  30005. * return _.isUndefined(objValue) ? srcValue : objValue;
  30006. * }
  30007. *
  30008. * var defaults = _.partialRight(_.assignInWith, customizer);
  30009. *
  30010. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30011. * // => { 'a': 1, 'b': 2 }
  30012. */
  30013. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30014. copyObject(source, keysIn(source), object, customizer);
  30015. });
  30016. /**
  30017. * This method is like `_.assign` except that it accepts `customizer`
  30018. * which is invoked to produce the assigned values. If `customizer` returns
  30019. * `undefined`, assignment is handled by the method instead. The `customizer`
  30020. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30021. *
  30022. * **Note:** This method mutates `object`.
  30023. *
  30024. * @static
  30025. * @memberOf _
  30026. * @since 4.0.0
  30027. * @category Object
  30028. * @param {Object} object The destination object.
  30029. * @param {...Object} sources The source objects.
  30030. * @param {Function} [customizer] The function to customize assigned values.
  30031. * @returns {Object} Returns `object`.
  30032. * @see _.assignInWith
  30033. * @example
  30034. *
  30035. * function customizer(objValue, srcValue) {
  30036. * return _.isUndefined(objValue) ? srcValue : objValue;
  30037. * }
  30038. *
  30039. * var defaults = _.partialRight(_.assignWith, customizer);
  30040. *
  30041. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30042. * // => { 'a': 1, 'b': 2 }
  30043. */
  30044. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30045. copyObject(source, keys(source), object, customizer);
  30046. });
  30047. /**
  30048. * Creates an array of values corresponding to `paths` of `object`.
  30049. *
  30050. * @static
  30051. * @memberOf _
  30052. * @since 1.0.0
  30053. * @category Object
  30054. * @param {Object} object The object to iterate over.
  30055. * @param {...(string|string[])} [paths] The property paths to pick.
  30056. * @returns {Array} Returns the picked values.
  30057. * @example
  30058. *
  30059. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30060. *
  30061. * _.at(object, ['a[0].b.c', 'a[1]']);
  30062. * // => [3, 4]
  30063. */
  30064. var at = flatRest(baseAt);
  30065. /**
  30066. * Creates an object that inherits from the `prototype` object. If a
  30067. * `properties` object is given, its own enumerable string keyed properties
  30068. * are assigned to the created object.
  30069. *
  30070. * @static
  30071. * @memberOf _
  30072. * @since 2.3.0
  30073. * @category Object
  30074. * @param {Object} prototype The object to inherit from.
  30075. * @param {Object} [properties] The properties to assign to the object.
  30076. * @returns {Object} Returns the new object.
  30077. * @example
  30078. *
  30079. * function Shape() {
  30080. * this.x = 0;
  30081. * this.y = 0;
  30082. * }
  30083. *
  30084. * function Circle() {
  30085. * Shape.call(this);
  30086. * }
  30087. *
  30088. * Circle.prototype = _.create(Shape.prototype, {
  30089. * 'constructor': Circle
  30090. * });
  30091. *
  30092. * var circle = new Circle;
  30093. * circle instanceof Circle;
  30094. * // => true
  30095. *
  30096. * circle instanceof Shape;
  30097. * // => true
  30098. */
  30099. function create(prototype, properties) {
  30100. var result = baseCreate(prototype);
  30101. return properties == null ? result : baseAssign(result, properties);
  30102. }
  30103. /**
  30104. * Assigns own and inherited enumerable string keyed properties of source
  30105. * objects to the destination object for all destination properties that
  30106. * resolve to `undefined`. Source objects are applied from left to right.
  30107. * Once a property is set, additional values of the same property are ignored.
  30108. *
  30109. * **Note:** This method mutates `object`.
  30110. *
  30111. * @static
  30112. * @since 0.1.0
  30113. * @memberOf _
  30114. * @category Object
  30115. * @param {Object} object The destination object.
  30116. * @param {...Object} [sources] The source objects.
  30117. * @returns {Object} Returns `object`.
  30118. * @see _.defaultsDeep
  30119. * @example
  30120. *
  30121. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30122. * // => { 'a': 1, 'b': 2 }
  30123. */
  30124. var defaults = baseRest(function(object, sources) {
  30125. object = Object(object);
  30126. var index = -1;
  30127. var length = sources.length;
  30128. var guard = length > 2 ? sources[2] : undefined;
  30129. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30130. length = 1;
  30131. }
  30132. while (++index < length) {
  30133. var source = sources[index];
  30134. var props = keysIn(source);
  30135. var propsIndex = -1;
  30136. var propsLength = props.length;
  30137. while (++propsIndex < propsLength) {
  30138. var key = props[propsIndex];
  30139. var value = object[key];
  30140. if (value === undefined ||
  30141. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30142. object[key] = source[key];
  30143. }
  30144. }
  30145. }
  30146. return object;
  30147. });
  30148. /**
  30149. * This method is like `_.defaults` except that it recursively assigns
  30150. * default properties.
  30151. *
  30152. * **Note:** This method mutates `object`.
  30153. *
  30154. * @static
  30155. * @memberOf _
  30156. * @since 3.10.0
  30157. * @category Object
  30158. * @param {Object} object The destination object.
  30159. * @param {...Object} [sources] The source objects.
  30160. * @returns {Object} Returns `object`.
  30161. * @see _.defaults
  30162. * @example
  30163. *
  30164. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30165. * // => { 'a': { 'b': 2, 'c': 3 } }
  30166. */
  30167. var defaultsDeep = baseRest(function(args) {
  30168. args.push(undefined, customDefaultsMerge);
  30169. return apply(mergeWith, undefined, args);
  30170. });
  30171. /**
  30172. * This method is like `_.find` except that it returns the key of the first
  30173. * element `predicate` returns truthy for instead of the element itself.
  30174. *
  30175. * @static
  30176. * @memberOf _
  30177. * @since 1.1.0
  30178. * @category Object
  30179. * @param {Object} object The object to inspect.
  30180. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30181. * @returns {string|undefined} Returns the key of the matched element,
  30182. * else `undefined`.
  30183. * @example
  30184. *
  30185. * var users = {
  30186. * 'barney': { 'age': 36, 'active': true },
  30187. * 'fred': { 'age': 40, 'active': false },
  30188. * 'pebbles': { 'age': 1, 'active': true }
  30189. * };
  30190. *
  30191. * _.findKey(users, function(o) { return o.age < 40; });
  30192. * // => 'barney' (iteration order is not guaranteed)
  30193. *
  30194. * // The `_.matches` iteratee shorthand.
  30195. * _.findKey(users, { 'age': 1, 'active': true });
  30196. * // => 'pebbles'
  30197. *
  30198. * // The `_.matchesProperty` iteratee shorthand.
  30199. * _.findKey(users, ['active', false]);
  30200. * // => 'fred'
  30201. *
  30202. * // The `_.property` iteratee shorthand.
  30203. * _.findKey(users, 'active');
  30204. * // => 'barney'
  30205. */
  30206. function findKey(object, predicate) {
  30207. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30208. }
  30209. /**
  30210. * This method is like `_.findKey` except that it iterates over elements of
  30211. * a collection in the opposite order.
  30212. *
  30213. * @static
  30214. * @memberOf _
  30215. * @since 2.0.0
  30216. * @category Object
  30217. * @param {Object} object The object to inspect.
  30218. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30219. * @returns {string|undefined} Returns the key of the matched element,
  30220. * else `undefined`.
  30221. * @example
  30222. *
  30223. * var users = {
  30224. * 'barney': { 'age': 36, 'active': true },
  30225. * 'fred': { 'age': 40, 'active': false },
  30226. * 'pebbles': { 'age': 1, 'active': true }
  30227. * };
  30228. *
  30229. * _.findLastKey(users, function(o) { return o.age < 40; });
  30230. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30231. *
  30232. * // The `_.matches` iteratee shorthand.
  30233. * _.findLastKey(users, { 'age': 36, 'active': true });
  30234. * // => 'barney'
  30235. *
  30236. * // The `_.matchesProperty` iteratee shorthand.
  30237. * _.findLastKey(users, ['active', false]);
  30238. * // => 'fred'
  30239. *
  30240. * // The `_.property` iteratee shorthand.
  30241. * _.findLastKey(users, 'active');
  30242. * // => 'pebbles'
  30243. */
  30244. function findLastKey(object, predicate) {
  30245. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30246. }
  30247. /**
  30248. * Iterates over own and inherited enumerable string keyed properties of an
  30249. * object and invokes `iteratee` for each property. The iteratee is invoked
  30250. * with three arguments: (value, key, object). Iteratee functions may exit
  30251. * iteration early by explicitly returning `false`.
  30252. *
  30253. * @static
  30254. * @memberOf _
  30255. * @since 0.3.0
  30256. * @category Object
  30257. * @param {Object} object The object to iterate over.
  30258. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30259. * @returns {Object} Returns `object`.
  30260. * @see _.forInRight
  30261. * @example
  30262. *
  30263. * function Foo() {
  30264. * this.a = 1;
  30265. * this.b = 2;
  30266. * }
  30267. *
  30268. * Foo.prototype.c = 3;
  30269. *
  30270. * _.forIn(new Foo, function(value, key) {
  30271. * console.log(key);
  30272. * });
  30273. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30274. */
  30275. function forIn(object, iteratee) {
  30276. return object == null
  30277. ? object
  30278. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30279. }
  30280. /**
  30281. * This method is like `_.forIn` except that it iterates over properties of
  30282. * `object` in the opposite order.
  30283. *
  30284. * @static
  30285. * @memberOf _
  30286. * @since 2.0.0
  30287. * @category Object
  30288. * @param {Object} object The object to iterate over.
  30289. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30290. * @returns {Object} Returns `object`.
  30291. * @see _.forIn
  30292. * @example
  30293. *
  30294. * function Foo() {
  30295. * this.a = 1;
  30296. * this.b = 2;
  30297. * }
  30298. *
  30299. * Foo.prototype.c = 3;
  30300. *
  30301. * _.forInRight(new Foo, function(value, key) {
  30302. * console.log(key);
  30303. * });
  30304. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30305. */
  30306. function forInRight(object, iteratee) {
  30307. return object == null
  30308. ? object
  30309. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30310. }
  30311. /**
  30312. * Iterates over own enumerable string keyed properties of an object and
  30313. * invokes `iteratee` for each property. The iteratee is invoked with three
  30314. * arguments: (value, key, object). Iteratee functions may exit iteration
  30315. * early by explicitly returning `false`.
  30316. *
  30317. * @static
  30318. * @memberOf _
  30319. * @since 0.3.0
  30320. * @category Object
  30321. * @param {Object} object The object to iterate over.
  30322. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30323. * @returns {Object} Returns `object`.
  30324. * @see _.forOwnRight
  30325. * @example
  30326. *
  30327. * function Foo() {
  30328. * this.a = 1;
  30329. * this.b = 2;
  30330. * }
  30331. *
  30332. * Foo.prototype.c = 3;
  30333. *
  30334. * _.forOwn(new Foo, function(value, key) {
  30335. * console.log(key);
  30336. * });
  30337. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30338. */
  30339. function forOwn(object, iteratee) {
  30340. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30341. }
  30342. /**
  30343. * This method is like `_.forOwn` except that it iterates over properties of
  30344. * `object` in the opposite order.
  30345. *
  30346. * @static
  30347. * @memberOf _
  30348. * @since 2.0.0
  30349. * @category Object
  30350. * @param {Object} object The object to iterate over.
  30351. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30352. * @returns {Object} Returns `object`.
  30353. * @see _.forOwn
  30354. * @example
  30355. *
  30356. * function Foo() {
  30357. * this.a = 1;
  30358. * this.b = 2;
  30359. * }
  30360. *
  30361. * Foo.prototype.c = 3;
  30362. *
  30363. * _.forOwnRight(new Foo, function(value, key) {
  30364. * console.log(key);
  30365. * });
  30366. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30367. */
  30368. function forOwnRight(object, iteratee) {
  30369. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30370. }
  30371. /**
  30372. * Creates an array of function property names from own enumerable properties
  30373. * of `object`.
  30374. *
  30375. * @static
  30376. * @since 0.1.0
  30377. * @memberOf _
  30378. * @category Object
  30379. * @param {Object} object The object to inspect.
  30380. * @returns {Array} Returns the function names.
  30381. * @see _.functionsIn
  30382. * @example
  30383. *
  30384. * function Foo() {
  30385. * this.a = _.constant('a');
  30386. * this.b = _.constant('b');
  30387. * }
  30388. *
  30389. * Foo.prototype.c = _.constant('c');
  30390. *
  30391. * _.functions(new Foo);
  30392. * // => ['a', 'b']
  30393. */
  30394. function functions(object) {
  30395. return object == null ? [] : baseFunctions(object, keys(object));
  30396. }
  30397. /**
  30398. * Creates an array of function property names from own and inherited
  30399. * enumerable properties of `object`.
  30400. *
  30401. * @static
  30402. * @memberOf _
  30403. * @since 4.0.0
  30404. * @category Object
  30405. * @param {Object} object The object to inspect.
  30406. * @returns {Array} Returns the function names.
  30407. * @see _.functions
  30408. * @example
  30409. *
  30410. * function Foo() {
  30411. * this.a = _.constant('a');
  30412. * this.b = _.constant('b');
  30413. * }
  30414. *
  30415. * Foo.prototype.c = _.constant('c');
  30416. *
  30417. * _.functionsIn(new Foo);
  30418. * // => ['a', 'b', 'c']
  30419. */
  30420. function functionsIn(object) {
  30421. return object == null ? [] : baseFunctions(object, keysIn(object));
  30422. }
  30423. /**
  30424. * Gets the value at `path` of `object`. If the resolved value is
  30425. * `undefined`, the `defaultValue` is returned in its place.
  30426. *
  30427. * @static
  30428. * @memberOf _
  30429. * @since 3.7.0
  30430. * @category Object
  30431. * @param {Object} object The object to query.
  30432. * @param {Array|string} path The path of the property to get.
  30433. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30434. * @returns {*} Returns the resolved value.
  30435. * @example
  30436. *
  30437. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30438. *
  30439. * _.get(object, 'a[0].b.c');
  30440. * // => 3
  30441. *
  30442. * _.get(object, ['a', '0', 'b', 'c']);
  30443. * // => 3
  30444. *
  30445. * _.get(object, 'a.b.c', 'default');
  30446. * // => 'default'
  30447. */
  30448. function get(object, path, defaultValue) {
  30449. var result = object == null ? undefined : baseGet(object, path);
  30450. return result === undefined ? defaultValue : result;
  30451. }
  30452. /**
  30453. * Checks if `path` is a direct property of `object`.
  30454. *
  30455. * @static
  30456. * @since 0.1.0
  30457. * @memberOf _
  30458. * @category Object
  30459. * @param {Object} object The object to query.
  30460. * @param {Array|string} path The path to check.
  30461. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30462. * @example
  30463. *
  30464. * var object = { 'a': { 'b': 2 } };
  30465. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30466. *
  30467. * _.has(object, 'a');
  30468. * // => true
  30469. *
  30470. * _.has(object, 'a.b');
  30471. * // => true
  30472. *
  30473. * _.has(object, ['a', 'b']);
  30474. * // => true
  30475. *
  30476. * _.has(other, 'a');
  30477. * // => false
  30478. */
  30479. function has(object, path) {
  30480. return object != null && hasPath(object, path, baseHas);
  30481. }
  30482. /**
  30483. * Checks if `path` is a direct or inherited property of `object`.
  30484. *
  30485. * @static
  30486. * @memberOf _
  30487. * @since 4.0.0
  30488. * @category Object
  30489. * @param {Object} object The object to query.
  30490. * @param {Array|string} path The path to check.
  30491. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30492. * @example
  30493. *
  30494. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30495. *
  30496. * _.hasIn(object, 'a');
  30497. * // => true
  30498. *
  30499. * _.hasIn(object, 'a.b');
  30500. * // => true
  30501. *
  30502. * _.hasIn(object, ['a', 'b']);
  30503. * // => true
  30504. *
  30505. * _.hasIn(object, 'b');
  30506. * // => false
  30507. */
  30508. function hasIn(object, path) {
  30509. return object != null && hasPath(object, path, baseHasIn);
  30510. }
  30511. /**
  30512. * Creates an object composed of the inverted keys and values of `object`.
  30513. * If `object` contains duplicate values, subsequent values overwrite
  30514. * property assignments of previous values.
  30515. *
  30516. * @static
  30517. * @memberOf _
  30518. * @since 0.7.0
  30519. * @category Object
  30520. * @param {Object} object The object to invert.
  30521. * @returns {Object} Returns the new inverted object.
  30522. * @example
  30523. *
  30524. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30525. *
  30526. * _.invert(object);
  30527. * // => { '1': 'c', '2': 'b' }
  30528. */
  30529. var invert = createInverter(function(result, value, key) {
  30530. if (value != null &&
  30531. typeof value.toString != 'function') {
  30532. value = nativeObjectToString.call(value);
  30533. }
  30534. result[value] = key;
  30535. }, constant(identity));
  30536. /**
  30537. * This method is like `_.invert` except that the inverted object is generated
  30538. * from the results of running each element of `object` thru `iteratee`. The
  30539. * corresponding inverted value of each inverted key is an array of keys
  30540. * responsible for generating the inverted value. The iteratee is invoked
  30541. * with one argument: (value).
  30542. *
  30543. * @static
  30544. * @memberOf _
  30545. * @since 4.1.0
  30546. * @category Object
  30547. * @param {Object} object The object to invert.
  30548. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30549. * @returns {Object} Returns the new inverted object.
  30550. * @example
  30551. *
  30552. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30553. *
  30554. * _.invertBy(object);
  30555. * // => { '1': ['a', 'c'], '2': ['b'] }
  30556. *
  30557. * _.invertBy(object, function(value) {
  30558. * return 'group' + value;
  30559. * });
  30560. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30561. */
  30562. var invertBy = createInverter(function(result, value, key) {
  30563. if (value != null &&
  30564. typeof value.toString != 'function') {
  30565. value = nativeObjectToString.call(value);
  30566. }
  30567. if (hasOwnProperty.call(result, value)) {
  30568. result[value].push(key);
  30569. } else {
  30570. result[value] = [key];
  30571. }
  30572. }, getIteratee);
  30573. /**
  30574. * Invokes the method at `path` of `object`.
  30575. *
  30576. * @static
  30577. * @memberOf _
  30578. * @since 4.0.0
  30579. * @category Object
  30580. * @param {Object} object The object to query.
  30581. * @param {Array|string} path The path of the method to invoke.
  30582. * @param {...*} [args] The arguments to invoke the method with.
  30583. * @returns {*} Returns the result of the invoked method.
  30584. * @example
  30585. *
  30586. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30587. *
  30588. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30589. * // => [2, 3]
  30590. */
  30591. var invoke = baseRest(baseInvoke);
  30592. /**
  30593. * Creates an array of the own enumerable property names of `object`.
  30594. *
  30595. * **Note:** Non-object values are coerced to objects. See the
  30596. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30597. * for more details.
  30598. *
  30599. * @static
  30600. * @since 0.1.0
  30601. * @memberOf _
  30602. * @category Object
  30603. * @param {Object} object The object to query.
  30604. * @returns {Array} Returns the array of property names.
  30605. * @example
  30606. *
  30607. * function Foo() {
  30608. * this.a = 1;
  30609. * this.b = 2;
  30610. * }
  30611. *
  30612. * Foo.prototype.c = 3;
  30613. *
  30614. * _.keys(new Foo);
  30615. * // => ['a', 'b'] (iteration order is not guaranteed)
  30616. *
  30617. * _.keys('hi');
  30618. * // => ['0', '1']
  30619. */
  30620. function keys(object) {
  30621. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30622. }
  30623. /**
  30624. * Creates an array of the own and inherited enumerable property names of `object`.
  30625. *
  30626. * **Note:** Non-object values are coerced to objects.
  30627. *
  30628. * @static
  30629. * @memberOf _
  30630. * @since 3.0.0
  30631. * @category Object
  30632. * @param {Object} object The object to query.
  30633. * @returns {Array} Returns the array of property names.
  30634. * @example
  30635. *
  30636. * function Foo() {
  30637. * this.a = 1;
  30638. * this.b = 2;
  30639. * }
  30640. *
  30641. * Foo.prototype.c = 3;
  30642. *
  30643. * _.keysIn(new Foo);
  30644. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30645. */
  30646. function keysIn(object) {
  30647. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30648. }
  30649. /**
  30650. * The opposite of `_.mapValues`; this method creates an object with the
  30651. * same values as `object` and keys generated by running each own enumerable
  30652. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30653. * with three arguments: (value, key, object).
  30654. *
  30655. * @static
  30656. * @memberOf _
  30657. * @since 3.8.0
  30658. * @category Object
  30659. * @param {Object} object The object to iterate over.
  30660. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30661. * @returns {Object} Returns the new mapped object.
  30662. * @see _.mapValues
  30663. * @example
  30664. *
  30665. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30666. * return key + value;
  30667. * });
  30668. * // => { 'a1': 1, 'b2': 2 }
  30669. */
  30670. function mapKeys(object, iteratee) {
  30671. var result = {};
  30672. iteratee = getIteratee(iteratee, 3);
  30673. baseForOwn(object, function(value, key, object) {
  30674. baseAssignValue(result, iteratee(value, key, object), value);
  30675. });
  30676. return result;
  30677. }
  30678. /**
  30679. * Creates an object with the same keys as `object` and values generated
  30680. * by running each own enumerable string keyed property of `object` thru
  30681. * `iteratee`. The iteratee is invoked with three arguments:
  30682. * (value, key, object).
  30683. *
  30684. * @static
  30685. * @memberOf _
  30686. * @since 2.4.0
  30687. * @category Object
  30688. * @param {Object} object The object to iterate over.
  30689. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30690. * @returns {Object} Returns the new mapped object.
  30691. * @see _.mapKeys
  30692. * @example
  30693. *
  30694. * var users = {
  30695. * 'fred': { 'user': 'fred', 'age': 40 },
  30696. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30697. * };
  30698. *
  30699. * _.mapValues(users, function(o) { return o.age; });
  30700. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30701. *
  30702. * // The `_.property` iteratee shorthand.
  30703. * _.mapValues(users, 'age');
  30704. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30705. */
  30706. function mapValues(object, iteratee) {
  30707. var result = {};
  30708. iteratee = getIteratee(iteratee, 3);
  30709. baseForOwn(object, function(value, key, object) {
  30710. baseAssignValue(result, key, iteratee(value, key, object));
  30711. });
  30712. return result;
  30713. }
  30714. /**
  30715. * This method is like `_.assign` except that it recursively merges own and
  30716. * inherited enumerable string keyed properties of source objects into the
  30717. * destination object. Source properties that resolve to `undefined` are
  30718. * skipped if a destination value exists. Array and plain object properties
  30719. * are merged recursively. Other objects and value types are overridden by
  30720. * assignment. Source objects are applied from left to right. Subsequent
  30721. * sources overwrite property assignments of previous sources.
  30722. *
  30723. * **Note:** This method mutates `object`.
  30724. *
  30725. * @static
  30726. * @memberOf _
  30727. * @since 0.5.0
  30728. * @category Object
  30729. * @param {Object} object The destination object.
  30730. * @param {...Object} [sources] The source objects.
  30731. * @returns {Object} Returns `object`.
  30732. * @example
  30733. *
  30734. * var object = {
  30735. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30736. * };
  30737. *
  30738. * var other = {
  30739. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30740. * };
  30741. *
  30742. * _.merge(object, other);
  30743. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30744. */
  30745. var merge = createAssigner(function(object, source, srcIndex) {
  30746. baseMerge(object, source, srcIndex);
  30747. });
  30748. /**
  30749. * This method is like `_.merge` except that it accepts `customizer` which
  30750. * is invoked to produce the merged values of the destination and source
  30751. * properties. If `customizer` returns `undefined`, merging is handled by the
  30752. * method instead. The `customizer` is invoked with six arguments:
  30753. * (objValue, srcValue, key, object, source, stack).
  30754. *
  30755. * **Note:** This method mutates `object`.
  30756. *
  30757. * @static
  30758. * @memberOf _
  30759. * @since 4.0.0
  30760. * @category Object
  30761. * @param {Object} object The destination object.
  30762. * @param {...Object} sources The source objects.
  30763. * @param {Function} customizer The function to customize assigned values.
  30764. * @returns {Object} Returns `object`.
  30765. * @example
  30766. *
  30767. * function customizer(objValue, srcValue) {
  30768. * if (_.isArray(objValue)) {
  30769. * return objValue.concat(srcValue);
  30770. * }
  30771. * }
  30772. *
  30773. * var object = { 'a': [1], 'b': [2] };
  30774. * var other = { 'a': [3], 'b': [4] };
  30775. *
  30776. * _.mergeWith(object, other, customizer);
  30777. * // => { 'a': [1, 3], 'b': [2, 4] }
  30778. */
  30779. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30780. baseMerge(object, source, srcIndex, customizer);
  30781. });
  30782. /**
  30783. * The opposite of `_.pick`; this method creates an object composed of the
  30784. * own and inherited enumerable property paths of `object` that are not omitted.
  30785. *
  30786. * **Note:** This method is considerably slower than `_.pick`.
  30787. *
  30788. * @static
  30789. * @since 0.1.0
  30790. * @memberOf _
  30791. * @category Object
  30792. * @param {Object} object The source object.
  30793. * @param {...(string|string[])} [paths] The property paths to omit.
  30794. * @returns {Object} Returns the new object.
  30795. * @example
  30796. *
  30797. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30798. *
  30799. * _.omit(object, ['a', 'c']);
  30800. * // => { 'b': '2' }
  30801. */
  30802. var omit = flatRest(function(object, paths) {
  30803. var result = {};
  30804. if (object == null) {
  30805. return result;
  30806. }
  30807. var isDeep = false;
  30808. paths = arrayMap(paths, function(path) {
  30809. path = castPath(path, object);
  30810. isDeep || (isDeep = path.length > 1);
  30811. return path;
  30812. });
  30813. copyObject(object, getAllKeysIn(object), result);
  30814. if (isDeep) {
  30815. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30816. }
  30817. var length = paths.length;
  30818. while (length--) {
  30819. baseUnset(result, paths[length]);
  30820. }
  30821. return result;
  30822. });
  30823. /**
  30824. * The opposite of `_.pickBy`; this method creates an object composed of
  30825. * the own and inherited enumerable string keyed properties of `object` that
  30826. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30827. * arguments: (value, key).
  30828. *
  30829. * @static
  30830. * @memberOf _
  30831. * @since 4.0.0
  30832. * @category Object
  30833. * @param {Object} object The source object.
  30834. * @param {Function} [predicate=_.identity] The function invoked per property.
  30835. * @returns {Object} Returns the new object.
  30836. * @example
  30837. *
  30838. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30839. *
  30840. * _.omitBy(object, _.isNumber);
  30841. * // => { 'b': '2' }
  30842. */
  30843. function omitBy(object, predicate) {
  30844. return pickBy(object, negate(getIteratee(predicate)));
  30845. }
  30846. /**
  30847. * Creates an object composed of the picked `object` properties.
  30848. *
  30849. * @static
  30850. * @since 0.1.0
  30851. * @memberOf _
  30852. * @category Object
  30853. * @param {Object} object The source object.
  30854. * @param {...(string|string[])} [paths] The property paths to pick.
  30855. * @returns {Object} Returns the new object.
  30856. * @example
  30857. *
  30858. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30859. *
  30860. * _.pick(object, ['a', 'c']);
  30861. * // => { 'a': 1, 'c': 3 }
  30862. */
  30863. var pick = flatRest(function(object, paths) {
  30864. return object == null ? {} : basePick(object, paths);
  30865. });
  30866. /**
  30867. * Creates an object composed of the `object` properties `predicate` returns
  30868. * truthy for. The predicate is invoked with two arguments: (value, key).
  30869. *
  30870. * @static
  30871. * @memberOf _
  30872. * @since 4.0.0
  30873. * @category Object
  30874. * @param {Object} object The source object.
  30875. * @param {Function} [predicate=_.identity] The function invoked per property.
  30876. * @returns {Object} Returns the new object.
  30877. * @example
  30878. *
  30879. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30880. *
  30881. * _.pickBy(object, _.isNumber);
  30882. * // => { 'a': 1, 'c': 3 }
  30883. */
  30884. function pickBy(object, predicate) {
  30885. if (object == null) {
  30886. return {};
  30887. }
  30888. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30889. return [prop];
  30890. });
  30891. predicate = getIteratee(predicate);
  30892. return basePickBy(object, props, function(value, path) {
  30893. return predicate(value, path[0]);
  30894. });
  30895. }
  30896. /**
  30897. * This method is like `_.get` except that if the resolved value is a
  30898. * function it's invoked with the `this` binding of its parent object and
  30899. * its result is returned.
  30900. *
  30901. * @static
  30902. * @since 0.1.0
  30903. * @memberOf _
  30904. * @category Object
  30905. * @param {Object} object The object to query.
  30906. * @param {Array|string} path The path of the property to resolve.
  30907. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30908. * @returns {*} Returns the resolved value.
  30909. * @example
  30910. *
  30911. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  30912. *
  30913. * _.result(object, 'a[0].b.c1');
  30914. * // => 3
  30915. *
  30916. * _.result(object, 'a[0].b.c2');
  30917. * // => 4
  30918. *
  30919. * _.result(object, 'a[0].b.c3', 'default');
  30920. * // => 'default'
  30921. *
  30922. * _.result(object, 'a[0].b.c3', _.constant('default'));
  30923. * // => 'default'
  30924. */
  30925. function result(object, path, defaultValue) {
  30926. path = castPath(path, object);
  30927. var index = -1,
  30928. length = path.length;
  30929. // Ensure the loop is entered when path is empty.
  30930. if (!length) {
  30931. length = 1;
  30932. object = undefined;
  30933. }
  30934. while (++index < length) {
  30935. var value = object == null ? undefined : object[toKey(path[index])];
  30936. if (value === undefined) {
  30937. index = length;
  30938. value = defaultValue;
  30939. }
  30940. object = isFunction(value) ? value.call(object) : value;
  30941. }
  30942. return object;
  30943. }
  30944. /**
  30945. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  30946. * it's created. Arrays are created for missing index properties while objects
  30947. * are created for all other missing properties. Use `_.setWith` to customize
  30948. * `path` creation.
  30949. *
  30950. * **Note:** This method mutates `object`.
  30951. *
  30952. * @static
  30953. * @memberOf _
  30954. * @since 3.7.0
  30955. * @category Object
  30956. * @param {Object} object The object to modify.
  30957. * @param {Array|string} path The path of the property to set.
  30958. * @param {*} value The value to set.
  30959. * @returns {Object} Returns `object`.
  30960. * @example
  30961. *
  30962. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30963. *
  30964. * _.set(object, 'a[0].b.c', 4);
  30965. * console.log(object.a[0].b.c);
  30966. * // => 4
  30967. *
  30968. * _.set(object, ['x', '0', 'y', 'z'], 5);
  30969. * console.log(object.x[0].y.z);
  30970. * // => 5
  30971. */
  30972. function set(object, path, value) {
  30973. return object == null ? object : baseSet(object, path, value);
  30974. }
  30975. /**
  30976. * This method is like `_.set` except that it accepts `customizer` which is
  30977. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30978. * path creation is handled by the method instead. The `customizer` is invoked
  30979. * with three arguments: (nsValue, key, nsObject).
  30980. *
  30981. * **Note:** This method mutates `object`.
  30982. *
  30983. * @static
  30984. * @memberOf _
  30985. * @since 4.0.0
  30986. * @category Object
  30987. * @param {Object} object The object to modify.
  30988. * @param {Array|string} path The path of the property to set.
  30989. * @param {*} value The value to set.
  30990. * @param {Function} [customizer] The function to customize assigned values.
  30991. * @returns {Object} Returns `object`.
  30992. * @example
  30993. *
  30994. * var object = {};
  30995. *
  30996. * _.setWith(object, '[0][1]', 'a', Object);
  30997. * // => { '0': { '1': 'a' } }
  30998. */
  30999. function setWith(object, path, value, customizer) {
  31000. customizer = typeof customizer == 'function' ? customizer : undefined;
  31001. return object == null ? object : baseSet(object, path, value, customizer);
  31002. }
  31003. /**
  31004. * Creates an array of own enumerable string keyed-value pairs for `object`
  31005. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31006. * entries are returned.
  31007. *
  31008. * @static
  31009. * @memberOf _
  31010. * @since 4.0.0
  31011. * @alias entries
  31012. * @category Object
  31013. * @param {Object} object The object to query.
  31014. * @returns {Array} Returns the key-value pairs.
  31015. * @example
  31016. *
  31017. * function Foo() {
  31018. * this.a = 1;
  31019. * this.b = 2;
  31020. * }
  31021. *
  31022. * Foo.prototype.c = 3;
  31023. *
  31024. * _.toPairs(new Foo);
  31025. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31026. */
  31027. var toPairs = createToPairs(keys);
  31028. /**
  31029. * Creates an array of own and inherited enumerable string keyed-value pairs
  31030. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31031. * or set, its entries are returned.
  31032. *
  31033. * @static
  31034. * @memberOf _
  31035. * @since 4.0.0
  31036. * @alias entriesIn
  31037. * @category Object
  31038. * @param {Object} object The object to query.
  31039. * @returns {Array} Returns the key-value pairs.
  31040. * @example
  31041. *
  31042. * function Foo() {
  31043. * this.a = 1;
  31044. * this.b = 2;
  31045. * }
  31046. *
  31047. * Foo.prototype.c = 3;
  31048. *
  31049. * _.toPairsIn(new Foo);
  31050. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31051. */
  31052. var toPairsIn = createToPairs(keysIn);
  31053. /**
  31054. * An alternative to `_.reduce`; this method transforms `object` to a new
  31055. * `accumulator` object which is the result of running each of its own
  31056. * enumerable string keyed properties thru `iteratee`, with each invocation
  31057. * potentially mutating the `accumulator` object. If `accumulator` is not
  31058. * provided, a new object with the same `[[Prototype]]` will be used. The
  31059. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31060. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31061. *
  31062. * @static
  31063. * @memberOf _
  31064. * @since 1.3.0
  31065. * @category Object
  31066. * @param {Object} object The object to iterate over.
  31067. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31068. * @param {*} [accumulator] The custom accumulator value.
  31069. * @returns {*} Returns the accumulated value.
  31070. * @example
  31071. *
  31072. * _.transform([2, 3, 4], function(result, n) {
  31073. * result.push(n *= n);
  31074. * return n % 2 == 0;
  31075. * }, []);
  31076. * // => [4, 9]
  31077. *
  31078. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31079. * (result[value] || (result[value] = [])).push(key);
  31080. * }, {});
  31081. * // => { '1': ['a', 'c'], '2': ['b'] }
  31082. */
  31083. function transform(object, iteratee, accumulator) {
  31084. var isArr = isArray(object),
  31085. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31086. iteratee = getIteratee(iteratee, 4);
  31087. if (accumulator == null) {
  31088. var Ctor = object && object.constructor;
  31089. if (isArrLike) {
  31090. accumulator = isArr ? new Ctor : [];
  31091. }
  31092. else if (isObject(object)) {
  31093. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31094. }
  31095. else {
  31096. accumulator = {};
  31097. }
  31098. }
  31099. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31100. return iteratee(accumulator, value, index, object);
  31101. });
  31102. return accumulator;
  31103. }
  31104. /**
  31105. * Removes the property at `path` of `object`.
  31106. *
  31107. * **Note:** This method mutates `object`.
  31108. *
  31109. * @static
  31110. * @memberOf _
  31111. * @since 4.0.0
  31112. * @category Object
  31113. * @param {Object} object The object to modify.
  31114. * @param {Array|string} path The path of the property to unset.
  31115. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31116. * @example
  31117. *
  31118. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31119. * _.unset(object, 'a[0].b.c');
  31120. * // => true
  31121. *
  31122. * console.log(object);
  31123. * // => { 'a': [{ 'b': {} }] };
  31124. *
  31125. * _.unset(object, ['a', '0', 'b', 'c']);
  31126. * // => true
  31127. *
  31128. * console.log(object);
  31129. * // => { 'a': [{ 'b': {} }] };
  31130. */
  31131. function unset(object, path) {
  31132. return object == null ? true : baseUnset(object, path);
  31133. }
  31134. /**
  31135. * This method is like `_.set` except that accepts `updater` to produce the
  31136. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31137. * is invoked with one argument: (value).
  31138. *
  31139. * **Note:** This method mutates `object`.
  31140. *
  31141. * @static
  31142. * @memberOf _
  31143. * @since 4.6.0
  31144. * @category Object
  31145. * @param {Object} object The object to modify.
  31146. * @param {Array|string} path The path of the property to set.
  31147. * @param {Function} updater The function to produce the updated value.
  31148. * @returns {Object} Returns `object`.
  31149. * @example
  31150. *
  31151. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31152. *
  31153. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31154. * console.log(object.a[0].b.c);
  31155. * // => 9
  31156. *
  31157. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31158. * console.log(object.x[0].y.z);
  31159. * // => 0
  31160. */
  31161. function update(object, path, updater) {
  31162. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31163. }
  31164. /**
  31165. * This method is like `_.update` except that it accepts `customizer` which is
  31166. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31167. * path creation is handled by the method instead. The `customizer` is invoked
  31168. * with three arguments: (nsValue, key, nsObject).
  31169. *
  31170. * **Note:** This method mutates `object`.
  31171. *
  31172. * @static
  31173. * @memberOf _
  31174. * @since 4.6.0
  31175. * @category Object
  31176. * @param {Object} object The object to modify.
  31177. * @param {Array|string} path The path of the property to set.
  31178. * @param {Function} updater The function to produce the updated value.
  31179. * @param {Function} [customizer] The function to customize assigned values.
  31180. * @returns {Object} Returns `object`.
  31181. * @example
  31182. *
  31183. * var object = {};
  31184. *
  31185. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31186. * // => { '0': { '1': 'a' } }
  31187. */
  31188. function updateWith(object, path, updater, customizer) {
  31189. customizer = typeof customizer == 'function' ? customizer : undefined;
  31190. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31191. }
  31192. /**
  31193. * Creates an array of the own enumerable string keyed property values of `object`.
  31194. *
  31195. * **Note:** Non-object values are coerced to objects.
  31196. *
  31197. * @static
  31198. * @since 0.1.0
  31199. * @memberOf _
  31200. * @category Object
  31201. * @param {Object} object The object to query.
  31202. * @returns {Array} Returns the array of property values.
  31203. * @example
  31204. *
  31205. * function Foo() {
  31206. * this.a = 1;
  31207. * this.b = 2;
  31208. * }
  31209. *
  31210. * Foo.prototype.c = 3;
  31211. *
  31212. * _.values(new Foo);
  31213. * // => [1, 2] (iteration order is not guaranteed)
  31214. *
  31215. * _.values('hi');
  31216. * // => ['h', 'i']
  31217. */
  31218. function values(object) {
  31219. return object == null ? [] : baseValues(object, keys(object));
  31220. }
  31221. /**
  31222. * Creates an array of the own and inherited enumerable string keyed property
  31223. * values of `object`.
  31224. *
  31225. * **Note:** Non-object values are coerced to objects.
  31226. *
  31227. * @static
  31228. * @memberOf _
  31229. * @since 3.0.0
  31230. * @category Object
  31231. * @param {Object} object The object to query.
  31232. * @returns {Array} Returns the array of property values.
  31233. * @example
  31234. *
  31235. * function Foo() {
  31236. * this.a = 1;
  31237. * this.b = 2;
  31238. * }
  31239. *
  31240. * Foo.prototype.c = 3;
  31241. *
  31242. * _.valuesIn(new Foo);
  31243. * // => [1, 2, 3] (iteration order is not guaranteed)
  31244. */
  31245. function valuesIn(object) {
  31246. return object == null ? [] : baseValues(object, keysIn(object));
  31247. }
  31248. /*------------------------------------------------------------------------*/
  31249. /**
  31250. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31251. *
  31252. * @static
  31253. * @memberOf _
  31254. * @since 4.0.0
  31255. * @category Number
  31256. * @param {number} number The number to clamp.
  31257. * @param {number} [lower] The lower bound.
  31258. * @param {number} upper The upper bound.
  31259. * @returns {number} Returns the clamped number.
  31260. * @example
  31261. *
  31262. * _.clamp(-10, -5, 5);
  31263. * // => -5
  31264. *
  31265. * _.clamp(10, -5, 5);
  31266. * // => 5
  31267. */
  31268. function clamp(number, lower, upper) {
  31269. if (upper === undefined) {
  31270. upper = lower;
  31271. lower = undefined;
  31272. }
  31273. if (upper !== undefined) {
  31274. upper = toNumber(upper);
  31275. upper = upper === upper ? upper : 0;
  31276. }
  31277. if (lower !== undefined) {
  31278. lower = toNumber(lower);
  31279. lower = lower === lower ? lower : 0;
  31280. }
  31281. return baseClamp(toNumber(number), lower, upper);
  31282. }
  31283. /**
  31284. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31285. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31286. * If `start` is greater than `end` the params are swapped to support
  31287. * negative ranges.
  31288. *
  31289. * @static
  31290. * @memberOf _
  31291. * @since 3.3.0
  31292. * @category Number
  31293. * @param {number} number The number to check.
  31294. * @param {number} [start=0] The start of the range.
  31295. * @param {number} end The end of the range.
  31296. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31297. * @see _.range, _.rangeRight
  31298. * @example
  31299. *
  31300. * _.inRange(3, 2, 4);
  31301. * // => true
  31302. *
  31303. * _.inRange(4, 8);
  31304. * // => true
  31305. *
  31306. * _.inRange(4, 2);
  31307. * // => false
  31308. *
  31309. * _.inRange(2, 2);
  31310. * // => false
  31311. *
  31312. * _.inRange(1.2, 2);
  31313. * // => true
  31314. *
  31315. * _.inRange(5.2, 4);
  31316. * // => false
  31317. *
  31318. * _.inRange(-3, -2, -6);
  31319. * // => true
  31320. */
  31321. function inRange(number, start, end) {
  31322. start = toFinite(start);
  31323. if (end === undefined) {
  31324. end = start;
  31325. start = 0;
  31326. } else {
  31327. end = toFinite(end);
  31328. }
  31329. number = toNumber(number);
  31330. return baseInRange(number, start, end);
  31331. }
  31332. /**
  31333. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31334. * If only one argument is provided a number between `0` and the given number
  31335. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31336. * floats, a floating-point number is returned instead of an integer.
  31337. *
  31338. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31339. * floating-point values which can produce unexpected results.
  31340. *
  31341. * @static
  31342. * @memberOf _
  31343. * @since 0.7.0
  31344. * @category Number
  31345. * @param {number} [lower=0] The lower bound.
  31346. * @param {number} [upper=1] The upper bound.
  31347. * @param {boolean} [floating] Specify returning a floating-point number.
  31348. * @returns {number} Returns the random number.
  31349. * @example
  31350. *
  31351. * _.random(0, 5);
  31352. * // => an integer between 0 and 5
  31353. *
  31354. * _.random(5);
  31355. * // => also an integer between 0 and 5
  31356. *
  31357. * _.random(5, true);
  31358. * // => a floating-point number between 0 and 5
  31359. *
  31360. * _.random(1.2, 5.2);
  31361. * // => a floating-point number between 1.2 and 5.2
  31362. */
  31363. function random(lower, upper, floating) {
  31364. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31365. upper = floating = undefined;
  31366. }
  31367. if (floating === undefined) {
  31368. if (typeof upper == 'boolean') {
  31369. floating = upper;
  31370. upper = undefined;
  31371. }
  31372. else if (typeof lower == 'boolean') {
  31373. floating = lower;
  31374. lower = undefined;
  31375. }
  31376. }
  31377. if (lower === undefined && upper === undefined) {
  31378. lower = 0;
  31379. upper = 1;
  31380. }
  31381. else {
  31382. lower = toFinite(lower);
  31383. if (upper === undefined) {
  31384. upper = lower;
  31385. lower = 0;
  31386. } else {
  31387. upper = toFinite(upper);
  31388. }
  31389. }
  31390. if (lower > upper) {
  31391. var temp = lower;
  31392. lower = upper;
  31393. upper = temp;
  31394. }
  31395. if (floating || lower % 1 || upper % 1) {
  31396. var rand = nativeRandom();
  31397. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31398. }
  31399. return baseRandom(lower, upper);
  31400. }
  31401. /*------------------------------------------------------------------------*/
  31402. /**
  31403. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31404. *
  31405. * @static
  31406. * @memberOf _
  31407. * @since 3.0.0
  31408. * @category String
  31409. * @param {string} [string=''] The string to convert.
  31410. * @returns {string} Returns the camel cased string.
  31411. * @example
  31412. *
  31413. * _.camelCase('Foo Bar');
  31414. * // => 'fooBar'
  31415. *
  31416. * _.camelCase('--foo-bar--');
  31417. * // => 'fooBar'
  31418. *
  31419. * _.camelCase('__FOO_BAR__');
  31420. * // => 'fooBar'
  31421. */
  31422. var camelCase = createCompounder(function(result, word, index) {
  31423. word = word.toLowerCase();
  31424. return result + (index ? capitalize(word) : word);
  31425. });
  31426. /**
  31427. * Converts the first character of `string` to upper case and the remaining
  31428. * to lower case.
  31429. *
  31430. * @static
  31431. * @memberOf _
  31432. * @since 3.0.0
  31433. * @category String
  31434. * @param {string} [string=''] The string to capitalize.
  31435. * @returns {string} Returns the capitalized string.
  31436. * @example
  31437. *
  31438. * _.capitalize('FRED');
  31439. * // => 'Fred'
  31440. */
  31441. function capitalize(string) {
  31442. return upperFirst(toString(string).toLowerCase());
  31443. }
  31444. /**
  31445. * Deburrs `string` by converting
  31446. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31447. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31448. * letters to basic Latin letters and removing
  31449. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31450. *
  31451. * @static
  31452. * @memberOf _
  31453. * @since 3.0.0
  31454. * @category String
  31455. * @param {string} [string=''] The string to deburr.
  31456. * @returns {string} Returns the deburred string.
  31457. * @example
  31458. *
  31459. * _.deburr('déjà vu');
  31460. * // => 'deja vu'
  31461. */
  31462. function deburr(string) {
  31463. string = toString(string);
  31464. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31465. }
  31466. /**
  31467. * Checks if `string` ends with the given target string.
  31468. *
  31469. * @static
  31470. * @memberOf _
  31471. * @since 3.0.0
  31472. * @category String
  31473. * @param {string} [string=''] The string to inspect.
  31474. * @param {string} [target] The string to search for.
  31475. * @param {number} [position=string.length] The position to search up to.
  31476. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31477. * else `false`.
  31478. * @example
  31479. *
  31480. * _.endsWith('abc', 'c');
  31481. * // => true
  31482. *
  31483. * _.endsWith('abc', 'b');
  31484. * // => false
  31485. *
  31486. * _.endsWith('abc', 'b', 2);
  31487. * // => true
  31488. */
  31489. function endsWith(string, target, position) {
  31490. string = toString(string);
  31491. target = baseToString(target);
  31492. var length = string.length;
  31493. position = position === undefined
  31494. ? length
  31495. : baseClamp(toInteger(position), 0, length);
  31496. var end = position;
  31497. position -= target.length;
  31498. return position >= 0 && string.slice(position, end) == target;
  31499. }
  31500. /**
  31501. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31502. * corresponding HTML entities.
  31503. *
  31504. * **Note:** No other characters are escaped. To escape additional
  31505. * characters use a third-party library like [_he_](https://mths.be/he).
  31506. *
  31507. * Though the ">" character is escaped for symmetry, characters like
  31508. * ">" and "/" don't need escaping in HTML and have no special meaning
  31509. * unless they're part of a tag or unquoted attribute value. See
  31510. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31511. * (under "semi-related fun fact") for more details.
  31512. *
  31513. * When working with HTML you should always
  31514. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31515. * XSS vectors.
  31516. *
  31517. * @static
  31518. * @since 0.1.0
  31519. * @memberOf _
  31520. * @category String
  31521. * @param {string} [string=''] The string to escape.
  31522. * @returns {string} Returns the escaped string.
  31523. * @example
  31524. *
  31525. * _.escape('fred, barney, & pebbles');
  31526. * // => 'fred, barney, &amp; pebbles'
  31527. */
  31528. function escape(string) {
  31529. string = toString(string);
  31530. return (string && reHasUnescapedHtml.test(string))
  31531. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31532. : string;
  31533. }
  31534. /**
  31535. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31536. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31537. *
  31538. * @static
  31539. * @memberOf _
  31540. * @since 3.0.0
  31541. * @category String
  31542. * @param {string} [string=''] The string to escape.
  31543. * @returns {string} Returns the escaped string.
  31544. * @example
  31545. *
  31546. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31547. * // => '\[lodash\]\(https://lodash\.com/\)'
  31548. */
  31549. function escapeRegExp(string) {
  31550. string = toString(string);
  31551. return (string && reHasRegExpChar.test(string))
  31552. ? string.replace(reRegExpChar, '\\$&')
  31553. : string;
  31554. }
  31555. /**
  31556. * Converts `string` to
  31557. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31558. *
  31559. * @static
  31560. * @memberOf _
  31561. * @since 3.0.0
  31562. * @category String
  31563. * @param {string} [string=''] The string to convert.
  31564. * @returns {string} Returns the kebab cased string.
  31565. * @example
  31566. *
  31567. * _.kebabCase('Foo Bar');
  31568. * // => 'foo-bar'
  31569. *
  31570. * _.kebabCase('fooBar');
  31571. * // => 'foo-bar'
  31572. *
  31573. * _.kebabCase('__FOO_BAR__');
  31574. * // => 'foo-bar'
  31575. */
  31576. var kebabCase = createCompounder(function(result, word, index) {
  31577. return result + (index ? '-' : '') + word.toLowerCase();
  31578. });
  31579. /**
  31580. * Converts `string`, as space separated words, to lower case.
  31581. *
  31582. * @static
  31583. * @memberOf _
  31584. * @since 4.0.0
  31585. * @category String
  31586. * @param {string} [string=''] The string to convert.
  31587. * @returns {string} Returns the lower cased string.
  31588. * @example
  31589. *
  31590. * _.lowerCase('--Foo-Bar--');
  31591. * // => 'foo bar'
  31592. *
  31593. * _.lowerCase('fooBar');
  31594. * // => 'foo bar'
  31595. *
  31596. * _.lowerCase('__FOO_BAR__');
  31597. * // => 'foo bar'
  31598. */
  31599. var lowerCase = createCompounder(function(result, word, index) {
  31600. return result + (index ? ' ' : '') + word.toLowerCase();
  31601. });
  31602. /**
  31603. * Converts the first character of `string` to lower case.
  31604. *
  31605. * @static
  31606. * @memberOf _
  31607. * @since 4.0.0
  31608. * @category String
  31609. * @param {string} [string=''] The string to convert.
  31610. * @returns {string} Returns the converted string.
  31611. * @example
  31612. *
  31613. * _.lowerFirst('Fred');
  31614. * // => 'fred'
  31615. *
  31616. * _.lowerFirst('FRED');
  31617. * // => 'fRED'
  31618. */
  31619. var lowerFirst = createCaseFirst('toLowerCase');
  31620. /**
  31621. * Pads `string` on the left and right sides if it's shorter than `length`.
  31622. * Padding characters are truncated if they can't be evenly divided by `length`.
  31623. *
  31624. * @static
  31625. * @memberOf _
  31626. * @since 3.0.0
  31627. * @category String
  31628. * @param {string} [string=''] The string to pad.
  31629. * @param {number} [length=0] The padding length.
  31630. * @param {string} [chars=' '] The string used as padding.
  31631. * @returns {string} Returns the padded string.
  31632. * @example
  31633. *
  31634. * _.pad('abc', 8);
  31635. * // => ' abc '
  31636. *
  31637. * _.pad('abc', 8, '_-');
  31638. * // => '_-abc_-_'
  31639. *
  31640. * _.pad('abc', 3);
  31641. * // => 'abc'
  31642. */
  31643. function pad(string, length, chars) {
  31644. string = toString(string);
  31645. length = toInteger(length);
  31646. var strLength = length ? stringSize(string) : 0;
  31647. if (!length || strLength >= length) {
  31648. return string;
  31649. }
  31650. var mid = (length - strLength) / 2;
  31651. return (
  31652. createPadding(nativeFloor(mid), chars) +
  31653. string +
  31654. createPadding(nativeCeil(mid), chars)
  31655. );
  31656. }
  31657. /**
  31658. * Pads `string` on the right side if it's shorter than `length`. Padding
  31659. * characters are truncated if they exceed `length`.
  31660. *
  31661. * @static
  31662. * @memberOf _
  31663. * @since 4.0.0
  31664. * @category String
  31665. * @param {string} [string=''] The string to pad.
  31666. * @param {number} [length=0] The padding length.
  31667. * @param {string} [chars=' '] The string used as padding.
  31668. * @returns {string} Returns the padded string.
  31669. * @example
  31670. *
  31671. * _.padEnd('abc', 6);
  31672. * // => 'abc '
  31673. *
  31674. * _.padEnd('abc', 6, '_-');
  31675. * // => 'abc_-_'
  31676. *
  31677. * _.padEnd('abc', 3);
  31678. * // => 'abc'
  31679. */
  31680. function padEnd(string, length, chars) {
  31681. string = toString(string);
  31682. length = toInteger(length);
  31683. var strLength = length ? stringSize(string) : 0;
  31684. return (length && strLength < length)
  31685. ? (string + createPadding(length - strLength, chars))
  31686. : string;
  31687. }
  31688. /**
  31689. * Pads `string` on the left side if it's shorter than `length`. Padding
  31690. * characters are truncated if they exceed `length`.
  31691. *
  31692. * @static
  31693. * @memberOf _
  31694. * @since 4.0.0
  31695. * @category String
  31696. * @param {string} [string=''] The string to pad.
  31697. * @param {number} [length=0] The padding length.
  31698. * @param {string} [chars=' '] The string used as padding.
  31699. * @returns {string} Returns the padded string.
  31700. * @example
  31701. *
  31702. * _.padStart('abc', 6);
  31703. * // => ' abc'
  31704. *
  31705. * _.padStart('abc', 6, '_-');
  31706. * // => '_-_abc'
  31707. *
  31708. * _.padStart('abc', 3);
  31709. * // => 'abc'
  31710. */
  31711. function padStart(string, length, chars) {
  31712. string = toString(string);
  31713. length = toInteger(length);
  31714. var strLength = length ? stringSize(string) : 0;
  31715. return (length && strLength < length)
  31716. ? (createPadding(length - strLength, chars) + string)
  31717. : string;
  31718. }
  31719. /**
  31720. * Converts `string` to an integer of the specified radix. If `radix` is
  31721. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31722. * hexadecimal, in which case a `radix` of `16` is used.
  31723. *
  31724. * **Note:** This method aligns with the
  31725. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31726. *
  31727. * @static
  31728. * @memberOf _
  31729. * @since 1.1.0
  31730. * @category String
  31731. * @param {string} string The string to convert.
  31732. * @param {number} [radix=10] The radix to interpret `value` by.
  31733. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31734. * @returns {number} Returns the converted integer.
  31735. * @example
  31736. *
  31737. * _.parseInt('08');
  31738. * // => 8
  31739. *
  31740. * _.map(['6', '08', '10'], _.parseInt);
  31741. * // => [6, 8, 10]
  31742. */
  31743. function parseInt(string, radix, guard) {
  31744. if (guard || radix == null) {
  31745. radix = 0;
  31746. } else if (radix) {
  31747. radix = +radix;
  31748. }
  31749. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31750. }
  31751. /**
  31752. * Repeats the given string `n` times.
  31753. *
  31754. * @static
  31755. * @memberOf _
  31756. * @since 3.0.0
  31757. * @category String
  31758. * @param {string} [string=''] The string to repeat.
  31759. * @param {number} [n=1] The number of times to repeat the string.
  31760. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31761. * @returns {string} Returns the repeated string.
  31762. * @example
  31763. *
  31764. * _.repeat('*', 3);
  31765. * // => '***'
  31766. *
  31767. * _.repeat('abc', 2);
  31768. * // => 'abcabc'
  31769. *
  31770. * _.repeat('abc', 0);
  31771. * // => ''
  31772. */
  31773. function repeat(string, n, guard) {
  31774. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31775. n = 1;
  31776. } else {
  31777. n = toInteger(n);
  31778. }
  31779. return baseRepeat(toString(string), n);
  31780. }
  31781. /**
  31782. * Replaces matches for `pattern` in `string` with `replacement`.
  31783. *
  31784. * **Note:** This method is based on
  31785. * [`String#replace`](https://mdn.io/String/replace).
  31786. *
  31787. * @static
  31788. * @memberOf _
  31789. * @since 4.0.0
  31790. * @category String
  31791. * @param {string} [string=''] The string to modify.
  31792. * @param {RegExp|string} pattern The pattern to replace.
  31793. * @param {Function|string} replacement The match replacement.
  31794. * @returns {string} Returns the modified string.
  31795. * @example
  31796. *
  31797. * _.replace('Hi Fred', 'Fred', 'Barney');
  31798. * // => 'Hi Barney'
  31799. */
  31800. function replace() {
  31801. var args = arguments,
  31802. string = toString(args[0]);
  31803. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31804. }
  31805. /**
  31806. * Converts `string` to
  31807. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31808. *
  31809. * @static
  31810. * @memberOf _
  31811. * @since 3.0.0
  31812. * @category String
  31813. * @param {string} [string=''] The string to convert.
  31814. * @returns {string} Returns the snake cased string.
  31815. * @example
  31816. *
  31817. * _.snakeCase('Foo Bar');
  31818. * // => 'foo_bar'
  31819. *
  31820. * _.snakeCase('fooBar');
  31821. * // => 'foo_bar'
  31822. *
  31823. * _.snakeCase('--FOO-BAR--');
  31824. * // => 'foo_bar'
  31825. */
  31826. var snakeCase = createCompounder(function(result, word, index) {
  31827. return result + (index ? '_' : '') + word.toLowerCase();
  31828. });
  31829. /**
  31830. * Splits `string` by `separator`.
  31831. *
  31832. * **Note:** This method is based on
  31833. * [`String#split`](https://mdn.io/String/split).
  31834. *
  31835. * @static
  31836. * @memberOf _
  31837. * @since 4.0.0
  31838. * @category String
  31839. * @param {string} [string=''] The string to split.
  31840. * @param {RegExp|string} separator The separator pattern to split by.
  31841. * @param {number} [limit] The length to truncate results to.
  31842. * @returns {Array} Returns the string segments.
  31843. * @example
  31844. *
  31845. * _.split('a-b-c', '-', 2);
  31846. * // => ['a', 'b']
  31847. */
  31848. function split(string, separator, limit) {
  31849. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31850. separator = limit = undefined;
  31851. }
  31852. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31853. if (!limit) {
  31854. return [];
  31855. }
  31856. string = toString(string);
  31857. if (string && (
  31858. typeof separator == 'string' ||
  31859. (separator != null && !isRegExp(separator))
  31860. )) {
  31861. separator = baseToString(separator);
  31862. if (!separator && hasUnicode(string)) {
  31863. return castSlice(stringToArray(string), 0, limit);
  31864. }
  31865. }
  31866. return string.split(separator, limit);
  31867. }
  31868. /**
  31869. * Converts `string` to
  31870. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31871. *
  31872. * @static
  31873. * @memberOf _
  31874. * @since 3.1.0
  31875. * @category String
  31876. * @param {string} [string=''] The string to convert.
  31877. * @returns {string} Returns the start cased string.
  31878. * @example
  31879. *
  31880. * _.startCase('--foo-bar--');
  31881. * // => 'Foo Bar'
  31882. *
  31883. * _.startCase('fooBar');
  31884. * // => 'Foo Bar'
  31885. *
  31886. * _.startCase('__FOO_BAR__');
  31887. * // => 'FOO BAR'
  31888. */
  31889. var startCase = createCompounder(function(result, word, index) {
  31890. return result + (index ? ' ' : '') + upperFirst(word);
  31891. });
  31892. /**
  31893. * Checks if `string` starts with the given target string.
  31894. *
  31895. * @static
  31896. * @memberOf _
  31897. * @since 3.0.0
  31898. * @category String
  31899. * @param {string} [string=''] The string to inspect.
  31900. * @param {string} [target] The string to search for.
  31901. * @param {number} [position=0] The position to search from.
  31902. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31903. * else `false`.
  31904. * @example
  31905. *
  31906. * _.startsWith('abc', 'a');
  31907. * // => true
  31908. *
  31909. * _.startsWith('abc', 'b');
  31910. * // => false
  31911. *
  31912. * _.startsWith('abc', 'b', 1);
  31913. * // => true
  31914. */
  31915. function startsWith(string, target, position) {
  31916. string = toString(string);
  31917. position = position == null
  31918. ? 0
  31919. : baseClamp(toInteger(position), 0, string.length);
  31920. target = baseToString(target);
  31921. return string.slice(position, position + target.length) == target;
  31922. }
  31923. /**
  31924. * Creates a compiled template function that can interpolate data properties
  31925. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  31926. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  31927. * properties may be accessed as free variables in the template. If a setting
  31928. * object is given, it takes precedence over `_.templateSettings` values.
  31929. *
  31930. * **Note:** In the development build `_.template` utilizes
  31931. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  31932. * for easier debugging.
  31933. *
  31934. * For more information on precompiling templates see
  31935. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  31936. *
  31937. * For more information on Chrome extension sandboxes see
  31938. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  31939. *
  31940. * @static
  31941. * @since 0.1.0
  31942. * @memberOf _
  31943. * @category String
  31944. * @param {string} [string=''] The template string.
  31945. * @param {Object} [options={}] The options object.
  31946. * @param {RegExp} [options.escape=_.templateSettings.escape]
  31947. * The HTML "escape" delimiter.
  31948. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  31949. * The "evaluate" delimiter.
  31950. * @param {Object} [options.imports=_.templateSettings.imports]
  31951. * An object to import into the template as free variables.
  31952. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  31953. * The "interpolate" delimiter.
  31954. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  31955. * The sourceURL of the compiled template.
  31956. * @param {string} [options.variable='obj']
  31957. * The data object variable name.
  31958. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31959. * @returns {Function} Returns the compiled template function.
  31960. * @example
  31961. *
  31962. * // Use the "interpolate" delimiter to create a compiled template.
  31963. * var compiled = _.template('hello <%= user %>!');
  31964. * compiled({ 'user': 'fred' });
  31965. * // => 'hello fred!'
  31966. *
  31967. * // Use the HTML "escape" delimiter to escape data property values.
  31968. * var compiled = _.template('<b><%- value %></b>');
  31969. * compiled({ 'value': '<script>' });
  31970. * // => '<b>&lt;script&gt;</b>'
  31971. *
  31972. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  31973. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  31974. * compiled({ 'users': ['fred', 'barney'] });
  31975. * // => '<li>fred</li><li>barney</li>'
  31976. *
  31977. * // Use the internal `print` function in "evaluate" delimiters.
  31978. * var compiled = _.template('<% print("hello " + user); %>!');
  31979. * compiled({ 'user': 'barney' });
  31980. * // => 'hello barney!'
  31981. *
  31982. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  31983. * // Disable support by replacing the "interpolate" delimiter.
  31984. * var compiled = _.template('hello ${ user }!');
  31985. * compiled({ 'user': 'pebbles' });
  31986. * // => 'hello pebbles!'
  31987. *
  31988. * // Use backslashes to treat delimiters as plain text.
  31989. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  31990. * compiled({ 'value': 'ignored' });
  31991. * // => '<%- value %>'
  31992. *
  31993. * // Use the `imports` option to import `jQuery` as `jq`.
  31994. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  31995. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  31996. * compiled({ 'users': ['fred', 'barney'] });
  31997. * // => '<li>fred</li><li>barney</li>'
  31998. *
  31999. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32000. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32001. * compiled(data);
  32002. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32003. *
  32004. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32005. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32006. * compiled.source;
  32007. * // => function(data) {
  32008. * // var __t, __p = '';
  32009. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32010. * // return __p;
  32011. * // }
  32012. *
  32013. * // Use custom template delimiters.
  32014. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32015. * var compiled = _.template('hello {{ user }}!');
  32016. * compiled({ 'user': 'mustache' });
  32017. * // => 'hello mustache!'
  32018. *
  32019. * // Use the `source` property to inline compiled templates for meaningful
  32020. * // line numbers in error messages and stack traces.
  32021. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32022. * var JST = {\
  32023. * "main": ' + _.template(mainText).source + '\
  32024. * };\
  32025. * ');
  32026. */
  32027. function template(string, options, guard) {
  32028. // Based on John Resig's `tmpl` implementation
  32029. // (http://ejohn.org/blog/javascript-micro-templating/)
  32030. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32031. var settings = lodash.templateSettings;
  32032. if (guard && isIterateeCall(string, options, guard)) {
  32033. options = undefined;
  32034. }
  32035. string = toString(string);
  32036. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32037. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32038. importsKeys = keys(imports),
  32039. importsValues = baseValues(imports, importsKeys);
  32040. var isEscaping,
  32041. isEvaluating,
  32042. index = 0,
  32043. interpolate = options.interpolate || reNoMatch,
  32044. source = "__p += '";
  32045. // Compile the regexp to match each delimiter.
  32046. var reDelimiters = RegExp(
  32047. (options.escape || reNoMatch).source + '|' +
  32048. interpolate.source + '|' +
  32049. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32050. (options.evaluate || reNoMatch).source + '|$'
  32051. , 'g');
  32052. // Use a sourceURL for easier debugging.
  32053. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32054. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32055. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32056. var sourceURL = '//# sourceURL=' +
  32057. (hasOwnProperty.call(options, 'sourceURL')
  32058. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32059. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32060. ) + '\n';
  32061. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32062. interpolateValue || (interpolateValue = esTemplateValue);
  32063. // Escape characters that can't be included in string literals.
  32064. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32065. // Replace delimiters with snippets.
  32066. if (escapeValue) {
  32067. isEscaping = true;
  32068. source += "' +\n__e(" + escapeValue + ") +\n'";
  32069. }
  32070. if (evaluateValue) {
  32071. isEvaluating = true;
  32072. source += "';\n" + evaluateValue + ";\n__p += '";
  32073. }
  32074. if (interpolateValue) {
  32075. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32076. }
  32077. index = offset + match.length;
  32078. // The JS engine embedded in Adobe products needs `match` returned in
  32079. // order to produce the correct `offset` value.
  32080. return match;
  32081. });
  32082. source += "';\n";
  32083. // If `variable` is not specified wrap a with-statement around the generated
  32084. // code to add the data object to the top of the scope chain.
  32085. // Like with sourceURL, we take care to not check the option's prototype,
  32086. // as this configuration is a code injection vector.
  32087. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32088. if (!variable) {
  32089. source = 'with (obj) {\n' + source + '\n}\n';
  32090. }
  32091. // Cleanup code by stripping empty strings.
  32092. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32093. .replace(reEmptyStringMiddle, '$1')
  32094. .replace(reEmptyStringTrailing, '$1;');
  32095. // Frame code as the function body.
  32096. source = 'function(' + (variable || 'obj') + ') {\n' +
  32097. (variable
  32098. ? ''
  32099. : 'obj || (obj = {});\n'
  32100. ) +
  32101. "var __t, __p = ''" +
  32102. (isEscaping
  32103. ? ', __e = _.escape'
  32104. : ''
  32105. ) +
  32106. (isEvaluating
  32107. ? ', __j = Array.prototype.join;\n' +
  32108. "function print() { __p += __j.call(arguments, '') }\n"
  32109. : ';\n'
  32110. ) +
  32111. source +
  32112. 'return __p\n}';
  32113. var result = attempt(function() {
  32114. return Function(importsKeys, sourceURL + 'return ' + source)
  32115. .apply(undefined, importsValues);
  32116. });
  32117. // Provide the compiled function's source by its `toString` method or
  32118. // the `source` property as a convenience for inlining compiled templates.
  32119. result.source = source;
  32120. if (isError(result)) {
  32121. throw result;
  32122. }
  32123. return result;
  32124. }
  32125. /**
  32126. * Converts `string`, as a whole, to lower case just like
  32127. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32128. *
  32129. * @static
  32130. * @memberOf _
  32131. * @since 4.0.0
  32132. * @category String
  32133. * @param {string} [string=''] The string to convert.
  32134. * @returns {string} Returns the lower cased string.
  32135. * @example
  32136. *
  32137. * _.toLower('--Foo-Bar--');
  32138. * // => '--foo-bar--'
  32139. *
  32140. * _.toLower('fooBar');
  32141. * // => 'foobar'
  32142. *
  32143. * _.toLower('__FOO_BAR__');
  32144. * // => '__foo_bar__'
  32145. */
  32146. function toLower(value) {
  32147. return toString(value).toLowerCase();
  32148. }
  32149. /**
  32150. * Converts `string`, as a whole, to upper case just like
  32151. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32152. *
  32153. * @static
  32154. * @memberOf _
  32155. * @since 4.0.0
  32156. * @category String
  32157. * @param {string} [string=''] The string to convert.
  32158. * @returns {string} Returns the upper cased string.
  32159. * @example
  32160. *
  32161. * _.toUpper('--foo-bar--');
  32162. * // => '--FOO-BAR--'
  32163. *
  32164. * _.toUpper('fooBar');
  32165. * // => 'FOOBAR'
  32166. *
  32167. * _.toUpper('__foo_bar__');
  32168. * // => '__FOO_BAR__'
  32169. */
  32170. function toUpper(value) {
  32171. return toString(value).toUpperCase();
  32172. }
  32173. /**
  32174. * Removes leading and trailing whitespace or specified characters from `string`.
  32175. *
  32176. * @static
  32177. * @memberOf _
  32178. * @since 3.0.0
  32179. * @category String
  32180. * @param {string} [string=''] The string to trim.
  32181. * @param {string} [chars=whitespace] The characters to trim.
  32182. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32183. * @returns {string} Returns the trimmed string.
  32184. * @example
  32185. *
  32186. * _.trim(' abc ');
  32187. * // => 'abc'
  32188. *
  32189. * _.trim('-_-abc-_-', '_-');
  32190. * // => 'abc'
  32191. *
  32192. * _.map([' foo ', ' bar '], _.trim);
  32193. * // => ['foo', 'bar']
  32194. */
  32195. function trim(string, chars, guard) {
  32196. string = toString(string);
  32197. if (string && (guard || chars === undefined)) {
  32198. return string.replace(reTrim, '');
  32199. }
  32200. if (!string || !(chars = baseToString(chars))) {
  32201. return string;
  32202. }
  32203. var strSymbols = stringToArray(string),
  32204. chrSymbols = stringToArray(chars),
  32205. start = charsStartIndex(strSymbols, chrSymbols),
  32206. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32207. return castSlice(strSymbols, start, end).join('');
  32208. }
  32209. /**
  32210. * Removes trailing whitespace or specified characters from `string`.
  32211. *
  32212. * @static
  32213. * @memberOf _
  32214. * @since 4.0.0
  32215. * @category String
  32216. * @param {string} [string=''] The string to trim.
  32217. * @param {string} [chars=whitespace] The characters to trim.
  32218. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32219. * @returns {string} Returns the trimmed string.
  32220. * @example
  32221. *
  32222. * _.trimEnd(' abc ');
  32223. * // => ' abc'
  32224. *
  32225. * _.trimEnd('-_-abc-_-', '_-');
  32226. * // => '-_-abc'
  32227. */
  32228. function trimEnd(string, chars, guard) {
  32229. string = toString(string);
  32230. if (string && (guard || chars === undefined)) {
  32231. return string.replace(reTrimEnd, '');
  32232. }
  32233. if (!string || !(chars = baseToString(chars))) {
  32234. return string;
  32235. }
  32236. var strSymbols = stringToArray(string),
  32237. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32238. return castSlice(strSymbols, 0, end).join('');
  32239. }
  32240. /**
  32241. * Removes leading whitespace or specified characters from `string`.
  32242. *
  32243. * @static
  32244. * @memberOf _
  32245. * @since 4.0.0
  32246. * @category String
  32247. * @param {string} [string=''] The string to trim.
  32248. * @param {string} [chars=whitespace] The characters to trim.
  32249. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32250. * @returns {string} Returns the trimmed string.
  32251. * @example
  32252. *
  32253. * _.trimStart(' abc ');
  32254. * // => 'abc '
  32255. *
  32256. * _.trimStart('-_-abc-_-', '_-');
  32257. * // => 'abc-_-'
  32258. */
  32259. function trimStart(string, chars, guard) {
  32260. string = toString(string);
  32261. if (string && (guard || chars === undefined)) {
  32262. return string.replace(reTrimStart, '');
  32263. }
  32264. if (!string || !(chars = baseToString(chars))) {
  32265. return string;
  32266. }
  32267. var strSymbols = stringToArray(string),
  32268. start = charsStartIndex(strSymbols, stringToArray(chars));
  32269. return castSlice(strSymbols, start).join('');
  32270. }
  32271. /**
  32272. * Truncates `string` if it's longer than the given maximum string length.
  32273. * The last characters of the truncated string are replaced with the omission
  32274. * string which defaults to "...".
  32275. *
  32276. * @static
  32277. * @memberOf _
  32278. * @since 4.0.0
  32279. * @category String
  32280. * @param {string} [string=''] The string to truncate.
  32281. * @param {Object} [options={}] The options object.
  32282. * @param {number} [options.length=30] The maximum string length.
  32283. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32284. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32285. * @returns {string} Returns the truncated string.
  32286. * @example
  32287. *
  32288. * _.truncate('hi-diddly-ho there, neighborino');
  32289. * // => 'hi-diddly-ho there, neighbo...'
  32290. *
  32291. * _.truncate('hi-diddly-ho there, neighborino', {
  32292. * 'length': 24,
  32293. * 'separator': ' '
  32294. * });
  32295. * // => 'hi-diddly-ho there,...'
  32296. *
  32297. * _.truncate('hi-diddly-ho there, neighborino', {
  32298. * 'length': 24,
  32299. * 'separator': /,? +/
  32300. * });
  32301. * // => 'hi-diddly-ho there...'
  32302. *
  32303. * _.truncate('hi-diddly-ho there, neighborino', {
  32304. * 'omission': ' [...]'
  32305. * });
  32306. * // => 'hi-diddly-ho there, neig [...]'
  32307. */
  32308. function truncate(string, options) {
  32309. var length = DEFAULT_TRUNC_LENGTH,
  32310. omission = DEFAULT_TRUNC_OMISSION;
  32311. if (isObject(options)) {
  32312. var separator = 'separator' in options ? options.separator : separator;
  32313. length = 'length' in options ? toInteger(options.length) : length;
  32314. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32315. }
  32316. string = toString(string);
  32317. var strLength = string.length;
  32318. if (hasUnicode(string)) {
  32319. var strSymbols = stringToArray(string);
  32320. strLength = strSymbols.length;
  32321. }
  32322. if (length >= strLength) {
  32323. return string;
  32324. }
  32325. var end = length - stringSize(omission);
  32326. if (end < 1) {
  32327. return omission;
  32328. }
  32329. var result = strSymbols
  32330. ? castSlice(strSymbols, 0, end).join('')
  32331. : string.slice(0, end);
  32332. if (separator === undefined) {
  32333. return result + omission;
  32334. }
  32335. if (strSymbols) {
  32336. end += (result.length - end);
  32337. }
  32338. if (isRegExp(separator)) {
  32339. if (string.slice(end).search(separator)) {
  32340. var match,
  32341. substring = result;
  32342. if (!separator.global) {
  32343. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32344. }
  32345. separator.lastIndex = 0;
  32346. while ((match = separator.exec(substring))) {
  32347. var newEnd = match.index;
  32348. }
  32349. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32350. }
  32351. } else if (string.indexOf(baseToString(separator), end) != end) {
  32352. var index = result.lastIndexOf(separator);
  32353. if (index > -1) {
  32354. result = result.slice(0, index);
  32355. }
  32356. }
  32357. return result + omission;
  32358. }
  32359. /**
  32360. * The inverse of `_.escape`; this method converts the HTML entities
  32361. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32362. * their corresponding characters.
  32363. *
  32364. * **Note:** No other HTML entities are unescaped. To unescape additional
  32365. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32366. *
  32367. * @static
  32368. * @memberOf _
  32369. * @since 0.6.0
  32370. * @category String
  32371. * @param {string} [string=''] The string to unescape.
  32372. * @returns {string} Returns the unescaped string.
  32373. * @example
  32374. *
  32375. * _.unescape('fred, barney, &amp; pebbles');
  32376. * // => 'fred, barney, & pebbles'
  32377. */
  32378. function unescape(string) {
  32379. string = toString(string);
  32380. return (string && reHasEscapedHtml.test(string))
  32381. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32382. : string;
  32383. }
  32384. /**
  32385. * Converts `string`, as space separated words, to upper case.
  32386. *
  32387. * @static
  32388. * @memberOf _
  32389. * @since 4.0.0
  32390. * @category String
  32391. * @param {string} [string=''] The string to convert.
  32392. * @returns {string} Returns the upper cased string.
  32393. * @example
  32394. *
  32395. * _.upperCase('--foo-bar');
  32396. * // => 'FOO BAR'
  32397. *
  32398. * _.upperCase('fooBar');
  32399. * // => 'FOO BAR'
  32400. *
  32401. * _.upperCase('__foo_bar__');
  32402. * // => 'FOO BAR'
  32403. */
  32404. var upperCase = createCompounder(function(result, word, index) {
  32405. return result + (index ? ' ' : '') + word.toUpperCase();
  32406. });
  32407. /**
  32408. * Converts the first character of `string` to upper case.
  32409. *
  32410. * @static
  32411. * @memberOf _
  32412. * @since 4.0.0
  32413. * @category String
  32414. * @param {string} [string=''] The string to convert.
  32415. * @returns {string} Returns the converted string.
  32416. * @example
  32417. *
  32418. * _.upperFirst('fred');
  32419. * // => 'Fred'
  32420. *
  32421. * _.upperFirst('FRED');
  32422. * // => 'FRED'
  32423. */
  32424. var upperFirst = createCaseFirst('toUpperCase');
  32425. /**
  32426. * Splits `string` into an array of its words.
  32427. *
  32428. * @static
  32429. * @memberOf _
  32430. * @since 3.0.0
  32431. * @category String
  32432. * @param {string} [string=''] The string to inspect.
  32433. * @param {RegExp|string} [pattern] The pattern to match words.
  32434. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32435. * @returns {Array} Returns the words of `string`.
  32436. * @example
  32437. *
  32438. * _.words('fred, barney, & pebbles');
  32439. * // => ['fred', 'barney', 'pebbles']
  32440. *
  32441. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32442. * // => ['fred', 'barney', '&', 'pebbles']
  32443. */
  32444. function words(string, pattern, guard) {
  32445. string = toString(string);
  32446. pattern = guard ? undefined : pattern;
  32447. if (pattern === undefined) {
  32448. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32449. }
  32450. return string.match(pattern) || [];
  32451. }
  32452. /*------------------------------------------------------------------------*/
  32453. /**
  32454. * Attempts to invoke `func`, returning either the result or the caught error
  32455. * object. Any additional arguments are provided to `func` when it's invoked.
  32456. *
  32457. * @static
  32458. * @memberOf _
  32459. * @since 3.0.0
  32460. * @category Util
  32461. * @param {Function} func The function to attempt.
  32462. * @param {...*} [args] The arguments to invoke `func` with.
  32463. * @returns {*} Returns the `func` result or error object.
  32464. * @example
  32465. *
  32466. * // Avoid throwing errors for invalid selectors.
  32467. * var elements = _.attempt(function(selector) {
  32468. * return document.querySelectorAll(selector);
  32469. * }, '>_>');
  32470. *
  32471. * if (_.isError(elements)) {
  32472. * elements = [];
  32473. * }
  32474. */
  32475. var attempt = baseRest(function(func, args) {
  32476. try {
  32477. return apply(func, undefined, args);
  32478. } catch (e) {
  32479. return isError(e) ? e : new Error(e);
  32480. }
  32481. });
  32482. /**
  32483. * Binds methods of an object to the object itself, overwriting the existing
  32484. * method.
  32485. *
  32486. * **Note:** This method doesn't set the "length" property of bound functions.
  32487. *
  32488. * @static
  32489. * @since 0.1.0
  32490. * @memberOf _
  32491. * @category Util
  32492. * @param {Object} object The object to bind and assign the bound methods to.
  32493. * @param {...(string|string[])} methodNames The object method names to bind.
  32494. * @returns {Object} Returns `object`.
  32495. * @example
  32496. *
  32497. * var view = {
  32498. * 'label': 'docs',
  32499. * 'click': function() {
  32500. * console.log('clicked ' + this.label);
  32501. * }
  32502. * };
  32503. *
  32504. * _.bindAll(view, ['click']);
  32505. * jQuery(element).on('click', view.click);
  32506. * // => Logs 'clicked docs' when clicked.
  32507. */
  32508. var bindAll = flatRest(function(object, methodNames) {
  32509. arrayEach(methodNames, function(key) {
  32510. key = toKey(key);
  32511. baseAssignValue(object, key, bind(object[key], object));
  32512. });
  32513. return object;
  32514. });
  32515. /**
  32516. * Creates a function that iterates over `pairs` and invokes the corresponding
  32517. * function of the first predicate to return truthy. The predicate-function
  32518. * pairs are invoked with the `this` binding and arguments of the created
  32519. * function.
  32520. *
  32521. * @static
  32522. * @memberOf _
  32523. * @since 4.0.0
  32524. * @category Util
  32525. * @param {Array} pairs The predicate-function pairs.
  32526. * @returns {Function} Returns the new composite function.
  32527. * @example
  32528. *
  32529. * var func = _.cond([
  32530. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32531. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32532. * [_.stubTrue, _.constant('no match')]
  32533. * ]);
  32534. *
  32535. * func({ 'a': 1, 'b': 2 });
  32536. * // => 'matches A'
  32537. *
  32538. * func({ 'a': 0, 'b': 1 });
  32539. * // => 'matches B'
  32540. *
  32541. * func({ 'a': '1', 'b': '2' });
  32542. * // => 'no match'
  32543. */
  32544. function cond(pairs) {
  32545. var length = pairs == null ? 0 : pairs.length,
  32546. toIteratee = getIteratee();
  32547. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32548. if (typeof pair[1] != 'function') {
  32549. throw new TypeError(FUNC_ERROR_TEXT);
  32550. }
  32551. return [toIteratee(pair[0]), pair[1]];
  32552. });
  32553. return baseRest(function(args) {
  32554. var index = -1;
  32555. while (++index < length) {
  32556. var pair = pairs[index];
  32557. if (apply(pair[0], this, args)) {
  32558. return apply(pair[1], this, args);
  32559. }
  32560. }
  32561. });
  32562. }
  32563. /**
  32564. * Creates a function that invokes the predicate properties of `source` with
  32565. * the corresponding property values of a given object, returning `true` if
  32566. * all predicates return truthy, else `false`.
  32567. *
  32568. * **Note:** The created function is equivalent to `_.conformsTo` with
  32569. * `source` partially applied.
  32570. *
  32571. * @static
  32572. * @memberOf _
  32573. * @since 4.0.0
  32574. * @category Util
  32575. * @param {Object} source The object of property predicates to conform to.
  32576. * @returns {Function} Returns the new spec function.
  32577. * @example
  32578. *
  32579. * var objects = [
  32580. * { 'a': 2, 'b': 1 },
  32581. * { 'a': 1, 'b': 2 }
  32582. * ];
  32583. *
  32584. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32585. * // => [{ 'a': 1, 'b': 2 }]
  32586. */
  32587. function conforms(source) {
  32588. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32589. }
  32590. /**
  32591. * Creates a function that returns `value`.
  32592. *
  32593. * @static
  32594. * @memberOf _
  32595. * @since 2.4.0
  32596. * @category Util
  32597. * @param {*} value The value to return from the new function.
  32598. * @returns {Function} Returns the new constant function.
  32599. * @example
  32600. *
  32601. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32602. *
  32603. * console.log(objects);
  32604. * // => [{ 'a': 1 }, { 'a': 1 }]
  32605. *
  32606. * console.log(objects[0] === objects[1]);
  32607. * // => true
  32608. */
  32609. function constant(value) {
  32610. return function() {
  32611. return value;
  32612. };
  32613. }
  32614. /**
  32615. * Checks `value` to determine whether a default value should be returned in
  32616. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32617. * or `undefined`.
  32618. *
  32619. * @static
  32620. * @memberOf _
  32621. * @since 4.14.0
  32622. * @category Util
  32623. * @param {*} value The value to check.
  32624. * @param {*} defaultValue The default value.
  32625. * @returns {*} Returns the resolved value.
  32626. * @example
  32627. *
  32628. * _.defaultTo(1, 10);
  32629. * // => 1
  32630. *
  32631. * _.defaultTo(undefined, 10);
  32632. * // => 10
  32633. */
  32634. function defaultTo(value, defaultValue) {
  32635. return (value == null || value !== value) ? defaultValue : value;
  32636. }
  32637. /**
  32638. * Creates a function that returns the result of invoking the given functions
  32639. * with the `this` binding of the created function, where each successive
  32640. * invocation is supplied the return value of the previous.
  32641. *
  32642. * @static
  32643. * @memberOf _
  32644. * @since 3.0.0
  32645. * @category Util
  32646. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32647. * @returns {Function} Returns the new composite function.
  32648. * @see _.flowRight
  32649. * @example
  32650. *
  32651. * function square(n) {
  32652. * return n * n;
  32653. * }
  32654. *
  32655. * var addSquare = _.flow([_.add, square]);
  32656. * addSquare(1, 2);
  32657. * // => 9
  32658. */
  32659. var flow = createFlow();
  32660. /**
  32661. * This method is like `_.flow` except that it creates a function that
  32662. * invokes the given functions from right to left.
  32663. *
  32664. * @static
  32665. * @since 3.0.0
  32666. * @memberOf _
  32667. * @category Util
  32668. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32669. * @returns {Function} Returns the new composite function.
  32670. * @see _.flow
  32671. * @example
  32672. *
  32673. * function square(n) {
  32674. * return n * n;
  32675. * }
  32676. *
  32677. * var addSquare = _.flowRight([square, _.add]);
  32678. * addSquare(1, 2);
  32679. * // => 9
  32680. */
  32681. var flowRight = createFlow(true);
  32682. /**
  32683. * This method returns the first argument it receives.
  32684. *
  32685. * @static
  32686. * @since 0.1.0
  32687. * @memberOf _
  32688. * @category Util
  32689. * @param {*} value Any value.
  32690. * @returns {*} Returns `value`.
  32691. * @example
  32692. *
  32693. * var object = { 'a': 1 };
  32694. *
  32695. * console.log(_.identity(object) === object);
  32696. * // => true
  32697. */
  32698. function identity(value) {
  32699. return value;
  32700. }
  32701. /**
  32702. * Creates a function that invokes `func` with the arguments of the created
  32703. * function. If `func` is a property name, the created function returns the
  32704. * property value for a given element. If `func` is an array or object, the
  32705. * created function returns `true` for elements that contain the equivalent
  32706. * source properties, otherwise it returns `false`.
  32707. *
  32708. * @static
  32709. * @since 4.0.0
  32710. * @memberOf _
  32711. * @category Util
  32712. * @param {*} [func=_.identity] The value to convert to a callback.
  32713. * @returns {Function} Returns the callback.
  32714. * @example
  32715. *
  32716. * var users = [
  32717. * { 'user': 'barney', 'age': 36, 'active': true },
  32718. * { 'user': 'fred', 'age': 40, 'active': false }
  32719. * ];
  32720. *
  32721. * // The `_.matches` iteratee shorthand.
  32722. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32723. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32724. *
  32725. * // The `_.matchesProperty` iteratee shorthand.
  32726. * _.filter(users, _.iteratee(['user', 'fred']));
  32727. * // => [{ 'user': 'fred', 'age': 40 }]
  32728. *
  32729. * // The `_.property` iteratee shorthand.
  32730. * _.map(users, _.iteratee('user'));
  32731. * // => ['barney', 'fred']
  32732. *
  32733. * // Create custom iteratee shorthands.
  32734. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32735. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32736. * return func.test(string);
  32737. * };
  32738. * });
  32739. *
  32740. * _.filter(['abc', 'def'], /ef/);
  32741. * // => ['def']
  32742. */
  32743. function iteratee(func) {
  32744. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32745. }
  32746. /**
  32747. * Creates a function that performs a partial deep comparison between a given
  32748. * object and `source`, returning `true` if the given object has equivalent
  32749. * property values, else `false`.
  32750. *
  32751. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32752. * partially applied.
  32753. *
  32754. * Partial comparisons will match empty array and empty object `source`
  32755. * values against any array or object value, respectively. See `_.isEqual`
  32756. * for a list of supported value comparisons.
  32757. *
  32758. * @static
  32759. * @memberOf _
  32760. * @since 3.0.0
  32761. * @category Util
  32762. * @param {Object} source The object of property values to match.
  32763. * @returns {Function} Returns the new spec function.
  32764. * @example
  32765. *
  32766. * var objects = [
  32767. * { 'a': 1, 'b': 2, 'c': 3 },
  32768. * { 'a': 4, 'b': 5, 'c': 6 }
  32769. * ];
  32770. *
  32771. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32772. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32773. */
  32774. function matches(source) {
  32775. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32776. }
  32777. /**
  32778. * Creates a function that performs a partial deep comparison between the
  32779. * value at `path` of a given object to `srcValue`, returning `true` if the
  32780. * object value is equivalent, else `false`.
  32781. *
  32782. * **Note:** Partial comparisons will match empty array and empty object
  32783. * `srcValue` values against any array or object value, respectively. See
  32784. * `_.isEqual` for a list of supported value comparisons.
  32785. *
  32786. * @static
  32787. * @memberOf _
  32788. * @since 3.2.0
  32789. * @category Util
  32790. * @param {Array|string} path The path of the property to get.
  32791. * @param {*} srcValue The value to match.
  32792. * @returns {Function} Returns the new spec function.
  32793. * @example
  32794. *
  32795. * var objects = [
  32796. * { 'a': 1, 'b': 2, 'c': 3 },
  32797. * { 'a': 4, 'b': 5, 'c': 6 }
  32798. * ];
  32799. *
  32800. * _.find(objects, _.matchesProperty('a', 4));
  32801. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32802. */
  32803. function matchesProperty(path, srcValue) {
  32804. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32805. }
  32806. /**
  32807. * Creates a function that invokes the method at `path` of a given object.
  32808. * Any additional arguments are provided to the invoked method.
  32809. *
  32810. * @static
  32811. * @memberOf _
  32812. * @since 3.7.0
  32813. * @category Util
  32814. * @param {Array|string} path The path of the method to invoke.
  32815. * @param {...*} [args] The arguments to invoke the method with.
  32816. * @returns {Function} Returns the new invoker function.
  32817. * @example
  32818. *
  32819. * var objects = [
  32820. * { 'a': { 'b': _.constant(2) } },
  32821. * { 'a': { 'b': _.constant(1) } }
  32822. * ];
  32823. *
  32824. * _.map(objects, _.method('a.b'));
  32825. * // => [2, 1]
  32826. *
  32827. * _.map(objects, _.method(['a', 'b']));
  32828. * // => [2, 1]
  32829. */
  32830. var method = baseRest(function(path, args) {
  32831. return function(object) {
  32832. return baseInvoke(object, path, args);
  32833. };
  32834. });
  32835. /**
  32836. * The opposite of `_.method`; this method creates a function that invokes
  32837. * the method at a given path of `object`. Any additional arguments are
  32838. * provided to the invoked method.
  32839. *
  32840. * @static
  32841. * @memberOf _
  32842. * @since 3.7.0
  32843. * @category Util
  32844. * @param {Object} object The object to query.
  32845. * @param {...*} [args] The arguments to invoke the method with.
  32846. * @returns {Function} Returns the new invoker function.
  32847. * @example
  32848. *
  32849. * var array = _.times(3, _.constant),
  32850. * object = { 'a': array, 'b': array, 'c': array };
  32851. *
  32852. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32853. * // => [2, 0]
  32854. *
  32855. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32856. * // => [2, 0]
  32857. */
  32858. var methodOf = baseRest(function(object, args) {
  32859. return function(path) {
  32860. return baseInvoke(object, path, args);
  32861. };
  32862. });
  32863. /**
  32864. * Adds all own enumerable string keyed function properties of a source
  32865. * object to the destination object. If `object` is a function, then methods
  32866. * are added to its prototype as well.
  32867. *
  32868. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32869. * avoid conflicts caused by modifying the original.
  32870. *
  32871. * @static
  32872. * @since 0.1.0
  32873. * @memberOf _
  32874. * @category Util
  32875. * @param {Function|Object} [object=lodash] The destination object.
  32876. * @param {Object} source The object of functions to add.
  32877. * @param {Object} [options={}] The options object.
  32878. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32879. * @returns {Function|Object} Returns `object`.
  32880. * @example
  32881. *
  32882. * function vowels(string) {
  32883. * return _.filter(string, function(v) {
  32884. * return /[aeiou]/i.test(v);
  32885. * });
  32886. * }
  32887. *
  32888. * _.mixin({ 'vowels': vowels });
  32889. * _.vowels('fred');
  32890. * // => ['e']
  32891. *
  32892. * _('fred').vowels().value();
  32893. * // => ['e']
  32894. *
  32895. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32896. * _('fred').vowels();
  32897. * // => ['e']
  32898. */
  32899. function mixin(object, source, options) {
  32900. var props = keys(source),
  32901. methodNames = baseFunctions(source, props);
  32902. if (options == null &&
  32903. !(isObject(source) && (methodNames.length || !props.length))) {
  32904. options = source;
  32905. source = object;
  32906. object = this;
  32907. methodNames = baseFunctions(source, keys(source));
  32908. }
  32909. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  32910. isFunc = isFunction(object);
  32911. arrayEach(methodNames, function(methodName) {
  32912. var func = source[methodName];
  32913. object[methodName] = func;
  32914. if (isFunc) {
  32915. object.prototype[methodName] = function() {
  32916. var chainAll = this.__chain__;
  32917. if (chain || chainAll) {
  32918. var result = object(this.__wrapped__),
  32919. actions = result.__actions__ = copyArray(this.__actions__);
  32920. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  32921. result.__chain__ = chainAll;
  32922. return result;
  32923. }
  32924. return func.apply(object, arrayPush([this.value()], arguments));
  32925. };
  32926. }
  32927. });
  32928. return object;
  32929. }
  32930. /**
  32931. * Reverts the `_` variable to its previous value and returns a reference to
  32932. * the `lodash` function.
  32933. *
  32934. * @static
  32935. * @since 0.1.0
  32936. * @memberOf _
  32937. * @category Util
  32938. * @returns {Function} Returns the `lodash` function.
  32939. * @example
  32940. *
  32941. * var lodash = _.noConflict();
  32942. */
  32943. function noConflict() {
  32944. if (root._ === this) {
  32945. root._ = oldDash;
  32946. }
  32947. return this;
  32948. }
  32949. /**
  32950. * This method returns `undefined`.
  32951. *
  32952. * @static
  32953. * @memberOf _
  32954. * @since 2.3.0
  32955. * @category Util
  32956. * @example
  32957. *
  32958. * _.times(2, _.noop);
  32959. * // => [undefined, undefined]
  32960. */
  32961. function noop() {
  32962. // No operation performed.
  32963. }
  32964. /**
  32965. * Creates a function that gets the argument at index `n`. If `n` is negative,
  32966. * the nth argument from the end is returned.
  32967. *
  32968. * @static
  32969. * @memberOf _
  32970. * @since 4.0.0
  32971. * @category Util
  32972. * @param {number} [n=0] The index of the argument to return.
  32973. * @returns {Function} Returns the new pass-thru function.
  32974. * @example
  32975. *
  32976. * var func = _.nthArg(1);
  32977. * func('a', 'b', 'c', 'd');
  32978. * // => 'b'
  32979. *
  32980. * var func = _.nthArg(-2);
  32981. * func('a', 'b', 'c', 'd');
  32982. * // => 'c'
  32983. */
  32984. function nthArg(n) {
  32985. n = toInteger(n);
  32986. return baseRest(function(args) {
  32987. return baseNth(args, n);
  32988. });
  32989. }
  32990. /**
  32991. * Creates a function that invokes `iteratees` with the arguments it receives
  32992. * and returns their results.
  32993. *
  32994. * @static
  32995. * @memberOf _
  32996. * @since 4.0.0
  32997. * @category Util
  32998. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  32999. * The iteratees to invoke.
  33000. * @returns {Function} Returns the new function.
  33001. * @example
  33002. *
  33003. * var func = _.over([Math.max, Math.min]);
  33004. *
  33005. * func(1, 2, 3, 4);
  33006. * // => [4, 1]
  33007. */
  33008. var over = createOver(arrayMap);
  33009. /**
  33010. * Creates a function that checks if **all** of the `predicates` return
  33011. * truthy when invoked with the arguments it receives.
  33012. *
  33013. * @static
  33014. * @memberOf _
  33015. * @since 4.0.0
  33016. * @category Util
  33017. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33018. * The predicates to check.
  33019. * @returns {Function} Returns the new function.
  33020. * @example
  33021. *
  33022. * var func = _.overEvery([Boolean, isFinite]);
  33023. *
  33024. * func('1');
  33025. * // => true
  33026. *
  33027. * func(null);
  33028. * // => false
  33029. *
  33030. * func(NaN);
  33031. * // => false
  33032. */
  33033. var overEvery = createOver(arrayEvery);
  33034. /**
  33035. * Creates a function that checks if **any** of the `predicates` return
  33036. * truthy when invoked with the arguments it receives.
  33037. *
  33038. * @static
  33039. * @memberOf _
  33040. * @since 4.0.0
  33041. * @category Util
  33042. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33043. * The predicates to check.
  33044. * @returns {Function} Returns the new function.
  33045. * @example
  33046. *
  33047. * var func = _.overSome([Boolean, isFinite]);
  33048. *
  33049. * func('1');
  33050. * // => true
  33051. *
  33052. * func(null);
  33053. * // => true
  33054. *
  33055. * func(NaN);
  33056. * // => false
  33057. */
  33058. var overSome = createOver(arraySome);
  33059. /**
  33060. * Creates a function that returns the value at `path` of a given object.
  33061. *
  33062. * @static
  33063. * @memberOf _
  33064. * @since 2.4.0
  33065. * @category Util
  33066. * @param {Array|string} path The path of the property to get.
  33067. * @returns {Function} Returns the new accessor function.
  33068. * @example
  33069. *
  33070. * var objects = [
  33071. * { 'a': { 'b': 2 } },
  33072. * { 'a': { 'b': 1 } }
  33073. * ];
  33074. *
  33075. * _.map(objects, _.property('a.b'));
  33076. * // => [2, 1]
  33077. *
  33078. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33079. * // => [1, 2]
  33080. */
  33081. function property(path) {
  33082. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33083. }
  33084. /**
  33085. * The opposite of `_.property`; this method creates a function that returns
  33086. * the value at a given path of `object`.
  33087. *
  33088. * @static
  33089. * @memberOf _
  33090. * @since 3.0.0
  33091. * @category Util
  33092. * @param {Object} object The object to query.
  33093. * @returns {Function} Returns the new accessor function.
  33094. * @example
  33095. *
  33096. * var array = [0, 1, 2],
  33097. * object = { 'a': array, 'b': array, 'c': array };
  33098. *
  33099. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33100. * // => [2, 0]
  33101. *
  33102. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33103. * // => [2, 0]
  33104. */
  33105. function propertyOf(object) {
  33106. return function(path) {
  33107. return object == null ? undefined : baseGet(object, path);
  33108. };
  33109. }
  33110. /**
  33111. * Creates an array of numbers (positive and/or negative) progressing from
  33112. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33113. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33114. * it's set to `start` with `start` then set to `0`.
  33115. *
  33116. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33117. * floating-point values which can produce unexpected results.
  33118. *
  33119. * @static
  33120. * @since 0.1.0
  33121. * @memberOf _
  33122. * @category Util
  33123. * @param {number} [start=0] The start of the range.
  33124. * @param {number} end The end of the range.
  33125. * @param {number} [step=1] The value to increment or decrement by.
  33126. * @returns {Array} Returns the range of numbers.
  33127. * @see _.inRange, _.rangeRight
  33128. * @example
  33129. *
  33130. * _.range(4);
  33131. * // => [0, 1, 2, 3]
  33132. *
  33133. * _.range(-4);
  33134. * // => [0, -1, -2, -3]
  33135. *
  33136. * _.range(1, 5);
  33137. * // => [1, 2, 3, 4]
  33138. *
  33139. * _.range(0, 20, 5);
  33140. * // => [0, 5, 10, 15]
  33141. *
  33142. * _.range(0, -4, -1);
  33143. * // => [0, -1, -2, -3]
  33144. *
  33145. * _.range(1, 4, 0);
  33146. * // => [1, 1, 1]
  33147. *
  33148. * _.range(0);
  33149. * // => []
  33150. */
  33151. var range = createRange();
  33152. /**
  33153. * This method is like `_.range` except that it populates values in
  33154. * descending order.
  33155. *
  33156. * @static
  33157. * @memberOf _
  33158. * @since 4.0.0
  33159. * @category Util
  33160. * @param {number} [start=0] The start of the range.
  33161. * @param {number} end The end of the range.
  33162. * @param {number} [step=1] The value to increment or decrement by.
  33163. * @returns {Array} Returns the range of numbers.
  33164. * @see _.inRange, _.range
  33165. * @example
  33166. *
  33167. * _.rangeRight(4);
  33168. * // => [3, 2, 1, 0]
  33169. *
  33170. * _.rangeRight(-4);
  33171. * // => [-3, -2, -1, 0]
  33172. *
  33173. * _.rangeRight(1, 5);
  33174. * // => [4, 3, 2, 1]
  33175. *
  33176. * _.rangeRight(0, 20, 5);
  33177. * // => [15, 10, 5, 0]
  33178. *
  33179. * _.rangeRight(0, -4, -1);
  33180. * // => [-3, -2, -1, 0]
  33181. *
  33182. * _.rangeRight(1, 4, 0);
  33183. * // => [1, 1, 1]
  33184. *
  33185. * _.rangeRight(0);
  33186. * // => []
  33187. */
  33188. var rangeRight = createRange(true);
  33189. /**
  33190. * This method returns a new empty array.
  33191. *
  33192. * @static
  33193. * @memberOf _
  33194. * @since 4.13.0
  33195. * @category Util
  33196. * @returns {Array} Returns the new empty array.
  33197. * @example
  33198. *
  33199. * var arrays = _.times(2, _.stubArray);
  33200. *
  33201. * console.log(arrays);
  33202. * // => [[], []]
  33203. *
  33204. * console.log(arrays[0] === arrays[1]);
  33205. * // => false
  33206. */
  33207. function stubArray() {
  33208. return [];
  33209. }
  33210. /**
  33211. * This method returns `false`.
  33212. *
  33213. * @static
  33214. * @memberOf _
  33215. * @since 4.13.0
  33216. * @category Util
  33217. * @returns {boolean} Returns `false`.
  33218. * @example
  33219. *
  33220. * _.times(2, _.stubFalse);
  33221. * // => [false, false]
  33222. */
  33223. function stubFalse() {
  33224. return false;
  33225. }
  33226. /**
  33227. * This method returns a new empty object.
  33228. *
  33229. * @static
  33230. * @memberOf _
  33231. * @since 4.13.0
  33232. * @category Util
  33233. * @returns {Object} Returns the new empty object.
  33234. * @example
  33235. *
  33236. * var objects = _.times(2, _.stubObject);
  33237. *
  33238. * console.log(objects);
  33239. * // => [{}, {}]
  33240. *
  33241. * console.log(objects[0] === objects[1]);
  33242. * // => false
  33243. */
  33244. function stubObject() {
  33245. return {};
  33246. }
  33247. /**
  33248. * This method returns an empty string.
  33249. *
  33250. * @static
  33251. * @memberOf _
  33252. * @since 4.13.0
  33253. * @category Util
  33254. * @returns {string} Returns the empty string.
  33255. * @example
  33256. *
  33257. * _.times(2, _.stubString);
  33258. * // => ['', '']
  33259. */
  33260. function stubString() {
  33261. return '';
  33262. }
  33263. /**
  33264. * This method returns `true`.
  33265. *
  33266. * @static
  33267. * @memberOf _
  33268. * @since 4.13.0
  33269. * @category Util
  33270. * @returns {boolean} Returns `true`.
  33271. * @example
  33272. *
  33273. * _.times(2, _.stubTrue);
  33274. * // => [true, true]
  33275. */
  33276. function stubTrue() {
  33277. return true;
  33278. }
  33279. /**
  33280. * Invokes the iteratee `n` times, returning an array of the results of
  33281. * each invocation. The iteratee is invoked with one argument; (index).
  33282. *
  33283. * @static
  33284. * @since 0.1.0
  33285. * @memberOf _
  33286. * @category Util
  33287. * @param {number} n The number of times to invoke `iteratee`.
  33288. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33289. * @returns {Array} Returns the array of results.
  33290. * @example
  33291. *
  33292. * _.times(3, String);
  33293. * // => ['0', '1', '2']
  33294. *
  33295. * _.times(4, _.constant(0));
  33296. * // => [0, 0, 0, 0]
  33297. */
  33298. function times(n, iteratee) {
  33299. n = toInteger(n);
  33300. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33301. return [];
  33302. }
  33303. var index = MAX_ARRAY_LENGTH,
  33304. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33305. iteratee = getIteratee(iteratee);
  33306. n -= MAX_ARRAY_LENGTH;
  33307. var result = baseTimes(length, iteratee);
  33308. while (++index < n) {
  33309. iteratee(index);
  33310. }
  33311. return result;
  33312. }
  33313. /**
  33314. * Converts `value` to a property path array.
  33315. *
  33316. * @static
  33317. * @memberOf _
  33318. * @since 4.0.0
  33319. * @category Util
  33320. * @param {*} value The value to convert.
  33321. * @returns {Array} Returns the new property path array.
  33322. * @example
  33323. *
  33324. * _.toPath('a.b.c');
  33325. * // => ['a', 'b', 'c']
  33326. *
  33327. * _.toPath('a[0].b.c');
  33328. * // => ['a', '0', 'b', 'c']
  33329. */
  33330. function toPath(value) {
  33331. if (isArray(value)) {
  33332. return arrayMap(value, toKey);
  33333. }
  33334. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33335. }
  33336. /**
  33337. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33338. *
  33339. * @static
  33340. * @since 0.1.0
  33341. * @memberOf _
  33342. * @category Util
  33343. * @param {string} [prefix=''] The value to prefix the ID with.
  33344. * @returns {string} Returns the unique ID.
  33345. * @example
  33346. *
  33347. * _.uniqueId('contact_');
  33348. * // => 'contact_104'
  33349. *
  33350. * _.uniqueId();
  33351. * // => '105'
  33352. */
  33353. function uniqueId(prefix) {
  33354. var id = ++idCounter;
  33355. return toString(prefix) + id;
  33356. }
  33357. /*------------------------------------------------------------------------*/
  33358. /**
  33359. * Adds two numbers.
  33360. *
  33361. * @static
  33362. * @memberOf _
  33363. * @since 3.4.0
  33364. * @category Math
  33365. * @param {number} augend The first number in an addition.
  33366. * @param {number} addend The second number in an addition.
  33367. * @returns {number} Returns the total.
  33368. * @example
  33369. *
  33370. * _.add(6, 4);
  33371. * // => 10
  33372. */
  33373. var add = createMathOperation(function(augend, addend) {
  33374. return augend + addend;
  33375. }, 0);
  33376. /**
  33377. * Computes `number` rounded up to `precision`.
  33378. *
  33379. * @static
  33380. * @memberOf _
  33381. * @since 3.10.0
  33382. * @category Math
  33383. * @param {number} number The number to round up.
  33384. * @param {number} [precision=0] The precision to round up to.
  33385. * @returns {number} Returns the rounded up number.
  33386. * @example
  33387. *
  33388. * _.ceil(4.006);
  33389. * // => 5
  33390. *
  33391. * _.ceil(6.004, 2);
  33392. * // => 6.01
  33393. *
  33394. * _.ceil(6040, -2);
  33395. * // => 6100
  33396. */
  33397. var ceil = createRound('ceil');
  33398. /**
  33399. * Divide two numbers.
  33400. *
  33401. * @static
  33402. * @memberOf _
  33403. * @since 4.7.0
  33404. * @category Math
  33405. * @param {number} dividend The first number in a division.
  33406. * @param {number} divisor The second number in a division.
  33407. * @returns {number} Returns the quotient.
  33408. * @example
  33409. *
  33410. * _.divide(6, 4);
  33411. * // => 1.5
  33412. */
  33413. var divide = createMathOperation(function(dividend, divisor) {
  33414. return dividend / divisor;
  33415. }, 1);
  33416. /**
  33417. * Computes `number` rounded down to `precision`.
  33418. *
  33419. * @static
  33420. * @memberOf _
  33421. * @since 3.10.0
  33422. * @category Math
  33423. * @param {number} number The number to round down.
  33424. * @param {number} [precision=0] The precision to round down to.
  33425. * @returns {number} Returns the rounded down number.
  33426. * @example
  33427. *
  33428. * _.floor(4.006);
  33429. * // => 4
  33430. *
  33431. * _.floor(0.046, 2);
  33432. * // => 0.04
  33433. *
  33434. * _.floor(4060, -2);
  33435. * // => 4000
  33436. */
  33437. var floor = createRound('floor');
  33438. /**
  33439. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33440. * `undefined` is returned.
  33441. *
  33442. * @static
  33443. * @since 0.1.0
  33444. * @memberOf _
  33445. * @category Math
  33446. * @param {Array} array The array to iterate over.
  33447. * @returns {*} Returns the maximum value.
  33448. * @example
  33449. *
  33450. * _.max([4, 2, 8, 6]);
  33451. * // => 8
  33452. *
  33453. * _.max([]);
  33454. * // => undefined
  33455. */
  33456. function max(array) {
  33457. return (array && array.length)
  33458. ? baseExtremum(array, identity, baseGt)
  33459. : undefined;
  33460. }
  33461. /**
  33462. * This method is like `_.max` except that it accepts `iteratee` which is
  33463. * invoked for each element in `array` to generate the criterion by which
  33464. * the value is ranked. The iteratee is invoked with one argument: (value).
  33465. *
  33466. * @static
  33467. * @memberOf _
  33468. * @since 4.0.0
  33469. * @category Math
  33470. * @param {Array} array The array to iterate over.
  33471. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33472. * @returns {*} Returns the maximum value.
  33473. * @example
  33474. *
  33475. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33476. *
  33477. * _.maxBy(objects, function(o) { return o.n; });
  33478. * // => { 'n': 2 }
  33479. *
  33480. * // The `_.property` iteratee shorthand.
  33481. * _.maxBy(objects, 'n');
  33482. * // => { 'n': 2 }
  33483. */
  33484. function maxBy(array, iteratee) {
  33485. return (array && array.length)
  33486. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33487. : undefined;
  33488. }
  33489. /**
  33490. * Computes the mean of the values in `array`.
  33491. *
  33492. * @static
  33493. * @memberOf _
  33494. * @since 4.0.0
  33495. * @category Math
  33496. * @param {Array} array The array to iterate over.
  33497. * @returns {number} Returns the mean.
  33498. * @example
  33499. *
  33500. * _.mean([4, 2, 8, 6]);
  33501. * // => 5
  33502. */
  33503. function mean(array) {
  33504. return baseMean(array, identity);
  33505. }
  33506. /**
  33507. * This method is like `_.mean` except that it accepts `iteratee` which is
  33508. * invoked for each element in `array` to generate the value to be averaged.
  33509. * The iteratee is invoked with one argument: (value).
  33510. *
  33511. * @static
  33512. * @memberOf _
  33513. * @since 4.7.0
  33514. * @category Math
  33515. * @param {Array} array The array to iterate over.
  33516. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33517. * @returns {number} Returns the mean.
  33518. * @example
  33519. *
  33520. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33521. *
  33522. * _.meanBy(objects, function(o) { return o.n; });
  33523. * // => 5
  33524. *
  33525. * // The `_.property` iteratee shorthand.
  33526. * _.meanBy(objects, 'n');
  33527. * // => 5
  33528. */
  33529. function meanBy(array, iteratee) {
  33530. return baseMean(array, getIteratee(iteratee, 2));
  33531. }
  33532. /**
  33533. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33534. * `undefined` is returned.
  33535. *
  33536. * @static
  33537. * @since 0.1.0
  33538. * @memberOf _
  33539. * @category Math
  33540. * @param {Array} array The array to iterate over.
  33541. * @returns {*} Returns the minimum value.
  33542. * @example
  33543. *
  33544. * _.min([4, 2, 8, 6]);
  33545. * // => 2
  33546. *
  33547. * _.min([]);
  33548. * // => undefined
  33549. */
  33550. function min(array) {
  33551. return (array && array.length)
  33552. ? baseExtremum(array, identity, baseLt)
  33553. : undefined;
  33554. }
  33555. /**
  33556. * This method is like `_.min` except that it accepts `iteratee` which is
  33557. * invoked for each element in `array` to generate the criterion by which
  33558. * the value is ranked. The iteratee is invoked with one argument: (value).
  33559. *
  33560. * @static
  33561. * @memberOf _
  33562. * @since 4.0.0
  33563. * @category Math
  33564. * @param {Array} array The array to iterate over.
  33565. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33566. * @returns {*} Returns the minimum value.
  33567. * @example
  33568. *
  33569. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33570. *
  33571. * _.minBy(objects, function(o) { return o.n; });
  33572. * // => { 'n': 1 }
  33573. *
  33574. * // The `_.property` iteratee shorthand.
  33575. * _.minBy(objects, 'n');
  33576. * // => { 'n': 1 }
  33577. */
  33578. function minBy(array, iteratee) {
  33579. return (array && array.length)
  33580. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33581. : undefined;
  33582. }
  33583. /**
  33584. * Multiply two numbers.
  33585. *
  33586. * @static
  33587. * @memberOf _
  33588. * @since 4.7.0
  33589. * @category Math
  33590. * @param {number} multiplier The first number in a multiplication.
  33591. * @param {number} multiplicand The second number in a multiplication.
  33592. * @returns {number} Returns the product.
  33593. * @example
  33594. *
  33595. * _.multiply(6, 4);
  33596. * // => 24
  33597. */
  33598. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33599. return multiplier * multiplicand;
  33600. }, 1);
  33601. /**
  33602. * Computes `number` rounded to `precision`.
  33603. *
  33604. * @static
  33605. * @memberOf _
  33606. * @since 3.10.0
  33607. * @category Math
  33608. * @param {number} number The number to round.
  33609. * @param {number} [precision=0] The precision to round to.
  33610. * @returns {number} Returns the rounded number.
  33611. * @example
  33612. *
  33613. * _.round(4.006);
  33614. * // => 4
  33615. *
  33616. * _.round(4.006, 2);
  33617. * // => 4.01
  33618. *
  33619. * _.round(4060, -2);
  33620. * // => 4100
  33621. */
  33622. var round = createRound('round');
  33623. /**
  33624. * Subtract two numbers.
  33625. *
  33626. * @static
  33627. * @memberOf _
  33628. * @since 4.0.0
  33629. * @category Math
  33630. * @param {number} minuend The first number in a subtraction.
  33631. * @param {number} subtrahend The second number in a subtraction.
  33632. * @returns {number} Returns the difference.
  33633. * @example
  33634. *
  33635. * _.subtract(6, 4);
  33636. * // => 2
  33637. */
  33638. var subtract = createMathOperation(function(minuend, subtrahend) {
  33639. return minuend - subtrahend;
  33640. }, 0);
  33641. /**
  33642. * Computes the sum of the values in `array`.
  33643. *
  33644. * @static
  33645. * @memberOf _
  33646. * @since 3.4.0
  33647. * @category Math
  33648. * @param {Array} array The array to iterate over.
  33649. * @returns {number} Returns the sum.
  33650. * @example
  33651. *
  33652. * _.sum([4, 2, 8, 6]);
  33653. * // => 20
  33654. */
  33655. function sum(array) {
  33656. return (array && array.length)
  33657. ? baseSum(array, identity)
  33658. : 0;
  33659. }
  33660. /**
  33661. * This method is like `_.sum` except that it accepts `iteratee` which is
  33662. * invoked for each element in `array` to generate the value to be summed.
  33663. * The iteratee is invoked with one argument: (value).
  33664. *
  33665. * @static
  33666. * @memberOf _
  33667. * @since 4.0.0
  33668. * @category Math
  33669. * @param {Array} array The array to iterate over.
  33670. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33671. * @returns {number} Returns the sum.
  33672. * @example
  33673. *
  33674. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33675. *
  33676. * _.sumBy(objects, function(o) { return o.n; });
  33677. * // => 20
  33678. *
  33679. * // The `_.property` iteratee shorthand.
  33680. * _.sumBy(objects, 'n');
  33681. * // => 20
  33682. */
  33683. function sumBy(array, iteratee) {
  33684. return (array && array.length)
  33685. ? baseSum(array, getIteratee(iteratee, 2))
  33686. : 0;
  33687. }
  33688. /*------------------------------------------------------------------------*/
  33689. // Add methods that return wrapped values in chain sequences.
  33690. lodash.after = after;
  33691. lodash.ary = ary;
  33692. lodash.assign = assign;
  33693. lodash.assignIn = assignIn;
  33694. lodash.assignInWith = assignInWith;
  33695. lodash.assignWith = assignWith;
  33696. lodash.at = at;
  33697. lodash.before = before;
  33698. lodash.bind = bind;
  33699. lodash.bindAll = bindAll;
  33700. lodash.bindKey = bindKey;
  33701. lodash.castArray = castArray;
  33702. lodash.chain = chain;
  33703. lodash.chunk = chunk;
  33704. lodash.compact = compact;
  33705. lodash.concat = concat;
  33706. lodash.cond = cond;
  33707. lodash.conforms = conforms;
  33708. lodash.constant = constant;
  33709. lodash.countBy = countBy;
  33710. lodash.create = create;
  33711. lodash.curry = curry;
  33712. lodash.curryRight = curryRight;
  33713. lodash.debounce = debounce;
  33714. lodash.defaults = defaults;
  33715. lodash.defaultsDeep = defaultsDeep;
  33716. lodash.defer = defer;
  33717. lodash.delay = delay;
  33718. lodash.difference = difference;
  33719. lodash.differenceBy = differenceBy;
  33720. lodash.differenceWith = differenceWith;
  33721. lodash.drop = drop;
  33722. lodash.dropRight = dropRight;
  33723. lodash.dropRightWhile = dropRightWhile;
  33724. lodash.dropWhile = dropWhile;
  33725. lodash.fill = fill;
  33726. lodash.filter = filter;
  33727. lodash.flatMap = flatMap;
  33728. lodash.flatMapDeep = flatMapDeep;
  33729. lodash.flatMapDepth = flatMapDepth;
  33730. lodash.flatten = flatten;
  33731. lodash.flattenDeep = flattenDeep;
  33732. lodash.flattenDepth = flattenDepth;
  33733. lodash.flip = flip;
  33734. lodash.flow = flow;
  33735. lodash.flowRight = flowRight;
  33736. lodash.fromPairs = fromPairs;
  33737. lodash.functions = functions;
  33738. lodash.functionsIn = functionsIn;
  33739. lodash.groupBy = groupBy;
  33740. lodash.initial = initial;
  33741. lodash.intersection = intersection;
  33742. lodash.intersectionBy = intersectionBy;
  33743. lodash.intersectionWith = intersectionWith;
  33744. lodash.invert = invert;
  33745. lodash.invertBy = invertBy;
  33746. lodash.invokeMap = invokeMap;
  33747. lodash.iteratee = iteratee;
  33748. lodash.keyBy = keyBy;
  33749. lodash.keys = keys;
  33750. lodash.keysIn = keysIn;
  33751. lodash.map = map;
  33752. lodash.mapKeys = mapKeys;
  33753. lodash.mapValues = mapValues;
  33754. lodash.matches = matches;
  33755. lodash.matchesProperty = matchesProperty;
  33756. lodash.memoize = memoize;
  33757. lodash.merge = merge;
  33758. lodash.mergeWith = mergeWith;
  33759. lodash.method = method;
  33760. lodash.methodOf = methodOf;
  33761. lodash.mixin = mixin;
  33762. lodash.negate = negate;
  33763. lodash.nthArg = nthArg;
  33764. lodash.omit = omit;
  33765. lodash.omitBy = omitBy;
  33766. lodash.once = once;
  33767. lodash.orderBy = orderBy;
  33768. lodash.over = over;
  33769. lodash.overArgs = overArgs;
  33770. lodash.overEvery = overEvery;
  33771. lodash.overSome = overSome;
  33772. lodash.partial = partial;
  33773. lodash.partialRight = partialRight;
  33774. lodash.partition = partition;
  33775. lodash.pick = pick;
  33776. lodash.pickBy = pickBy;
  33777. lodash.property = property;
  33778. lodash.propertyOf = propertyOf;
  33779. lodash.pull = pull;
  33780. lodash.pullAll = pullAll;
  33781. lodash.pullAllBy = pullAllBy;
  33782. lodash.pullAllWith = pullAllWith;
  33783. lodash.pullAt = pullAt;
  33784. lodash.range = range;
  33785. lodash.rangeRight = rangeRight;
  33786. lodash.rearg = rearg;
  33787. lodash.reject = reject;
  33788. lodash.remove = remove;
  33789. lodash.rest = rest;
  33790. lodash.reverse = reverse;
  33791. lodash.sampleSize = sampleSize;
  33792. lodash.set = set;
  33793. lodash.setWith = setWith;
  33794. lodash.shuffle = shuffle;
  33795. lodash.slice = slice;
  33796. lodash.sortBy = sortBy;
  33797. lodash.sortedUniq = sortedUniq;
  33798. lodash.sortedUniqBy = sortedUniqBy;
  33799. lodash.split = split;
  33800. lodash.spread = spread;
  33801. lodash.tail = tail;
  33802. lodash.take = take;
  33803. lodash.takeRight = takeRight;
  33804. lodash.takeRightWhile = takeRightWhile;
  33805. lodash.takeWhile = takeWhile;
  33806. lodash.tap = tap;
  33807. lodash.throttle = throttle;
  33808. lodash.thru = thru;
  33809. lodash.toArray = toArray;
  33810. lodash.toPairs = toPairs;
  33811. lodash.toPairsIn = toPairsIn;
  33812. lodash.toPath = toPath;
  33813. lodash.toPlainObject = toPlainObject;
  33814. lodash.transform = transform;
  33815. lodash.unary = unary;
  33816. lodash.union = union;
  33817. lodash.unionBy = unionBy;
  33818. lodash.unionWith = unionWith;
  33819. lodash.uniq = uniq;
  33820. lodash.uniqBy = uniqBy;
  33821. lodash.uniqWith = uniqWith;
  33822. lodash.unset = unset;
  33823. lodash.unzip = unzip;
  33824. lodash.unzipWith = unzipWith;
  33825. lodash.update = update;
  33826. lodash.updateWith = updateWith;
  33827. lodash.values = values;
  33828. lodash.valuesIn = valuesIn;
  33829. lodash.without = without;
  33830. lodash.words = words;
  33831. lodash.wrap = wrap;
  33832. lodash.xor = xor;
  33833. lodash.xorBy = xorBy;
  33834. lodash.xorWith = xorWith;
  33835. lodash.zip = zip;
  33836. lodash.zipObject = zipObject;
  33837. lodash.zipObjectDeep = zipObjectDeep;
  33838. lodash.zipWith = zipWith;
  33839. // Add aliases.
  33840. lodash.entries = toPairs;
  33841. lodash.entriesIn = toPairsIn;
  33842. lodash.extend = assignIn;
  33843. lodash.extendWith = assignInWith;
  33844. // Add methods to `lodash.prototype`.
  33845. mixin(lodash, lodash);
  33846. /*------------------------------------------------------------------------*/
  33847. // Add methods that return unwrapped values in chain sequences.
  33848. lodash.add = add;
  33849. lodash.attempt = attempt;
  33850. lodash.camelCase = camelCase;
  33851. lodash.capitalize = capitalize;
  33852. lodash.ceil = ceil;
  33853. lodash.clamp = clamp;
  33854. lodash.clone = clone;
  33855. lodash.cloneDeep = cloneDeep;
  33856. lodash.cloneDeepWith = cloneDeepWith;
  33857. lodash.cloneWith = cloneWith;
  33858. lodash.conformsTo = conformsTo;
  33859. lodash.deburr = deburr;
  33860. lodash.defaultTo = defaultTo;
  33861. lodash.divide = divide;
  33862. lodash.endsWith = endsWith;
  33863. lodash.eq = eq;
  33864. lodash.escape = escape;
  33865. lodash.escapeRegExp = escapeRegExp;
  33866. lodash.every = every;
  33867. lodash.find = find;
  33868. lodash.findIndex = findIndex;
  33869. lodash.findKey = findKey;
  33870. lodash.findLast = findLast;
  33871. lodash.findLastIndex = findLastIndex;
  33872. lodash.findLastKey = findLastKey;
  33873. lodash.floor = floor;
  33874. lodash.forEach = forEach;
  33875. lodash.forEachRight = forEachRight;
  33876. lodash.forIn = forIn;
  33877. lodash.forInRight = forInRight;
  33878. lodash.forOwn = forOwn;
  33879. lodash.forOwnRight = forOwnRight;
  33880. lodash.get = get;
  33881. lodash.gt = gt;
  33882. lodash.gte = gte;
  33883. lodash.has = has;
  33884. lodash.hasIn = hasIn;
  33885. lodash.head = head;
  33886. lodash.identity = identity;
  33887. lodash.includes = includes;
  33888. lodash.indexOf = indexOf;
  33889. lodash.inRange = inRange;
  33890. lodash.invoke = invoke;
  33891. lodash.isArguments = isArguments;
  33892. lodash.isArray = isArray;
  33893. lodash.isArrayBuffer = isArrayBuffer;
  33894. lodash.isArrayLike = isArrayLike;
  33895. lodash.isArrayLikeObject = isArrayLikeObject;
  33896. lodash.isBoolean = isBoolean;
  33897. lodash.isBuffer = isBuffer;
  33898. lodash.isDate = isDate;
  33899. lodash.isElement = isElement;
  33900. lodash.isEmpty = isEmpty;
  33901. lodash.isEqual = isEqual;
  33902. lodash.isEqualWith = isEqualWith;
  33903. lodash.isError = isError;
  33904. lodash.isFinite = isFinite;
  33905. lodash.isFunction = isFunction;
  33906. lodash.isInteger = isInteger;
  33907. lodash.isLength = isLength;
  33908. lodash.isMap = isMap;
  33909. lodash.isMatch = isMatch;
  33910. lodash.isMatchWith = isMatchWith;
  33911. lodash.isNaN = isNaN;
  33912. lodash.isNative = isNative;
  33913. lodash.isNil = isNil;
  33914. lodash.isNull = isNull;
  33915. lodash.isNumber = isNumber;
  33916. lodash.isObject = isObject;
  33917. lodash.isObjectLike = isObjectLike;
  33918. lodash.isPlainObject = isPlainObject;
  33919. lodash.isRegExp = isRegExp;
  33920. lodash.isSafeInteger = isSafeInteger;
  33921. lodash.isSet = isSet;
  33922. lodash.isString = isString;
  33923. lodash.isSymbol = isSymbol;
  33924. lodash.isTypedArray = isTypedArray;
  33925. lodash.isUndefined = isUndefined;
  33926. lodash.isWeakMap = isWeakMap;
  33927. lodash.isWeakSet = isWeakSet;
  33928. lodash.join = join;
  33929. lodash.kebabCase = kebabCase;
  33930. lodash.last = last;
  33931. lodash.lastIndexOf = lastIndexOf;
  33932. lodash.lowerCase = lowerCase;
  33933. lodash.lowerFirst = lowerFirst;
  33934. lodash.lt = lt;
  33935. lodash.lte = lte;
  33936. lodash.max = max;
  33937. lodash.maxBy = maxBy;
  33938. lodash.mean = mean;
  33939. lodash.meanBy = meanBy;
  33940. lodash.min = min;
  33941. lodash.minBy = minBy;
  33942. lodash.stubArray = stubArray;
  33943. lodash.stubFalse = stubFalse;
  33944. lodash.stubObject = stubObject;
  33945. lodash.stubString = stubString;
  33946. lodash.stubTrue = stubTrue;
  33947. lodash.multiply = multiply;
  33948. lodash.nth = nth;
  33949. lodash.noConflict = noConflict;
  33950. lodash.noop = noop;
  33951. lodash.now = now;
  33952. lodash.pad = pad;
  33953. lodash.padEnd = padEnd;
  33954. lodash.padStart = padStart;
  33955. lodash.parseInt = parseInt;
  33956. lodash.random = random;
  33957. lodash.reduce = reduce;
  33958. lodash.reduceRight = reduceRight;
  33959. lodash.repeat = repeat;
  33960. lodash.replace = replace;
  33961. lodash.result = result;
  33962. lodash.round = round;
  33963. lodash.runInContext = runInContext;
  33964. lodash.sample = sample;
  33965. lodash.size = size;
  33966. lodash.snakeCase = snakeCase;
  33967. lodash.some = some;
  33968. lodash.sortedIndex = sortedIndex;
  33969. lodash.sortedIndexBy = sortedIndexBy;
  33970. lodash.sortedIndexOf = sortedIndexOf;
  33971. lodash.sortedLastIndex = sortedLastIndex;
  33972. lodash.sortedLastIndexBy = sortedLastIndexBy;
  33973. lodash.sortedLastIndexOf = sortedLastIndexOf;
  33974. lodash.startCase = startCase;
  33975. lodash.startsWith = startsWith;
  33976. lodash.subtract = subtract;
  33977. lodash.sum = sum;
  33978. lodash.sumBy = sumBy;
  33979. lodash.template = template;
  33980. lodash.times = times;
  33981. lodash.toFinite = toFinite;
  33982. lodash.toInteger = toInteger;
  33983. lodash.toLength = toLength;
  33984. lodash.toLower = toLower;
  33985. lodash.toNumber = toNumber;
  33986. lodash.toSafeInteger = toSafeInteger;
  33987. lodash.toString = toString;
  33988. lodash.toUpper = toUpper;
  33989. lodash.trim = trim;
  33990. lodash.trimEnd = trimEnd;
  33991. lodash.trimStart = trimStart;
  33992. lodash.truncate = truncate;
  33993. lodash.unescape = unescape;
  33994. lodash.uniqueId = uniqueId;
  33995. lodash.upperCase = upperCase;
  33996. lodash.upperFirst = upperFirst;
  33997. // Add aliases.
  33998. lodash.each = forEach;
  33999. lodash.eachRight = forEachRight;
  34000. lodash.first = head;
  34001. mixin(lodash, (function() {
  34002. var source = {};
  34003. baseForOwn(lodash, function(func, methodName) {
  34004. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34005. source[methodName] = func;
  34006. }
  34007. });
  34008. return source;
  34009. }()), { 'chain': false });
  34010. /*------------------------------------------------------------------------*/
  34011. /**
  34012. * The semantic version number.
  34013. *
  34014. * @static
  34015. * @memberOf _
  34016. * @type {string}
  34017. */
  34018. lodash.VERSION = VERSION;
  34019. // Assign default placeholders.
  34020. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34021. lodash[methodName].placeholder = lodash;
  34022. });
  34023. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34024. arrayEach(['drop', 'take'], function(methodName, index) {
  34025. LazyWrapper.prototype[methodName] = function(n) {
  34026. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34027. var result = (this.__filtered__ && !index)
  34028. ? new LazyWrapper(this)
  34029. : this.clone();
  34030. if (result.__filtered__) {
  34031. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34032. } else {
  34033. result.__views__.push({
  34034. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34035. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34036. });
  34037. }
  34038. return result;
  34039. };
  34040. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34041. return this.reverse()[methodName](n).reverse();
  34042. };
  34043. });
  34044. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34045. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34046. var type = index + 1,
  34047. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34048. LazyWrapper.prototype[methodName] = function(iteratee) {
  34049. var result = this.clone();
  34050. result.__iteratees__.push({
  34051. 'iteratee': getIteratee(iteratee, 3),
  34052. 'type': type
  34053. });
  34054. result.__filtered__ = result.__filtered__ || isFilter;
  34055. return result;
  34056. };
  34057. });
  34058. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34059. arrayEach(['head', 'last'], function(methodName, index) {
  34060. var takeName = 'take' + (index ? 'Right' : '');
  34061. LazyWrapper.prototype[methodName] = function() {
  34062. return this[takeName](1).value()[0];
  34063. };
  34064. });
  34065. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34066. arrayEach(['initial', 'tail'], function(methodName, index) {
  34067. var dropName = 'drop' + (index ? '' : 'Right');
  34068. LazyWrapper.prototype[methodName] = function() {
  34069. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34070. };
  34071. });
  34072. LazyWrapper.prototype.compact = function() {
  34073. return this.filter(identity);
  34074. };
  34075. LazyWrapper.prototype.find = function(predicate) {
  34076. return this.filter(predicate).head();
  34077. };
  34078. LazyWrapper.prototype.findLast = function(predicate) {
  34079. return this.reverse().find(predicate);
  34080. };
  34081. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34082. if (typeof path == 'function') {
  34083. return new LazyWrapper(this);
  34084. }
  34085. return this.map(function(value) {
  34086. return baseInvoke(value, path, args);
  34087. });
  34088. });
  34089. LazyWrapper.prototype.reject = function(predicate) {
  34090. return this.filter(negate(getIteratee(predicate)));
  34091. };
  34092. LazyWrapper.prototype.slice = function(start, end) {
  34093. start = toInteger(start);
  34094. var result = this;
  34095. if (result.__filtered__ && (start > 0 || end < 0)) {
  34096. return new LazyWrapper(result);
  34097. }
  34098. if (start < 0) {
  34099. result = result.takeRight(-start);
  34100. } else if (start) {
  34101. result = result.drop(start);
  34102. }
  34103. if (end !== undefined) {
  34104. end = toInteger(end);
  34105. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34106. }
  34107. return result;
  34108. };
  34109. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34110. return this.reverse().takeWhile(predicate).reverse();
  34111. };
  34112. LazyWrapper.prototype.toArray = function() {
  34113. return this.take(MAX_ARRAY_LENGTH);
  34114. };
  34115. // Add `LazyWrapper` methods to `lodash.prototype`.
  34116. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34117. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34118. isTaker = /^(?:head|last)$/.test(methodName),
  34119. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34120. retUnwrapped = isTaker || /^find/.test(methodName);
  34121. if (!lodashFunc) {
  34122. return;
  34123. }
  34124. lodash.prototype[methodName] = function() {
  34125. var value = this.__wrapped__,
  34126. args = isTaker ? [1] : arguments,
  34127. isLazy = value instanceof LazyWrapper,
  34128. iteratee = args[0],
  34129. useLazy = isLazy || isArray(value);
  34130. var interceptor = function(value) {
  34131. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34132. return (isTaker && chainAll) ? result[0] : result;
  34133. };
  34134. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34135. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34136. isLazy = useLazy = false;
  34137. }
  34138. var chainAll = this.__chain__,
  34139. isHybrid = !!this.__actions__.length,
  34140. isUnwrapped = retUnwrapped && !chainAll,
  34141. onlyLazy = isLazy && !isHybrid;
  34142. if (!retUnwrapped && useLazy) {
  34143. value = onlyLazy ? value : new LazyWrapper(this);
  34144. var result = func.apply(value, args);
  34145. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34146. return new LodashWrapper(result, chainAll);
  34147. }
  34148. if (isUnwrapped && onlyLazy) {
  34149. return func.apply(this, args);
  34150. }
  34151. result = this.thru(interceptor);
  34152. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34153. };
  34154. });
  34155. // Add `Array` methods to `lodash.prototype`.
  34156. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34157. var func = arrayProto[methodName],
  34158. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34159. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34160. lodash.prototype[methodName] = function() {
  34161. var args = arguments;
  34162. if (retUnwrapped && !this.__chain__) {
  34163. var value = this.value();
  34164. return func.apply(isArray(value) ? value : [], args);
  34165. }
  34166. return this[chainName](function(value) {
  34167. return func.apply(isArray(value) ? value : [], args);
  34168. });
  34169. };
  34170. });
  34171. // Map minified method names to their real names.
  34172. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34173. var lodashFunc = lodash[methodName];
  34174. if (lodashFunc) {
  34175. var key = lodashFunc.name + '';
  34176. if (!hasOwnProperty.call(realNames, key)) {
  34177. realNames[key] = [];
  34178. }
  34179. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34180. }
  34181. });
  34182. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34183. 'name': 'wrapper',
  34184. 'func': undefined
  34185. }];
  34186. // Add methods to `LazyWrapper`.
  34187. LazyWrapper.prototype.clone = lazyClone;
  34188. LazyWrapper.prototype.reverse = lazyReverse;
  34189. LazyWrapper.prototype.value = lazyValue;
  34190. // Add chain sequence methods to the `lodash` wrapper.
  34191. lodash.prototype.at = wrapperAt;
  34192. lodash.prototype.chain = wrapperChain;
  34193. lodash.prototype.commit = wrapperCommit;
  34194. lodash.prototype.next = wrapperNext;
  34195. lodash.prototype.plant = wrapperPlant;
  34196. lodash.prototype.reverse = wrapperReverse;
  34197. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34198. // Add lazy aliases.
  34199. lodash.prototype.first = lodash.prototype.head;
  34200. if (symIterator) {
  34201. lodash.prototype[symIterator] = wrapperToIterator;
  34202. }
  34203. return lodash;
  34204. });
  34205. /*--------------------------------------------------------------------------*/
  34206. // Export lodash.
  34207. var _ = runInContext();
  34208. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34209. if (true) {
  34210. // Expose Lodash on the global object to prevent errors when Lodash is
  34211. // loaded by a script tag in the presence of an AMD loader.
  34212. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34213. // Use `_.noConflict` to remove Lodash from the global object.
  34214. root._ = _;
  34215. // Define as an anonymous module so, through path mapping, it can be
  34216. // referenced as the "underscore" module.
  34217. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34218. return _;
  34219. }).call(exports, __webpack_require__, exports, module),
  34220. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34221. }
  34222. // Check for `exports` after `define` in case a build optimizer adds it.
  34223. else {}
  34224. }.call(this));
  34225. /* 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)))
  34226. /***/ }),
  34227. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34228. /*!***************************************************!*\
  34229. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34230. \***************************************************/
  34231. /*! exports provided: default */
  34232. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34233. "use strict";
  34234. __webpack_require__.r(__webpack_exports__);
  34235. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34236. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34237. * @version 1.16.1
  34238. * @license
  34239. * Copyright (c) 2016 Federico Zivolo and contributors
  34240. *
  34241. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34242. * of this software and associated documentation files (the "Software"), to deal
  34243. * in the Software without restriction, including without limitation the rights
  34244. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34245. * copies of the Software, and to permit persons to whom the Software is
  34246. * furnished to do so, subject to the following conditions:
  34247. *
  34248. * The above copyright notice and this permission notice shall be included in all
  34249. * copies or substantial portions of the Software.
  34250. *
  34251. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34252. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34253. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34254. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34255. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34256. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34257. * SOFTWARE.
  34258. */
  34259. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34260. var timeoutDuration = function () {
  34261. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34262. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34263. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34264. return 1;
  34265. }
  34266. }
  34267. return 0;
  34268. }();
  34269. function microtaskDebounce(fn) {
  34270. var called = false;
  34271. return function () {
  34272. if (called) {
  34273. return;
  34274. }
  34275. called = true;
  34276. window.Promise.resolve().then(function () {
  34277. called = false;
  34278. fn();
  34279. });
  34280. };
  34281. }
  34282. function taskDebounce(fn) {
  34283. var scheduled = false;
  34284. return function () {
  34285. if (!scheduled) {
  34286. scheduled = true;
  34287. setTimeout(function () {
  34288. scheduled = false;
  34289. fn();
  34290. }, timeoutDuration);
  34291. }
  34292. };
  34293. }
  34294. var supportsMicroTasks = isBrowser && window.Promise;
  34295. /**
  34296. * Create a debounced version of a method, that's asynchronously deferred
  34297. * but called in the minimum time possible.
  34298. *
  34299. * @method
  34300. * @memberof Popper.Utils
  34301. * @argument {Function} fn
  34302. * @returns {Function}
  34303. */
  34304. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34305. /**
  34306. * Check if the given variable is a function
  34307. * @method
  34308. * @memberof Popper.Utils
  34309. * @argument {Any} functionToCheck - variable to check
  34310. * @returns {Boolean} answer to: is a function?
  34311. */
  34312. function isFunction(functionToCheck) {
  34313. var getType = {};
  34314. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34315. }
  34316. /**
  34317. * Get CSS computed property of the given element
  34318. * @method
  34319. * @memberof Popper.Utils
  34320. * @argument {Eement} element
  34321. * @argument {String} property
  34322. */
  34323. function getStyleComputedProperty(element, property) {
  34324. if (element.nodeType !== 1) {
  34325. return [];
  34326. }
  34327. // NOTE: 1 DOM access here
  34328. var window = element.ownerDocument.defaultView;
  34329. var css = window.getComputedStyle(element, null);
  34330. return property ? css[property] : css;
  34331. }
  34332. /**
  34333. * Returns the parentNode or the host of the element
  34334. * @method
  34335. * @memberof Popper.Utils
  34336. * @argument {Element} element
  34337. * @returns {Element} parent
  34338. */
  34339. function getParentNode(element) {
  34340. if (element.nodeName === 'HTML') {
  34341. return element;
  34342. }
  34343. return element.parentNode || element.host;
  34344. }
  34345. /**
  34346. * Returns the scrolling parent of the given element
  34347. * @method
  34348. * @memberof Popper.Utils
  34349. * @argument {Element} element
  34350. * @returns {Element} scroll parent
  34351. */
  34352. function getScrollParent(element) {
  34353. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34354. if (!element) {
  34355. return document.body;
  34356. }
  34357. switch (element.nodeName) {
  34358. case 'HTML':
  34359. case 'BODY':
  34360. return element.ownerDocument.body;
  34361. case '#document':
  34362. return element.body;
  34363. }
  34364. // Firefox want us to check `-x` and `-y` variations as well
  34365. var _getStyleComputedProp = getStyleComputedProperty(element),
  34366. overflow = _getStyleComputedProp.overflow,
  34367. overflowX = _getStyleComputedProp.overflowX,
  34368. overflowY = _getStyleComputedProp.overflowY;
  34369. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34370. return element;
  34371. }
  34372. return getScrollParent(getParentNode(element));
  34373. }
  34374. /**
  34375. * Returns the reference node of the reference object, or the reference object itself.
  34376. * @method
  34377. * @memberof Popper.Utils
  34378. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34379. * @returns {Element} parent
  34380. */
  34381. function getReferenceNode(reference) {
  34382. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34383. }
  34384. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34385. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34386. /**
  34387. * Determines if the browser is Internet Explorer
  34388. * @method
  34389. * @memberof Popper.Utils
  34390. * @param {Number} version to check
  34391. * @returns {Boolean} isIE
  34392. */
  34393. function isIE(version) {
  34394. if (version === 11) {
  34395. return isIE11;
  34396. }
  34397. if (version === 10) {
  34398. return isIE10;
  34399. }
  34400. return isIE11 || isIE10;
  34401. }
  34402. /**
  34403. * Returns the offset parent of the given element
  34404. * @method
  34405. * @memberof Popper.Utils
  34406. * @argument {Element} element
  34407. * @returns {Element} offset parent
  34408. */
  34409. function getOffsetParent(element) {
  34410. if (!element) {
  34411. return document.documentElement;
  34412. }
  34413. var noOffsetParent = isIE(10) ? document.body : null;
  34414. // NOTE: 1 DOM access here
  34415. var offsetParent = element.offsetParent || null;
  34416. // Skip hidden elements which don't have an offsetParent
  34417. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34418. offsetParent = (element = element.nextElementSibling).offsetParent;
  34419. }
  34420. var nodeName = offsetParent && offsetParent.nodeName;
  34421. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34422. return element ? element.ownerDocument.documentElement : document.documentElement;
  34423. }
  34424. // .offsetParent will return the closest TH, TD or TABLE in case
  34425. // no offsetParent is present, I hate this job...
  34426. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34427. return getOffsetParent(offsetParent);
  34428. }
  34429. return offsetParent;
  34430. }
  34431. function isOffsetContainer(element) {
  34432. var nodeName = element.nodeName;
  34433. if (nodeName === 'BODY') {
  34434. return false;
  34435. }
  34436. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34437. }
  34438. /**
  34439. * Finds the root node (document, shadowDOM root) of the given element
  34440. * @method
  34441. * @memberof Popper.Utils
  34442. * @argument {Element} node
  34443. * @returns {Element} root node
  34444. */
  34445. function getRoot(node) {
  34446. if (node.parentNode !== null) {
  34447. return getRoot(node.parentNode);
  34448. }
  34449. return node;
  34450. }
  34451. /**
  34452. * Finds the offset parent common to the two provided nodes
  34453. * @method
  34454. * @memberof Popper.Utils
  34455. * @argument {Element} element1
  34456. * @argument {Element} element2
  34457. * @returns {Element} common offset parent
  34458. */
  34459. function findCommonOffsetParent(element1, element2) {
  34460. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34461. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34462. return document.documentElement;
  34463. }
  34464. // Here we make sure to give as "start" the element that comes first in the DOM
  34465. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34466. var start = order ? element1 : element2;
  34467. var end = order ? element2 : element1;
  34468. // Get common ancestor container
  34469. var range = document.createRange();
  34470. range.setStart(start, 0);
  34471. range.setEnd(end, 0);
  34472. var commonAncestorContainer = range.commonAncestorContainer;
  34473. // Both nodes are inside #document
  34474. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34475. if (isOffsetContainer(commonAncestorContainer)) {
  34476. return commonAncestorContainer;
  34477. }
  34478. return getOffsetParent(commonAncestorContainer);
  34479. }
  34480. // one of the nodes is inside shadowDOM, find which one
  34481. var element1root = getRoot(element1);
  34482. if (element1root.host) {
  34483. return findCommonOffsetParent(element1root.host, element2);
  34484. } else {
  34485. return findCommonOffsetParent(element1, getRoot(element2).host);
  34486. }
  34487. }
  34488. /**
  34489. * Gets the scroll value of the given element in the given side (top and left)
  34490. * @method
  34491. * @memberof Popper.Utils
  34492. * @argument {Element} element
  34493. * @argument {String} side `top` or `left`
  34494. * @returns {number} amount of scrolled pixels
  34495. */
  34496. function getScroll(element) {
  34497. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34498. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34499. var nodeName = element.nodeName;
  34500. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34501. var html = element.ownerDocument.documentElement;
  34502. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34503. return scrollingElement[upperSide];
  34504. }
  34505. return element[upperSide];
  34506. }
  34507. /*
  34508. * Sum or subtract the element scroll values (left and top) from a given rect object
  34509. * @method
  34510. * @memberof Popper.Utils
  34511. * @param {Object} rect - Rect object you want to change
  34512. * @param {HTMLElement} element - The element from the function reads the scroll values
  34513. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34514. * @return {Object} rect - The modifier rect object
  34515. */
  34516. function includeScroll(rect, element) {
  34517. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34518. var scrollTop = getScroll(element, 'top');
  34519. var scrollLeft = getScroll(element, 'left');
  34520. var modifier = subtract ? -1 : 1;
  34521. rect.top += scrollTop * modifier;
  34522. rect.bottom += scrollTop * modifier;
  34523. rect.left += scrollLeft * modifier;
  34524. rect.right += scrollLeft * modifier;
  34525. return rect;
  34526. }
  34527. /*
  34528. * Helper to detect borders of a given element
  34529. * @method
  34530. * @memberof Popper.Utils
  34531. * @param {CSSStyleDeclaration} styles
  34532. * Result of `getStyleComputedProperty` on the given element
  34533. * @param {String} axis - `x` or `y`
  34534. * @return {number} borders - The borders size of the given axis
  34535. */
  34536. function getBordersSize(styles, axis) {
  34537. var sideA = axis === 'x' ? 'Left' : 'Top';
  34538. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34539. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34540. }
  34541. function getSize(axis, body, html, computedStyle) {
  34542. 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);
  34543. }
  34544. function getWindowSizes(document) {
  34545. var body = document.body;
  34546. var html = document.documentElement;
  34547. var computedStyle = isIE(10) && getComputedStyle(html);
  34548. return {
  34549. height: getSize('Height', body, html, computedStyle),
  34550. width: getSize('Width', body, html, computedStyle)
  34551. };
  34552. }
  34553. var classCallCheck = function (instance, Constructor) {
  34554. if (!(instance instanceof Constructor)) {
  34555. throw new TypeError("Cannot call a class as a function");
  34556. }
  34557. };
  34558. var createClass = function () {
  34559. function defineProperties(target, props) {
  34560. for (var i = 0; i < props.length; i++) {
  34561. var descriptor = props[i];
  34562. descriptor.enumerable = descriptor.enumerable || false;
  34563. descriptor.configurable = true;
  34564. if ("value" in descriptor) descriptor.writable = true;
  34565. Object.defineProperty(target, descriptor.key, descriptor);
  34566. }
  34567. }
  34568. return function (Constructor, protoProps, staticProps) {
  34569. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34570. if (staticProps) defineProperties(Constructor, staticProps);
  34571. return Constructor;
  34572. };
  34573. }();
  34574. var defineProperty = function (obj, key, value) {
  34575. if (key in obj) {
  34576. Object.defineProperty(obj, key, {
  34577. value: value,
  34578. enumerable: true,
  34579. configurable: true,
  34580. writable: true
  34581. });
  34582. } else {
  34583. obj[key] = value;
  34584. }
  34585. return obj;
  34586. };
  34587. var _extends = Object.assign || function (target) {
  34588. for (var i = 1; i < arguments.length; i++) {
  34589. var source = arguments[i];
  34590. for (var key in source) {
  34591. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34592. target[key] = source[key];
  34593. }
  34594. }
  34595. }
  34596. return target;
  34597. };
  34598. /**
  34599. * Given element offsets, generate an output similar to getBoundingClientRect
  34600. * @method
  34601. * @memberof Popper.Utils
  34602. * @argument {Object} offsets
  34603. * @returns {Object} ClientRect like output
  34604. */
  34605. function getClientRect(offsets) {
  34606. return _extends({}, offsets, {
  34607. right: offsets.left + offsets.width,
  34608. bottom: offsets.top + offsets.height
  34609. });
  34610. }
  34611. /**
  34612. * Get bounding client rect of given element
  34613. * @method
  34614. * @memberof Popper.Utils
  34615. * @param {HTMLElement} element
  34616. * @return {Object} client rect
  34617. */
  34618. function getBoundingClientRect(element) {
  34619. var rect = {};
  34620. // IE10 10 FIX: Please, don't ask, the element isn't
  34621. // considered in DOM in some circumstances...
  34622. // This isn't reproducible in IE10 compatibility mode of IE11
  34623. try {
  34624. if (isIE(10)) {
  34625. rect = element.getBoundingClientRect();
  34626. var scrollTop = getScroll(element, 'top');
  34627. var scrollLeft = getScroll(element, 'left');
  34628. rect.top += scrollTop;
  34629. rect.left += scrollLeft;
  34630. rect.bottom += scrollTop;
  34631. rect.right += scrollLeft;
  34632. } else {
  34633. rect = element.getBoundingClientRect();
  34634. }
  34635. } catch (e) {}
  34636. var result = {
  34637. left: rect.left,
  34638. top: rect.top,
  34639. width: rect.right - rect.left,
  34640. height: rect.bottom - rect.top
  34641. };
  34642. // subtract scrollbar size from sizes
  34643. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34644. var width = sizes.width || element.clientWidth || result.width;
  34645. var height = sizes.height || element.clientHeight || result.height;
  34646. var horizScrollbar = element.offsetWidth - width;
  34647. var vertScrollbar = element.offsetHeight - height;
  34648. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34649. // we make this check conditional for performance reasons
  34650. if (horizScrollbar || vertScrollbar) {
  34651. var styles = getStyleComputedProperty(element);
  34652. horizScrollbar -= getBordersSize(styles, 'x');
  34653. vertScrollbar -= getBordersSize(styles, 'y');
  34654. result.width -= horizScrollbar;
  34655. result.height -= vertScrollbar;
  34656. }
  34657. return getClientRect(result);
  34658. }
  34659. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34660. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34661. var isIE10 = isIE(10);
  34662. var isHTML = parent.nodeName === 'HTML';
  34663. var childrenRect = getBoundingClientRect(children);
  34664. var parentRect = getBoundingClientRect(parent);
  34665. var scrollParent = getScrollParent(children);
  34666. var styles = getStyleComputedProperty(parent);
  34667. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34668. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34669. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34670. if (fixedPosition && isHTML) {
  34671. parentRect.top = Math.max(parentRect.top, 0);
  34672. parentRect.left = Math.max(parentRect.left, 0);
  34673. }
  34674. var offsets = getClientRect({
  34675. top: childrenRect.top - parentRect.top - borderTopWidth,
  34676. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34677. width: childrenRect.width,
  34678. height: childrenRect.height
  34679. });
  34680. offsets.marginTop = 0;
  34681. offsets.marginLeft = 0;
  34682. // Subtract margins of documentElement in case it's being used as parent
  34683. // we do this only on HTML because it's the only element that behaves
  34684. // differently when margins are applied to it. The margins are included in
  34685. // the box of the documentElement, in the other cases not.
  34686. if (!isIE10 && isHTML) {
  34687. var marginTop = parseFloat(styles.marginTop);
  34688. var marginLeft = parseFloat(styles.marginLeft);
  34689. offsets.top -= borderTopWidth - marginTop;
  34690. offsets.bottom -= borderTopWidth - marginTop;
  34691. offsets.left -= borderLeftWidth - marginLeft;
  34692. offsets.right -= borderLeftWidth - marginLeft;
  34693. // Attach marginTop and marginLeft because in some circumstances we may need them
  34694. offsets.marginTop = marginTop;
  34695. offsets.marginLeft = marginLeft;
  34696. }
  34697. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34698. offsets = includeScroll(offsets, parent);
  34699. }
  34700. return offsets;
  34701. }
  34702. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34703. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34704. var html = element.ownerDocument.documentElement;
  34705. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34706. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34707. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34708. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34709. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34710. var offset = {
  34711. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34712. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34713. width: width,
  34714. height: height
  34715. };
  34716. return getClientRect(offset);
  34717. }
  34718. /**
  34719. * Check if the given element is fixed or is inside a fixed parent
  34720. * @method
  34721. * @memberof Popper.Utils
  34722. * @argument {Element} element
  34723. * @argument {Element} customContainer
  34724. * @returns {Boolean} answer to "isFixed?"
  34725. */
  34726. function isFixed(element) {
  34727. var nodeName = element.nodeName;
  34728. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34729. return false;
  34730. }
  34731. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34732. return true;
  34733. }
  34734. var parentNode = getParentNode(element);
  34735. if (!parentNode) {
  34736. return false;
  34737. }
  34738. return isFixed(parentNode);
  34739. }
  34740. /**
  34741. * Finds the first parent of an element that has a transformed property defined
  34742. * @method
  34743. * @memberof Popper.Utils
  34744. * @argument {Element} element
  34745. * @returns {Element} first transformed parent or documentElement
  34746. */
  34747. function getFixedPositionOffsetParent(element) {
  34748. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34749. if (!element || !element.parentElement || isIE()) {
  34750. return document.documentElement;
  34751. }
  34752. var el = element.parentElement;
  34753. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34754. el = el.parentElement;
  34755. }
  34756. return el || document.documentElement;
  34757. }
  34758. /**
  34759. * Computed the boundaries limits and return them
  34760. * @method
  34761. * @memberof Popper.Utils
  34762. * @param {HTMLElement} popper
  34763. * @param {HTMLElement} reference
  34764. * @param {number} padding
  34765. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34766. * @param {Boolean} fixedPosition - Is in fixed position mode
  34767. * @returns {Object} Coordinates of the boundaries
  34768. */
  34769. function getBoundaries(popper, reference, padding, boundariesElement) {
  34770. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34771. // NOTE: 1 DOM access here
  34772. var boundaries = { top: 0, left: 0 };
  34773. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34774. // Handle viewport case
  34775. if (boundariesElement === 'viewport') {
  34776. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34777. } else {
  34778. // Handle other cases based on DOM element used as boundaries
  34779. var boundariesNode = void 0;
  34780. if (boundariesElement === 'scrollParent') {
  34781. boundariesNode = getScrollParent(getParentNode(reference));
  34782. if (boundariesNode.nodeName === 'BODY') {
  34783. boundariesNode = popper.ownerDocument.documentElement;
  34784. }
  34785. } else if (boundariesElement === 'window') {
  34786. boundariesNode = popper.ownerDocument.documentElement;
  34787. } else {
  34788. boundariesNode = boundariesElement;
  34789. }
  34790. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34791. // In case of HTML, we need a different computation
  34792. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34793. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34794. height = _getWindowSizes.height,
  34795. width = _getWindowSizes.width;
  34796. boundaries.top += offsets.top - offsets.marginTop;
  34797. boundaries.bottom = height + offsets.top;
  34798. boundaries.left += offsets.left - offsets.marginLeft;
  34799. boundaries.right = width + offsets.left;
  34800. } else {
  34801. // for all the other DOM elements, this one is good
  34802. boundaries = offsets;
  34803. }
  34804. }
  34805. // Add paddings
  34806. padding = padding || 0;
  34807. var isPaddingNumber = typeof padding === 'number';
  34808. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34809. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34810. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34811. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34812. return boundaries;
  34813. }
  34814. function getArea(_ref) {
  34815. var width = _ref.width,
  34816. height = _ref.height;
  34817. return width * height;
  34818. }
  34819. /**
  34820. * Utility used to transform the `auto` placement to the placement with more
  34821. * available space.
  34822. * @method
  34823. * @memberof Popper.Utils
  34824. * @argument {Object} data - The data object generated by update method
  34825. * @argument {Object} options - Modifiers configuration and options
  34826. * @returns {Object} The data object, properly modified
  34827. */
  34828. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34829. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34830. if (placement.indexOf('auto') === -1) {
  34831. return placement;
  34832. }
  34833. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34834. var rects = {
  34835. top: {
  34836. width: boundaries.width,
  34837. height: refRect.top - boundaries.top
  34838. },
  34839. right: {
  34840. width: boundaries.right - refRect.right,
  34841. height: boundaries.height
  34842. },
  34843. bottom: {
  34844. width: boundaries.width,
  34845. height: boundaries.bottom - refRect.bottom
  34846. },
  34847. left: {
  34848. width: refRect.left - boundaries.left,
  34849. height: boundaries.height
  34850. }
  34851. };
  34852. var sortedAreas = Object.keys(rects).map(function (key) {
  34853. return _extends({
  34854. key: key
  34855. }, rects[key], {
  34856. area: getArea(rects[key])
  34857. });
  34858. }).sort(function (a, b) {
  34859. return b.area - a.area;
  34860. });
  34861. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34862. var width = _ref2.width,
  34863. height = _ref2.height;
  34864. return width >= popper.clientWidth && height >= popper.clientHeight;
  34865. });
  34866. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34867. var variation = placement.split('-')[1];
  34868. return computedPlacement + (variation ? '-' + variation : '');
  34869. }
  34870. /**
  34871. * Get offsets to the reference element
  34872. * @method
  34873. * @memberof Popper.Utils
  34874. * @param {Object} state
  34875. * @param {Element} popper - the popper element
  34876. * @param {Element} reference - the reference element (the popper will be relative to this)
  34877. * @param {Element} fixedPosition - is in fixed position mode
  34878. * @returns {Object} An object containing the offsets which will be applied to the popper
  34879. */
  34880. function getReferenceOffsets(state, popper, reference) {
  34881. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34882. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34883. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34884. }
  34885. /**
  34886. * Get the outer sizes of the given element (offset size + margins)
  34887. * @method
  34888. * @memberof Popper.Utils
  34889. * @argument {Element} element
  34890. * @returns {Object} object containing width and height properties
  34891. */
  34892. function getOuterSizes(element) {
  34893. var window = element.ownerDocument.defaultView;
  34894. var styles = window.getComputedStyle(element);
  34895. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34896. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34897. var result = {
  34898. width: element.offsetWidth + y,
  34899. height: element.offsetHeight + x
  34900. };
  34901. return result;
  34902. }
  34903. /**
  34904. * Get the opposite placement of the given one
  34905. * @method
  34906. * @memberof Popper.Utils
  34907. * @argument {String} placement
  34908. * @returns {String} flipped placement
  34909. */
  34910. function getOppositePlacement(placement) {
  34911. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  34912. return placement.replace(/left|right|bottom|top/g, function (matched) {
  34913. return hash[matched];
  34914. });
  34915. }
  34916. /**
  34917. * Get offsets to the popper
  34918. * @method
  34919. * @memberof Popper.Utils
  34920. * @param {Object} position - CSS position the Popper will get applied
  34921. * @param {HTMLElement} popper - the popper element
  34922. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  34923. * @param {String} placement - one of the valid placement options
  34924. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  34925. */
  34926. function getPopperOffsets(popper, referenceOffsets, placement) {
  34927. placement = placement.split('-')[0];
  34928. // Get popper node sizes
  34929. var popperRect = getOuterSizes(popper);
  34930. // Add position, width and height to our offsets object
  34931. var popperOffsets = {
  34932. width: popperRect.width,
  34933. height: popperRect.height
  34934. };
  34935. // depending by the popper placement we have to compute its offsets slightly differently
  34936. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  34937. var mainSide = isHoriz ? 'top' : 'left';
  34938. var secondarySide = isHoriz ? 'left' : 'top';
  34939. var measurement = isHoriz ? 'height' : 'width';
  34940. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  34941. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  34942. if (placement === secondarySide) {
  34943. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  34944. } else {
  34945. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  34946. }
  34947. return popperOffsets;
  34948. }
  34949. /**
  34950. * Mimics the `find` method of Array
  34951. * @method
  34952. * @memberof Popper.Utils
  34953. * @argument {Array} arr
  34954. * @argument prop
  34955. * @argument value
  34956. * @returns index or -1
  34957. */
  34958. function find(arr, check) {
  34959. // use native find if supported
  34960. if (Array.prototype.find) {
  34961. return arr.find(check);
  34962. }
  34963. // use `filter` to obtain the same behavior of `find`
  34964. return arr.filter(check)[0];
  34965. }
  34966. /**
  34967. * Return the index of the matching object
  34968. * @method
  34969. * @memberof Popper.Utils
  34970. * @argument {Array} arr
  34971. * @argument prop
  34972. * @argument value
  34973. * @returns index or -1
  34974. */
  34975. function findIndex(arr, prop, value) {
  34976. // use native findIndex if supported
  34977. if (Array.prototype.findIndex) {
  34978. return arr.findIndex(function (cur) {
  34979. return cur[prop] === value;
  34980. });
  34981. }
  34982. // use `find` + `indexOf` if `findIndex` isn't supported
  34983. var match = find(arr, function (obj) {
  34984. return obj[prop] === value;
  34985. });
  34986. return arr.indexOf(match);
  34987. }
  34988. /**
  34989. * Loop trough the list of modifiers and run them in order,
  34990. * each of them will then edit the data object.
  34991. * @method
  34992. * @memberof Popper.Utils
  34993. * @param {dataObject} data
  34994. * @param {Array} modifiers
  34995. * @param {String} ends - Optional modifier name used as stopper
  34996. * @returns {dataObject}
  34997. */
  34998. function runModifiers(modifiers, data, ends) {
  34999. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35000. modifiersToRun.forEach(function (modifier) {
  35001. if (modifier['function']) {
  35002. // eslint-disable-line dot-notation
  35003. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35004. }
  35005. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35006. if (modifier.enabled && isFunction(fn)) {
  35007. // Add properties to offsets to make them a complete clientRect object
  35008. // we do this before each modifier to make sure the previous one doesn't
  35009. // mess with these values
  35010. data.offsets.popper = getClientRect(data.offsets.popper);
  35011. data.offsets.reference = getClientRect(data.offsets.reference);
  35012. data = fn(data, modifier);
  35013. }
  35014. });
  35015. return data;
  35016. }
  35017. /**
  35018. * Updates the position of the popper, computing the new offsets and applying
  35019. * the new style.<br />
  35020. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35021. * @method
  35022. * @memberof Popper
  35023. */
  35024. function update() {
  35025. // if popper is destroyed, don't perform any further update
  35026. if (this.state.isDestroyed) {
  35027. return;
  35028. }
  35029. var data = {
  35030. instance: this,
  35031. styles: {},
  35032. arrowStyles: {},
  35033. attributes: {},
  35034. flipped: false,
  35035. offsets: {}
  35036. };
  35037. // compute reference element offsets
  35038. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35039. // compute auto placement, store placement inside the data object,
  35040. // modifiers will be able to edit `placement` if needed
  35041. // and refer to originalPlacement to know the original value
  35042. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35043. // store the computed placement inside `originalPlacement`
  35044. data.originalPlacement = data.placement;
  35045. data.positionFixed = this.options.positionFixed;
  35046. // compute the popper offsets
  35047. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35048. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35049. // run the modifiers
  35050. data = runModifiers(this.modifiers, data);
  35051. // the first `update` will call `onCreate` callback
  35052. // the other ones will call `onUpdate` callback
  35053. if (!this.state.isCreated) {
  35054. this.state.isCreated = true;
  35055. this.options.onCreate(data);
  35056. } else {
  35057. this.options.onUpdate(data);
  35058. }
  35059. }
  35060. /**
  35061. * Helper used to know if the given modifier is enabled.
  35062. * @method
  35063. * @memberof Popper.Utils
  35064. * @returns {Boolean}
  35065. */
  35066. function isModifierEnabled(modifiers, modifierName) {
  35067. return modifiers.some(function (_ref) {
  35068. var name = _ref.name,
  35069. enabled = _ref.enabled;
  35070. return enabled && name === modifierName;
  35071. });
  35072. }
  35073. /**
  35074. * Get the prefixed supported property name
  35075. * @method
  35076. * @memberof Popper.Utils
  35077. * @argument {String} property (camelCase)
  35078. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35079. */
  35080. function getSupportedPropertyName(property) {
  35081. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35082. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35083. for (var i = 0; i < prefixes.length; i++) {
  35084. var prefix = prefixes[i];
  35085. var toCheck = prefix ? '' + prefix + upperProp : property;
  35086. if (typeof document.body.style[toCheck] !== 'undefined') {
  35087. return toCheck;
  35088. }
  35089. }
  35090. return null;
  35091. }
  35092. /**
  35093. * Destroys the popper.
  35094. * @method
  35095. * @memberof Popper
  35096. */
  35097. function destroy() {
  35098. this.state.isDestroyed = true;
  35099. // touch DOM only if `applyStyle` modifier is enabled
  35100. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35101. this.popper.removeAttribute('x-placement');
  35102. this.popper.style.position = '';
  35103. this.popper.style.top = '';
  35104. this.popper.style.left = '';
  35105. this.popper.style.right = '';
  35106. this.popper.style.bottom = '';
  35107. this.popper.style.willChange = '';
  35108. this.popper.style[getSupportedPropertyName('transform')] = '';
  35109. }
  35110. this.disableEventListeners();
  35111. // remove the popper if user explicitly asked for the deletion on destroy
  35112. // do not use `remove` because IE11 doesn't support it
  35113. if (this.options.removeOnDestroy) {
  35114. this.popper.parentNode.removeChild(this.popper);
  35115. }
  35116. return this;
  35117. }
  35118. /**
  35119. * Get the window associated with the element
  35120. * @argument {Element} element
  35121. * @returns {Window}
  35122. */
  35123. function getWindow(element) {
  35124. var ownerDocument = element.ownerDocument;
  35125. return ownerDocument ? ownerDocument.defaultView : window;
  35126. }
  35127. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35128. var isBody = scrollParent.nodeName === 'BODY';
  35129. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35130. target.addEventListener(event, callback, { passive: true });
  35131. if (!isBody) {
  35132. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35133. }
  35134. scrollParents.push(target);
  35135. }
  35136. /**
  35137. * Setup needed event listeners used to update the popper position
  35138. * @method
  35139. * @memberof Popper.Utils
  35140. * @private
  35141. */
  35142. function setupEventListeners(reference, options, state, updateBound) {
  35143. // Resize event listener on window
  35144. state.updateBound = updateBound;
  35145. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35146. // Scroll event listener on scroll parents
  35147. var scrollElement = getScrollParent(reference);
  35148. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35149. state.scrollElement = scrollElement;
  35150. state.eventsEnabled = true;
  35151. return state;
  35152. }
  35153. /**
  35154. * It will add resize/scroll events and start recalculating
  35155. * position of the popper element when they are triggered.
  35156. * @method
  35157. * @memberof Popper
  35158. */
  35159. function enableEventListeners() {
  35160. if (!this.state.eventsEnabled) {
  35161. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35162. }
  35163. }
  35164. /**
  35165. * Remove event listeners used to update the popper position
  35166. * @method
  35167. * @memberof Popper.Utils
  35168. * @private
  35169. */
  35170. function removeEventListeners(reference, state) {
  35171. // Remove resize event listener on window
  35172. getWindow(reference).removeEventListener('resize', state.updateBound);
  35173. // Remove scroll event listener on scroll parents
  35174. state.scrollParents.forEach(function (target) {
  35175. target.removeEventListener('scroll', state.updateBound);
  35176. });
  35177. // Reset state
  35178. state.updateBound = null;
  35179. state.scrollParents = [];
  35180. state.scrollElement = null;
  35181. state.eventsEnabled = false;
  35182. return state;
  35183. }
  35184. /**
  35185. * It will remove resize/scroll events and won't recalculate popper position
  35186. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35187. * unless you call `update` method manually.
  35188. * @method
  35189. * @memberof Popper
  35190. */
  35191. function disableEventListeners() {
  35192. if (this.state.eventsEnabled) {
  35193. cancelAnimationFrame(this.scheduleUpdate);
  35194. this.state = removeEventListeners(this.reference, this.state);
  35195. }
  35196. }
  35197. /**
  35198. * Tells if a given input is a number
  35199. * @method
  35200. * @memberof Popper.Utils
  35201. * @param {*} input to check
  35202. * @return {Boolean}
  35203. */
  35204. function isNumeric(n) {
  35205. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35206. }
  35207. /**
  35208. * Set the style to the given popper
  35209. * @method
  35210. * @memberof Popper.Utils
  35211. * @argument {Element} element - Element to apply the style to
  35212. * @argument {Object} styles
  35213. * Object with a list of properties and values which will be applied to the element
  35214. */
  35215. function setStyles(element, styles) {
  35216. Object.keys(styles).forEach(function (prop) {
  35217. var unit = '';
  35218. // add unit if the value is numeric and is one of the following
  35219. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35220. unit = 'px';
  35221. }
  35222. element.style[prop] = styles[prop] + unit;
  35223. });
  35224. }
  35225. /**
  35226. * Set the attributes to the given popper
  35227. * @method
  35228. * @memberof Popper.Utils
  35229. * @argument {Element} element - Element to apply the attributes to
  35230. * @argument {Object} styles
  35231. * Object with a list of properties and values which will be applied to the element
  35232. */
  35233. function setAttributes(element, attributes) {
  35234. Object.keys(attributes).forEach(function (prop) {
  35235. var value = attributes[prop];
  35236. if (value !== false) {
  35237. element.setAttribute(prop, attributes[prop]);
  35238. } else {
  35239. element.removeAttribute(prop);
  35240. }
  35241. });
  35242. }
  35243. /**
  35244. * @function
  35245. * @memberof Modifiers
  35246. * @argument {Object} data - The data object generated by `update` method
  35247. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35248. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35249. * @argument {Object} options - Modifiers configuration and options
  35250. * @returns {Object} The same data object
  35251. */
  35252. function applyStyle(data) {
  35253. // any property present in `data.styles` will be applied to the popper,
  35254. // in this way we can make the 3rd party modifiers add custom styles to it
  35255. // Be aware, modifiers could override the properties defined in the previous
  35256. // lines of this modifier!
  35257. setStyles(data.instance.popper, data.styles);
  35258. // any property present in `data.attributes` will be applied to the popper,
  35259. // they will be set as HTML attributes of the element
  35260. setAttributes(data.instance.popper, data.attributes);
  35261. // if arrowElement is defined and arrowStyles has some properties
  35262. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35263. setStyles(data.arrowElement, data.arrowStyles);
  35264. }
  35265. return data;
  35266. }
  35267. /**
  35268. * Set the x-placement attribute before everything else because it could be used
  35269. * to add margins to the popper margins needs to be calculated to get the
  35270. * correct popper offsets.
  35271. * @method
  35272. * @memberof Popper.modifiers
  35273. * @param {HTMLElement} reference - The reference element used to position the popper
  35274. * @param {HTMLElement} popper - The HTML element used as popper
  35275. * @param {Object} options - Popper.js options
  35276. */
  35277. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35278. // compute reference element offsets
  35279. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35280. // compute auto placement, store placement inside the data object,
  35281. // modifiers will be able to edit `placement` if needed
  35282. // and refer to originalPlacement to know the original value
  35283. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35284. popper.setAttribute('x-placement', placement);
  35285. // Apply `position` to popper before anything else because
  35286. // without the position applied we can't guarantee correct computations
  35287. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35288. return options;
  35289. }
  35290. /**
  35291. * @function
  35292. * @memberof Popper.Utils
  35293. * @argument {Object} data - The data object generated by `update` method
  35294. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35295. * @returns {Object} The popper's position offsets rounded
  35296. *
  35297. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35298. * good as it can be within reason.
  35299. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35300. *
  35301. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35302. * as well on High DPI screens).
  35303. *
  35304. * Firefox prefers no rounding for positioning and does not have blurriness on
  35305. * high DPI screens.
  35306. *
  35307. * Only horizontal placement and left/right values need to be considered.
  35308. */
  35309. function getRoundedOffsets(data, shouldRound) {
  35310. var _data$offsets = data.offsets,
  35311. popper = _data$offsets.popper,
  35312. reference = _data$offsets.reference;
  35313. var round = Math.round,
  35314. floor = Math.floor;
  35315. var noRound = function noRound(v) {
  35316. return v;
  35317. };
  35318. var referenceWidth = round(reference.width);
  35319. var popperWidth = round(popper.width);
  35320. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35321. var isVariation = data.placement.indexOf('-') !== -1;
  35322. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35323. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35324. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35325. var verticalToInteger = !shouldRound ? noRound : round;
  35326. return {
  35327. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35328. top: verticalToInteger(popper.top),
  35329. bottom: verticalToInteger(popper.bottom),
  35330. right: horizontalToInteger(popper.right)
  35331. };
  35332. }
  35333. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35334. /**
  35335. * @function
  35336. * @memberof Modifiers
  35337. * @argument {Object} data - The data object generated by `update` method
  35338. * @argument {Object} options - Modifiers configuration and options
  35339. * @returns {Object} The data object, properly modified
  35340. */
  35341. function computeStyle(data, options) {
  35342. var x = options.x,
  35343. y = options.y;
  35344. var popper = data.offsets.popper;
  35345. // Remove this legacy support in Popper.js v2
  35346. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35347. return modifier.name === 'applyStyle';
  35348. }).gpuAcceleration;
  35349. if (legacyGpuAccelerationOption !== undefined) {
  35350. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35351. }
  35352. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35353. var offsetParent = getOffsetParent(data.instance.popper);
  35354. var offsetParentRect = getBoundingClientRect(offsetParent);
  35355. // Styles
  35356. var styles = {
  35357. position: popper.position
  35358. };
  35359. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35360. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35361. var sideB = y === 'right' ? 'left' : 'right';
  35362. // if gpuAcceleration is set to `true` and transform is supported,
  35363. // we use `translate3d` to apply the position to the popper we
  35364. // automatically use the supported prefixed version if needed
  35365. var prefixedProperty = getSupportedPropertyName('transform');
  35366. // now, let's make a step back and look at this code closely (wtf?)
  35367. // If the content of the popper grows once it's been positioned, it
  35368. // may happen that the popper gets misplaced because of the new content
  35369. // overflowing its reference element
  35370. // To avoid this problem, we provide two options (x and y), which allow
  35371. // the consumer to define the offset origin.
  35372. // If we position a popper on top of a reference element, we can set
  35373. // `x` to `top` to make the popper grow towards its top instead of
  35374. // its bottom.
  35375. var left = void 0,
  35376. top = void 0;
  35377. if (sideA === 'bottom') {
  35378. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35379. // and not the bottom of the html element
  35380. if (offsetParent.nodeName === 'HTML') {
  35381. top = -offsetParent.clientHeight + offsets.bottom;
  35382. } else {
  35383. top = -offsetParentRect.height + offsets.bottom;
  35384. }
  35385. } else {
  35386. top = offsets.top;
  35387. }
  35388. if (sideB === 'right') {
  35389. if (offsetParent.nodeName === 'HTML') {
  35390. left = -offsetParent.clientWidth + offsets.right;
  35391. } else {
  35392. left = -offsetParentRect.width + offsets.right;
  35393. }
  35394. } else {
  35395. left = offsets.left;
  35396. }
  35397. if (gpuAcceleration && prefixedProperty) {
  35398. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35399. styles[sideA] = 0;
  35400. styles[sideB] = 0;
  35401. styles.willChange = 'transform';
  35402. } else {
  35403. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35404. var invertTop = sideA === 'bottom' ? -1 : 1;
  35405. var invertLeft = sideB === 'right' ? -1 : 1;
  35406. styles[sideA] = top * invertTop;
  35407. styles[sideB] = left * invertLeft;
  35408. styles.willChange = sideA + ', ' + sideB;
  35409. }
  35410. // Attributes
  35411. var attributes = {
  35412. 'x-placement': data.placement
  35413. };
  35414. // Update `data` attributes, styles and arrowStyles
  35415. data.attributes = _extends({}, attributes, data.attributes);
  35416. data.styles = _extends({}, styles, data.styles);
  35417. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35418. return data;
  35419. }
  35420. /**
  35421. * Helper used to know if the given modifier depends from another one.<br />
  35422. * It checks if the needed modifier is listed and enabled.
  35423. * @method
  35424. * @memberof Popper.Utils
  35425. * @param {Array} modifiers - list of modifiers
  35426. * @param {String} requestingName - name of requesting modifier
  35427. * @param {String} requestedName - name of requested modifier
  35428. * @returns {Boolean}
  35429. */
  35430. function isModifierRequired(modifiers, requestingName, requestedName) {
  35431. var requesting = find(modifiers, function (_ref) {
  35432. var name = _ref.name;
  35433. return name === requestingName;
  35434. });
  35435. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35436. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35437. });
  35438. if (!isRequired) {
  35439. var _requesting = '`' + requestingName + '`';
  35440. var requested = '`' + requestedName + '`';
  35441. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35442. }
  35443. return isRequired;
  35444. }
  35445. /**
  35446. * @function
  35447. * @memberof Modifiers
  35448. * @argument {Object} data - The data object generated by update method
  35449. * @argument {Object} options - Modifiers configuration and options
  35450. * @returns {Object} The data object, properly modified
  35451. */
  35452. function arrow(data, options) {
  35453. var _data$offsets$arrow;
  35454. // arrow depends on keepTogether in order to work
  35455. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35456. return data;
  35457. }
  35458. var arrowElement = options.element;
  35459. // if arrowElement is a string, suppose it's a CSS selector
  35460. if (typeof arrowElement === 'string') {
  35461. arrowElement = data.instance.popper.querySelector(arrowElement);
  35462. // if arrowElement is not found, don't run the modifier
  35463. if (!arrowElement) {
  35464. return data;
  35465. }
  35466. } else {
  35467. // if the arrowElement isn't a query selector we must check that the
  35468. // provided DOM node is child of its popper node
  35469. if (!data.instance.popper.contains(arrowElement)) {
  35470. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35471. return data;
  35472. }
  35473. }
  35474. var placement = data.placement.split('-')[0];
  35475. var _data$offsets = data.offsets,
  35476. popper = _data$offsets.popper,
  35477. reference = _data$offsets.reference;
  35478. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35479. var len = isVertical ? 'height' : 'width';
  35480. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35481. var side = sideCapitalized.toLowerCase();
  35482. var altSide = isVertical ? 'left' : 'top';
  35483. var opSide = isVertical ? 'bottom' : 'right';
  35484. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35485. //
  35486. // extends keepTogether behavior making sure the popper and its
  35487. // reference have enough pixels in conjunction
  35488. //
  35489. // top/left side
  35490. if (reference[opSide] - arrowElementSize < popper[side]) {
  35491. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35492. }
  35493. // bottom/right side
  35494. if (reference[side] + arrowElementSize > popper[opSide]) {
  35495. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35496. }
  35497. data.offsets.popper = getClientRect(data.offsets.popper);
  35498. // compute center of the popper
  35499. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35500. // Compute the sideValue using the updated popper offsets
  35501. // take popper margin in account because we don't have this info available
  35502. var css = getStyleComputedProperty(data.instance.popper);
  35503. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35504. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35505. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35506. // prevent arrowElement from being placed not contiguously to its popper
  35507. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35508. data.arrowElement = arrowElement;
  35509. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35510. return data;
  35511. }
  35512. /**
  35513. * Get the opposite placement variation of the given one
  35514. * @method
  35515. * @memberof Popper.Utils
  35516. * @argument {String} placement variation
  35517. * @returns {String} flipped placement variation
  35518. */
  35519. function getOppositeVariation(variation) {
  35520. if (variation === 'end') {
  35521. return 'start';
  35522. } else if (variation === 'start') {
  35523. return 'end';
  35524. }
  35525. return variation;
  35526. }
  35527. /**
  35528. * List of accepted placements to use as values of the `placement` option.<br />
  35529. * Valid placements are:
  35530. * - `auto`
  35531. * - `top`
  35532. * - `right`
  35533. * - `bottom`
  35534. * - `left`
  35535. *
  35536. * Each placement can have a variation from this list:
  35537. * - `-start`
  35538. * - `-end`
  35539. *
  35540. * Variations are interpreted easily if you think of them as the left to right
  35541. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35542. * is right.<br />
  35543. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35544. *
  35545. * Some valid examples are:
  35546. * - `top-end` (on top of reference, right aligned)
  35547. * - `right-start` (on right of reference, top aligned)
  35548. * - `bottom` (on bottom, centered)
  35549. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35550. *
  35551. * @static
  35552. * @type {Array}
  35553. * @enum {String}
  35554. * @readonly
  35555. * @method placements
  35556. * @memberof Popper
  35557. */
  35558. 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'];
  35559. // Get rid of `auto` `auto-start` and `auto-end`
  35560. var validPlacements = placements.slice(3);
  35561. /**
  35562. * Given an initial placement, returns all the subsequent placements
  35563. * clockwise (or counter-clockwise).
  35564. *
  35565. * @method
  35566. * @memberof Popper.Utils
  35567. * @argument {String} placement - A valid placement (it accepts variations)
  35568. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35569. * @returns {Array} placements including their variations
  35570. */
  35571. function clockwise(placement) {
  35572. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35573. var index = validPlacements.indexOf(placement);
  35574. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35575. return counter ? arr.reverse() : arr;
  35576. }
  35577. var BEHAVIORS = {
  35578. FLIP: 'flip',
  35579. CLOCKWISE: 'clockwise',
  35580. COUNTERCLOCKWISE: 'counterclockwise'
  35581. };
  35582. /**
  35583. * @function
  35584. * @memberof Modifiers
  35585. * @argument {Object} data - The data object generated by update method
  35586. * @argument {Object} options - Modifiers configuration and options
  35587. * @returns {Object} The data object, properly modified
  35588. */
  35589. function flip(data, options) {
  35590. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35591. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35592. return data;
  35593. }
  35594. if (data.flipped && data.placement === data.originalPlacement) {
  35595. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35596. return data;
  35597. }
  35598. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35599. var placement = data.placement.split('-')[0];
  35600. var placementOpposite = getOppositePlacement(placement);
  35601. var variation = data.placement.split('-')[1] || '';
  35602. var flipOrder = [];
  35603. switch (options.behavior) {
  35604. case BEHAVIORS.FLIP:
  35605. flipOrder = [placement, placementOpposite];
  35606. break;
  35607. case BEHAVIORS.CLOCKWISE:
  35608. flipOrder = clockwise(placement);
  35609. break;
  35610. case BEHAVIORS.COUNTERCLOCKWISE:
  35611. flipOrder = clockwise(placement, true);
  35612. break;
  35613. default:
  35614. flipOrder = options.behavior;
  35615. }
  35616. flipOrder.forEach(function (step, index) {
  35617. if (placement !== step || flipOrder.length === index + 1) {
  35618. return data;
  35619. }
  35620. placement = data.placement.split('-')[0];
  35621. placementOpposite = getOppositePlacement(placement);
  35622. var popperOffsets = data.offsets.popper;
  35623. var refOffsets = data.offsets.reference;
  35624. // using floor because the reference offsets may contain decimals we are not going to consider here
  35625. var floor = Math.floor;
  35626. 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);
  35627. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35628. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35629. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35630. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35631. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35632. // flip the variation if required
  35633. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35634. // flips variation if reference element overflows boundaries
  35635. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35636. // flips variation if popper content overflows boundaries
  35637. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35638. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35639. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35640. // this boolean to detect any flip loop
  35641. data.flipped = true;
  35642. if (overlapsRef || overflowsBoundaries) {
  35643. placement = flipOrder[index + 1];
  35644. }
  35645. if (flippedVariation) {
  35646. variation = getOppositeVariation(variation);
  35647. }
  35648. data.placement = placement + (variation ? '-' + variation : '');
  35649. // this object contains `position`, we want to preserve it along with
  35650. // any additional property we may add in the future
  35651. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35652. data = runModifiers(data.instance.modifiers, data, 'flip');
  35653. }
  35654. });
  35655. return data;
  35656. }
  35657. /**
  35658. * @function
  35659. * @memberof Modifiers
  35660. * @argument {Object} data - The data object generated by update method
  35661. * @argument {Object} options - Modifiers configuration and options
  35662. * @returns {Object} The data object, properly modified
  35663. */
  35664. function keepTogether(data) {
  35665. var _data$offsets = data.offsets,
  35666. popper = _data$offsets.popper,
  35667. reference = _data$offsets.reference;
  35668. var placement = data.placement.split('-')[0];
  35669. var floor = Math.floor;
  35670. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35671. var side = isVertical ? 'right' : 'bottom';
  35672. var opSide = isVertical ? 'left' : 'top';
  35673. var measurement = isVertical ? 'width' : 'height';
  35674. if (popper[side] < floor(reference[opSide])) {
  35675. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35676. }
  35677. if (popper[opSide] > floor(reference[side])) {
  35678. data.offsets.popper[opSide] = floor(reference[side]);
  35679. }
  35680. return data;
  35681. }
  35682. /**
  35683. * Converts a string containing value + unit into a px value number
  35684. * @function
  35685. * @memberof {modifiers~offset}
  35686. * @private
  35687. * @argument {String} str - Value + unit string
  35688. * @argument {String} measurement - `height` or `width`
  35689. * @argument {Object} popperOffsets
  35690. * @argument {Object} referenceOffsets
  35691. * @returns {Number|String}
  35692. * Value in pixels, or original string if no values were extracted
  35693. */
  35694. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35695. // separate value from unit
  35696. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35697. var value = +split[1];
  35698. var unit = split[2];
  35699. // If it's not a number it's an operator, I guess
  35700. if (!value) {
  35701. return str;
  35702. }
  35703. if (unit.indexOf('%') === 0) {
  35704. var element = void 0;
  35705. switch (unit) {
  35706. case '%p':
  35707. element = popperOffsets;
  35708. break;
  35709. case '%':
  35710. case '%r':
  35711. default:
  35712. element = referenceOffsets;
  35713. }
  35714. var rect = getClientRect(element);
  35715. return rect[measurement] / 100 * value;
  35716. } else if (unit === 'vh' || unit === 'vw') {
  35717. // if is a vh or vw, we calculate the size based on the viewport
  35718. var size = void 0;
  35719. if (unit === 'vh') {
  35720. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35721. } else {
  35722. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35723. }
  35724. return size / 100 * value;
  35725. } else {
  35726. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35727. // if is an implicit unit, it's px, and we return just the value
  35728. return value;
  35729. }
  35730. }
  35731. /**
  35732. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35733. * @function
  35734. * @memberof {modifiers~offset}
  35735. * @private
  35736. * @argument {String} offset
  35737. * @argument {Object} popperOffsets
  35738. * @argument {Object} referenceOffsets
  35739. * @argument {String} basePlacement
  35740. * @returns {Array} a two cells array with x and y offsets in numbers
  35741. */
  35742. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35743. var offsets = [0, 0];
  35744. // Use height if placement is left or right and index is 0 otherwise use width
  35745. // in this way the first offset will use an axis and the second one
  35746. // will use the other one
  35747. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35748. // Split the offset string to obtain a list of values and operands
  35749. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35750. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35751. return frag.trim();
  35752. });
  35753. // Detect if the offset string contains a pair of values or a single one
  35754. // they could be separated by comma or space
  35755. var divider = fragments.indexOf(find(fragments, function (frag) {
  35756. return frag.search(/,|\s/) !== -1;
  35757. }));
  35758. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35759. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35760. }
  35761. // If divider is found, we divide the list of values and operands to divide
  35762. // them by ofset X and Y.
  35763. var splitRegex = /\s*,\s*|\s+/;
  35764. 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];
  35765. // Convert the values with units to absolute pixels to allow our computations
  35766. ops = ops.map(function (op, index) {
  35767. // Most of the units rely on the orientation of the popper
  35768. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35769. var mergeWithPrevious = false;
  35770. return op
  35771. // This aggregates any `+` or `-` sign that aren't considered operators
  35772. // e.g.: 10 + +5 => [10, +, +5]
  35773. .reduce(function (a, b) {
  35774. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35775. a[a.length - 1] = b;
  35776. mergeWithPrevious = true;
  35777. return a;
  35778. } else if (mergeWithPrevious) {
  35779. a[a.length - 1] += b;
  35780. mergeWithPrevious = false;
  35781. return a;
  35782. } else {
  35783. return a.concat(b);
  35784. }
  35785. }, [])
  35786. // Here we convert the string values into number values (in px)
  35787. .map(function (str) {
  35788. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35789. });
  35790. });
  35791. // Loop trough the offsets arrays and execute the operations
  35792. ops.forEach(function (op, index) {
  35793. op.forEach(function (frag, index2) {
  35794. if (isNumeric(frag)) {
  35795. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35796. }
  35797. });
  35798. });
  35799. return offsets;
  35800. }
  35801. /**
  35802. * @function
  35803. * @memberof Modifiers
  35804. * @argument {Object} data - The data object generated by update method
  35805. * @argument {Object} options - Modifiers configuration and options
  35806. * @argument {Number|String} options.offset=0
  35807. * The offset value as described in the modifier description
  35808. * @returns {Object} The data object, properly modified
  35809. */
  35810. function offset(data, _ref) {
  35811. var offset = _ref.offset;
  35812. var placement = data.placement,
  35813. _data$offsets = data.offsets,
  35814. popper = _data$offsets.popper,
  35815. reference = _data$offsets.reference;
  35816. var basePlacement = placement.split('-')[0];
  35817. var offsets = void 0;
  35818. if (isNumeric(+offset)) {
  35819. offsets = [+offset, 0];
  35820. } else {
  35821. offsets = parseOffset(offset, popper, reference, basePlacement);
  35822. }
  35823. if (basePlacement === 'left') {
  35824. popper.top += offsets[0];
  35825. popper.left -= offsets[1];
  35826. } else if (basePlacement === 'right') {
  35827. popper.top += offsets[0];
  35828. popper.left += offsets[1];
  35829. } else if (basePlacement === 'top') {
  35830. popper.left += offsets[0];
  35831. popper.top -= offsets[1];
  35832. } else if (basePlacement === 'bottom') {
  35833. popper.left += offsets[0];
  35834. popper.top += offsets[1];
  35835. }
  35836. data.popper = popper;
  35837. return data;
  35838. }
  35839. /**
  35840. * @function
  35841. * @memberof Modifiers
  35842. * @argument {Object} data - The data object generated by `update` method
  35843. * @argument {Object} options - Modifiers configuration and options
  35844. * @returns {Object} The data object, properly modified
  35845. */
  35846. function preventOverflow(data, options) {
  35847. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35848. // If offsetParent is the reference element, we really want to
  35849. // go one step up and use the next offsetParent as reference to
  35850. // avoid to make this modifier completely useless and look like broken
  35851. if (data.instance.reference === boundariesElement) {
  35852. boundariesElement = getOffsetParent(boundariesElement);
  35853. }
  35854. // NOTE: DOM access here
  35855. // resets the popper's position so that the document size can be calculated excluding
  35856. // the size of the popper element itself
  35857. var transformProp = getSupportedPropertyName('transform');
  35858. var popperStyles = data.instance.popper.style; // assignment to help minification
  35859. var top = popperStyles.top,
  35860. left = popperStyles.left,
  35861. transform = popperStyles[transformProp];
  35862. popperStyles.top = '';
  35863. popperStyles.left = '';
  35864. popperStyles[transformProp] = '';
  35865. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35866. // NOTE: DOM access here
  35867. // restores the original style properties after the offsets have been computed
  35868. popperStyles.top = top;
  35869. popperStyles.left = left;
  35870. popperStyles[transformProp] = transform;
  35871. options.boundaries = boundaries;
  35872. var order = options.priority;
  35873. var popper = data.offsets.popper;
  35874. var check = {
  35875. primary: function primary(placement) {
  35876. var value = popper[placement];
  35877. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35878. value = Math.max(popper[placement], boundaries[placement]);
  35879. }
  35880. return defineProperty({}, placement, value);
  35881. },
  35882. secondary: function secondary(placement) {
  35883. var mainSide = placement === 'right' ? 'left' : 'top';
  35884. var value = popper[mainSide];
  35885. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35886. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35887. }
  35888. return defineProperty({}, mainSide, value);
  35889. }
  35890. };
  35891. order.forEach(function (placement) {
  35892. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35893. popper = _extends({}, popper, check[side](placement));
  35894. });
  35895. data.offsets.popper = popper;
  35896. return data;
  35897. }
  35898. /**
  35899. * @function
  35900. * @memberof Modifiers
  35901. * @argument {Object} data - The data object generated by `update` method
  35902. * @argument {Object} options - Modifiers configuration and options
  35903. * @returns {Object} The data object, properly modified
  35904. */
  35905. function shift(data) {
  35906. var placement = data.placement;
  35907. var basePlacement = placement.split('-')[0];
  35908. var shiftvariation = placement.split('-')[1];
  35909. // if shift shiftvariation is specified, run the modifier
  35910. if (shiftvariation) {
  35911. var _data$offsets = data.offsets,
  35912. reference = _data$offsets.reference,
  35913. popper = _data$offsets.popper;
  35914. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  35915. var side = isVertical ? 'left' : 'top';
  35916. var measurement = isVertical ? 'width' : 'height';
  35917. var shiftOffsets = {
  35918. start: defineProperty({}, side, reference[side]),
  35919. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  35920. };
  35921. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  35922. }
  35923. return data;
  35924. }
  35925. /**
  35926. * @function
  35927. * @memberof Modifiers
  35928. * @argument {Object} data - The data object generated by update method
  35929. * @argument {Object} options - Modifiers configuration and options
  35930. * @returns {Object} The data object, properly modified
  35931. */
  35932. function hide(data) {
  35933. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  35934. return data;
  35935. }
  35936. var refRect = data.offsets.reference;
  35937. var bound = find(data.instance.modifiers, function (modifier) {
  35938. return modifier.name === 'preventOverflow';
  35939. }).boundaries;
  35940. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  35941. // Avoid unnecessary DOM access if visibility hasn't changed
  35942. if (data.hide === true) {
  35943. return data;
  35944. }
  35945. data.hide = true;
  35946. data.attributes['x-out-of-boundaries'] = '';
  35947. } else {
  35948. // Avoid unnecessary DOM access if visibility hasn't changed
  35949. if (data.hide === false) {
  35950. return data;
  35951. }
  35952. data.hide = false;
  35953. data.attributes['x-out-of-boundaries'] = false;
  35954. }
  35955. return data;
  35956. }
  35957. /**
  35958. * @function
  35959. * @memberof Modifiers
  35960. * @argument {Object} data - The data object generated by `update` method
  35961. * @argument {Object} options - Modifiers configuration and options
  35962. * @returns {Object} The data object, properly modified
  35963. */
  35964. function inner(data) {
  35965. var placement = data.placement;
  35966. var basePlacement = placement.split('-')[0];
  35967. var _data$offsets = data.offsets,
  35968. popper = _data$offsets.popper,
  35969. reference = _data$offsets.reference;
  35970. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  35971. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  35972. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  35973. data.placement = getOppositePlacement(placement);
  35974. data.offsets.popper = getClientRect(popper);
  35975. return data;
  35976. }
  35977. /**
  35978. * Modifier function, each modifier can have a function of this type assigned
  35979. * to its `fn` property.<br />
  35980. * These functions will be called on each update, this means that you must
  35981. * make sure they are performant enough to avoid performance bottlenecks.
  35982. *
  35983. * @function ModifierFn
  35984. * @argument {dataObject} data - The data object generated by `update` method
  35985. * @argument {Object} options - Modifiers configuration and options
  35986. * @returns {dataObject} The data object, properly modified
  35987. */
  35988. /**
  35989. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  35990. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  35991. * needed by the library.
  35992. *
  35993. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  35994. * All the other properties are configurations that could be tweaked.
  35995. * @namespace modifiers
  35996. */
  35997. var modifiers = {
  35998. /**
  35999. * Modifier used to shift the popper on the start or end of its reference
  36000. * element.<br />
  36001. * It will read the variation of the `placement` property.<br />
  36002. * It can be one either `-end` or `-start`.
  36003. * @memberof modifiers
  36004. * @inner
  36005. */
  36006. shift: {
  36007. /** @prop {number} order=100 - Index used to define the order of execution */
  36008. order: 100,
  36009. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36010. enabled: true,
  36011. /** @prop {ModifierFn} */
  36012. fn: shift
  36013. },
  36014. /**
  36015. * The `offset` modifier can shift your popper on both its axis.
  36016. *
  36017. * It accepts the following units:
  36018. * - `px` or unit-less, interpreted as pixels
  36019. * - `%` or `%r`, percentage relative to the length of the reference element
  36020. * - `%p`, percentage relative to the length of the popper element
  36021. * - `vw`, CSS viewport width unit
  36022. * - `vh`, CSS viewport height unit
  36023. *
  36024. * For length is intended the main axis relative to the placement of the popper.<br />
  36025. * This means that if the placement is `top` or `bottom`, the length will be the
  36026. * `width`. In case of `left` or `right`, it will be the `height`.
  36027. *
  36028. * You can provide a single value (as `Number` or `String`), or a pair of values
  36029. * as `String` divided by a comma or one (or more) white spaces.<br />
  36030. * The latter is a deprecated method because it leads to confusion and will be
  36031. * removed in v2.<br />
  36032. * Additionally, it accepts additions and subtractions between different units.
  36033. * Note that multiplications and divisions aren't supported.
  36034. *
  36035. * Valid examples are:
  36036. * ```
  36037. * 10
  36038. * '10%'
  36039. * '10, 10'
  36040. * '10%, 10'
  36041. * '10 + 10%'
  36042. * '10 - 5vh + 3%'
  36043. * '-10px + 5vh, 5px - 6%'
  36044. * ```
  36045. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36046. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36047. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36048. *
  36049. * @memberof modifiers
  36050. * @inner
  36051. */
  36052. offset: {
  36053. /** @prop {number} order=200 - Index used to define the order of execution */
  36054. order: 200,
  36055. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36056. enabled: true,
  36057. /** @prop {ModifierFn} */
  36058. fn: offset,
  36059. /** @prop {Number|String} offset=0
  36060. * The offset value as described in the modifier description
  36061. */
  36062. offset: 0
  36063. },
  36064. /**
  36065. * Modifier used to prevent the popper from being positioned outside the boundary.
  36066. *
  36067. * A scenario exists where the reference itself is not within the boundaries.<br />
  36068. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36069. * In this case we need to decide whether the popper should either:
  36070. *
  36071. * - detach from the reference and remain "trapped" in the boundaries, or
  36072. * - if it should ignore the boundary and "escape with its reference"
  36073. *
  36074. * When `escapeWithReference` is set to`true` and reference is completely
  36075. * outside its boundaries, the popper will overflow (or completely leave)
  36076. * the boundaries in order to remain attached to the edge of the reference.
  36077. *
  36078. * @memberof modifiers
  36079. * @inner
  36080. */
  36081. preventOverflow: {
  36082. /** @prop {number} order=300 - Index used to define the order of execution */
  36083. order: 300,
  36084. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36085. enabled: true,
  36086. /** @prop {ModifierFn} */
  36087. fn: preventOverflow,
  36088. /**
  36089. * @prop {Array} [priority=['left','right','top','bottom']]
  36090. * Popper will try to prevent overflow following these priorities by default,
  36091. * then, it could overflow on the left and on top of the `boundariesElement`
  36092. */
  36093. priority: ['left', 'right', 'top', 'bottom'],
  36094. /**
  36095. * @prop {number} padding=5
  36096. * Amount of pixel used to define a minimum distance between the boundaries
  36097. * and the popper. This makes sure the popper always has a little padding
  36098. * between the edges of its container
  36099. */
  36100. padding: 5,
  36101. /**
  36102. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36103. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36104. * `viewport` or any DOM element.
  36105. */
  36106. boundariesElement: 'scrollParent'
  36107. },
  36108. /**
  36109. * Modifier used to make sure the reference and its popper stay near each other
  36110. * without leaving any gap between the two. Especially useful when the arrow is
  36111. * enabled and you want to ensure that it points to its reference element.
  36112. * It cares only about the first axis. You can still have poppers with margin
  36113. * between the popper and its reference element.
  36114. * @memberof modifiers
  36115. * @inner
  36116. */
  36117. keepTogether: {
  36118. /** @prop {number} order=400 - Index used to define the order of execution */
  36119. order: 400,
  36120. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36121. enabled: true,
  36122. /** @prop {ModifierFn} */
  36123. fn: keepTogether
  36124. },
  36125. /**
  36126. * This modifier is used to move the `arrowElement` of the popper to make
  36127. * sure it is positioned between the reference element and its popper element.
  36128. * It will read the outer size of the `arrowElement` node to detect how many
  36129. * pixels of conjunction are needed.
  36130. *
  36131. * It has no effect if no `arrowElement` is provided.
  36132. * @memberof modifiers
  36133. * @inner
  36134. */
  36135. arrow: {
  36136. /** @prop {number} order=500 - Index used to define the order of execution */
  36137. order: 500,
  36138. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36139. enabled: true,
  36140. /** @prop {ModifierFn} */
  36141. fn: arrow,
  36142. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36143. element: '[x-arrow]'
  36144. },
  36145. /**
  36146. * Modifier used to flip the popper's placement when it starts to overlap its
  36147. * reference element.
  36148. *
  36149. * Requires the `preventOverflow` modifier before it in order to work.
  36150. *
  36151. * **NOTE:** this modifier will interrupt the current update cycle and will
  36152. * restart it if it detects the need to flip the placement.
  36153. * @memberof modifiers
  36154. * @inner
  36155. */
  36156. flip: {
  36157. /** @prop {number} order=600 - Index used to define the order of execution */
  36158. order: 600,
  36159. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36160. enabled: true,
  36161. /** @prop {ModifierFn} */
  36162. fn: flip,
  36163. /**
  36164. * @prop {String|Array} behavior='flip'
  36165. * The behavior used to change the popper's placement. It can be one of
  36166. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36167. * placements (with optional variations)
  36168. */
  36169. behavior: 'flip',
  36170. /**
  36171. * @prop {number} padding=5
  36172. * The popper will flip if it hits the edges of the `boundariesElement`
  36173. */
  36174. padding: 5,
  36175. /**
  36176. * @prop {String|HTMLElement} boundariesElement='viewport'
  36177. * The element which will define the boundaries of the popper position.
  36178. * The popper will never be placed outside of the defined boundaries
  36179. * (except if `keepTogether` is enabled)
  36180. */
  36181. boundariesElement: 'viewport',
  36182. /**
  36183. * @prop {Boolean} flipVariations=false
  36184. * The popper will switch placement variation between `-start` and `-end` when
  36185. * the reference element overlaps its boundaries.
  36186. *
  36187. * The original placement should have a set variation.
  36188. */
  36189. flipVariations: false,
  36190. /**
  36191. * @prop {Boolean} flipVariationsByContent=false
  36192. * The popper will switch placement variation between `-start` and `-end` when
  36193. * the popper element overlaps its reference boundaries.
  36194. *
  36195. * The original placement should have a set variation.
  36196. */
  36197. flipVariationsByContent: false
  36198. },
  36199. /**
  36200. * Modifier used to make the popper flow toward the inner of the reference element.
  36201. * By default, when this modifier is disabled, the popper will be placed outside
  36202. * the reference element.
  36203. * @memberof modifiers
  36204. * @inner
  36205. */
  36206. inner: {
  36207. /** @prop {number} order=700 - Index used to define the order of execution */
  36208. order: 700,
  36209. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36210. enabled: false,
  36211. /** @prop {ModifierFn} */
  36212. fn: inner
  36213. },
  36214. /**
  36215. * Modifier used to hide the popper when its reference element is outside of the
  36216. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36217. * be used to hide with a CSS selector the popper when its reference is
  36218. * out of boundaries.
  36219. *
  36220. * Requires the `preventOverflow` modifier before it in order to work.
  36221. * @memberof modifiers
  36222. * @inner
  36223. */
  36224. hide: {
  36225. /** @prop {number} order=800 - Index used to define the order of execution */
  36226. order: 800,
  36227. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36228. enabled: true,
  36229. /** @prop {ModifierFn} */
  36230. fn: hide
  36231. },
  36232. /**
  36233. * Computes the style that will be applied to the popper element to gets
  36234. * properly positioned.
  36235. *
  36236. * Note that this modifier will not touch the DOM, it just prepares the styles
  36237. * so that `applyStyle` modifier can apply it. This separation is useful
  36238. * in case you need to replace `applyStyle` with a custom implementation.
  36239. *
  36240. * This modifier has `850` as `order` value to maintain backward compatibility
  36241. * with previous versions of Popper.js. Expect the modifiers ordering method
  36242. * to change in future major versions of the library.
  36243. *
  36244. * @memberof modifiers
  36245. * @inner
  36246. */
  36247. computeStyle: {
  36248. /** @prop {number} order=850 - Index used to define the order of execution */
  36249. order: 850,
  36250. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36251. enabled: true,
  36252. /** @prop {ModifierFn} */
  36253. fn: computeStyle,
  36254. /**
  36255. * @prop {Boolean} gpuAcceleration=true
  36256. * If true, it uses the CSS 3D transformation to position the popper.
  36257. * Otherwise, it will use the `top` and `left` properties
  36258. */
  36259. gpuAcceleration: true,
  36260. /**
  36261. * @prop {string} [x='bottom']
  36262. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36263. * Change this if your popper should grow in a direction different from `bottom`
  36264. */
  36265. x: 'bottom',
  36266. /**
  36267. * @prop {string} [x='left']
  36268. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36269. * Change this if your popper should grow in a direction different from `right`
  36270. */
  36271. y: 'right'
  36272. },
  36273. /**
  36274. * Applies the computed styles to the popper element.
  36275. *
  36276. * All the DOM manipulations are limited to this modifier. This is useful in case
  36277. * you want to integrate Popper.js inside a framework or view library and you
  36278. * want to delegate all the DOM manipulations to it.
  36279. *
  36280. * Note that if you disable this modifier, you must make sure the popper element
  36281. * has its position set to `absolute` before Popper.js can do its work!
  36282. *
  36283. * Just disable this modifier and define your own to achieve the desired effect.
  36284. *
  36285. * @memberof modifiers
  36286. * @inner
  36287. */
  36288. applyStyle: {
  36289. /** @prop {number} order=900 - Index used to define the order of execution */
  36290. order: 900,
  36291. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36292. enabled: true,
  36293. /** @prop {ModifierFn} */
  36294. fn: applyStyle,
  36295. /** @prop {Function} */
  36296. onLoad: applyStyleOnLoad,
  36297. /**
  36298. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36299. * @prop {Boolean} gpuAcceleration=true
  36300. * If true, it uses the CSS 3D transformation to position the popper.
  36301. * Otherwise, it will use the `top` and `left` properties
  36302. */
  36303. gpuAcceleration: undefined
  36304. }
  36305. };
  36306. /**
  36307. * The `dataObject` is an object containing all the information used by Popper.js.
  36308. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36309. * @name dataObject
  36310. * @property {Object} data.instance The Popper.js instance
  36311. * @property {String} data.placement Placement applied to popper
  36312. * @property {String} data.originalPlacement Placement originally defined on init
  36313. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36314. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36315. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36316. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36317. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36318. * @property {Object} data.boundaries Offsets of the popper boundaries
  36319. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36320. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36321. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36322. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36323. */
  36324. /**
  36325. * Default options provided to Popper.js constructor.<br />
  36326. * These can be overridden using the `options` argument of Popper.js.<br />
  36327. * To override an option, simply pass an object with the same
  36328. * structure of the `options` object, as the 3rd argument. For example:
  36329. * ```
  36330. * new Popper(ref, pop, {
  36331. * modifiers: {
  36332. * preventOverflow: { enabled: false }
  36333. * }
  36334. * })
  36335. * ```
  36336. * @type {Object}
  36337. * @static
  36338. * @memberof Popper
  36339. */
  36340. var Defaults = {
  36341. /**
  36342. * Popper's placement.
  36343. * @prop {Popper.placements} placement='bottom'
  36344. */
  36345. placement: 'bottom',
  36346. /**
  36347. * Set this to true if you want popper to position it self in 'fixed' mode
  36348. * @prop {Boolean} positionFixed=false
  36349. */
  36350. positionFixed: false,
  36351. /**
  36352. * Whether events (resize, scroll) are initially enabled.
  36353. * @prop {Boolean} eventsEnabled=true
  36354. */
  36355. eventsEnabled: true,
  36356. /**
  36357. * Set to true if you want to automatically remove the popper when
  36358. * you call the `destroy` method.
  36359. * @prop {Boolean} removeOnDestroy=false
  36360. */
  36361. removeOnDestroy: false,
  36362. /**
  36363. * Callback called when the popper is created.<br />
  36364. * By default, it is set to no-op.<br />
  36365. * Access Popper.js instance with `data.instance`.
  36366. * @prop {onCreate}
  36367. */
  36368. onCreate: function onCreate() {},
  36369. /**
  36370. * Callback called when the popper is updated. This callback is not called
  36371. * on the initialization/creation of the popper, but only on subsequent
  36372. * updates.<br />
  36373. * By default, it is set to no-op.<br />
  36374. * Access Popper.js instance with `data.instance`.
  36375. * @prop {onUpdate}
  36376. */
  36377. onUpdate: function onUpdate() {},
  36378. /**
  36379. * List of modifiers used to modify the offsets before they are applied to the popper.
  36380. * They provide most of the functionalities of Popper.js.
  36381. * @prop {modifiers}
  36382. */
  36383. modifiers: modifiers
  36384. };
  36385. /**
  36386. * @callback onCreate
  36387. * @param {dataObject} data
  36388. */
  36389. /**
  36390. * @callback onUpdate
  36391. * @param {dataObject} data
  36392. */
  36393. // Utils
  36394. // Methods
  36395. var Popper = function () {
  36396. /**
  36397. * Creates a new Popper.js instance.
  36398. * @class Popper
  36399. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36400. * @param {Element} popper - The HTML / XML element used as the popper
  36401. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36402. * @return {Object} instance - The generated Popper.js instance
  36403. */
  36404. function Popper(reference, popper) {
  36405. var _this = this;
  36406. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36407. classCallCheck(this, Popper);
  36408. this.scheduleUpdate = function () {
  36409. return requestAnimationFrame(_this.update);
  36410. };
  36411. // make update() debounced, so that it only runs at most once-per-tick
  36412. this.update = debounce(this.update.bind(this));
  36413. // with {} we create a new object with the options inside it
  36414. this.options = _extends({}, Popper.Defaults, options);
  36415. // init state
  36416. this.state = {
  36417. isDestroyed: false,
  36418. isCreated: false,
  36419. scrollParents: []
  36420. };
  36421. // get reference and popper elements (allow jQuery wrappers)
  36422. this.reference = reference && reference.jquery ? reference[0] : reference;
  36423. this.popper = popper && popper.jquery ? popper[0] : popper;
  36424. // Deep merge modifiers options
  36425. this.options.modifiers = {};
  36426. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36427. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36428. });
  36429. // Refactoring modifiers' list (Object => Array)
  36430. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36431. return _extends({
  36432. name: name
  36433. }, _this.options.modifiers[name]);
  36434. })
  36435. // sort the modifiers by order
  36436. .sort(function (a, b) {
  36437. return a.order - b.order;
  36438. });
  36439. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36440. // such code is executed in the same order of its modifier
  36441. // they could add new properties to their options configuration
  36442. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36443. this.modifiers.forEach(function (modifierOptions) {
  36444. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36445. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36446. }
  36447. });
  36448. // fire the first update to position the popper in the right place
  36449. this.update();
  36450. var eventsEnabled = this.options.eventsEnabled;
  36451. if (eventsEnabled) {
  36452. // setup event listeners, they will take care of update the position in specific situations
  36453. this.enableEventListeners();
  36454. }
  36455. this.state.eventsEnabled = eventsEnabled;
  36456. }
  36457. // We can't use class properties because they don't get listed in the
  36458. // class prototype and break stuff like Sinon stubs
  36459. createClass(Popper, [{
  36460. key: 'update',
  36461. value: function update$$1() {
  36462. return update.call(this);
  36463. }
  36464. }, {
  36465. key: 'destroy',
  36466. value: function destroy$$1() {
  36467. return destroy.call(this);
  36468. }
  36469. }, {
  36470. key: 'enableEventListeners',
  36471. value: function enableEventListeners$$1() {
  36472. return enableEventListeners.call(this);
  36473. }
  36474. }, {
  36475. key: 'disableEventListeners',
  36476. value: function disableEventListeners$$1() {
  36477. return disableEventListeners.call(this);
  36478. }
  36479. /**
  36480. * Schedules an update. It will run on the next UI update available.
  36481. * @method scheduleUpdate
  36482. * @memberof Popper
  36483. */
  36484. /**
  36485. * Collection of utilities useful when writing custom modifiers.
  36486. * Starting from version 1.7, this method is available only if you
  36487. * include `popper-utils.js` before `popper.js`.
  36488. *
  36489. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36490. * and will be removed in v2! Use the PopperUtils module directly instead.
  36491. * Due to the high instability of the methods contained in Utils, we can't
  36492. * guarantee them to follow semver. Use them at your own risk!
  36493. * @static
  36494. * @private
  36495. * @type {Object}
  36496. * @deprecated since version 1.8
  36497. * @member Utils
  36498. * @memberof Popper
  36499. */
  36500. }]);
  36501. return Popper;
  36502. }();
  36503. /**
  36504. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36505. * and lets you use it as replacement of a real DOM node.<br />
  36506. * You can use this method to position a popper relatively to a set of coordinates
  36507. * in case you don't have a DOM node to use as reference.
  36508. *
  36509. * ```
  36510. * new Popper(referenceObject, popperNode);
  36511. * ```
  36512. *
  36513. * NB: This feature isn't supported in Internet Explorer 10.
  36514. * @name referenceObject
  36515. * @property {Function} data.getBoundingClientRect
  36516. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36517. * @property {number} data.clientWidth
  36518. * An ES6 getter that will return the width of the virtual reference element.
  36519. * @property {number} data.clientHeight
  36520. * An ES6 getter that will return the height of the virtual reference element.
  36521. */
  36522. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36523. Popper.placements = placements;
  36524. Popper.Defaults = Defaults;
  36525. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36526. //# sourceMappingURL=popper.js.map
  36527. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36528. /***/ }),
  36529. /***/ "./node_modules/process/browser.js":
  36530. /*!*****************************************!*\
  36531. !*** ./node_modules/process/browser.js ***!
  36532. \*****************************************/
  36533. /*! no static exports found */
  36534. /***/ (function(module, exports) {
  36535. // shim for using process in browser
  36536. var process = module.exports = {};
  36537. // cached from whatever global is present so that test runners that stub it
  36538. // don't break things. But we need to wrap it in a try catch in case it is
  36539. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36540. // function because try/catches deoptimize in certain engines.
  36541. var cachedSetTimeout;
  36542. var cachedClearTimeout;
  36543. function defaultSetTimout() {
  36544. throw new Error('setTimeout has not been defined');
  36545. }
  36546. function defaultClearTimeout () {
  36547. throw new Error('clearTimeout has not been defined');
  36548. }
  36549. (function () {
  36550. try {
  36551. if (typeof setTimeout === 'function') {
  36552. cachedSetTimeout = setTimeout;
  36553. } else {
  36554. cachedSetTimeout = defaultSetTimout;
  36555. }
  36556. } catch (e) {
  36557. cachedSetTimeout = defaultSetTimout;
  36558. }
  36559. try {
  36560. if (typeof clearTimeout === 'function') {
  36561. cachedClearTimeout = clearTimeout;
  36562. } else {
  36563. cachedClearTimeout = defaultClearTimeout;
  36564. }
  36565. } catch (e) {
  36566. cachedClearTimeout = defaultClearTimeout;
  36567. }
  36568. } ())
  36569. function runTimeout(fun) {
  36570. if (cachedSetTimeout === setTimeout) {
  36571. //normal enviroments in sane situations
  36572. return setTimeout(fun, 0);
  36573. }
  36574. // if setTimeout wasn't available but was latter defined
  36575. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36576. cachedSetTimeout = setTimeout;
  36577. return setTimeout(fun, 0);
  36578. }
  36579. try {
  36580. // when when somebody has screwed with setTimeout but no I.E. maddness
  36581. return cachedSetTimeout(fun, 0);
  36582. } catch(e){
  36583. try {
  36584. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36585. return cachedSetTimeout.call(null, fun, 0);
  36586. } catch(e){
  36587. // 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
  36588. return cachedSetTimeout.call(this, fun, 0);
  36589. }
  36590. }
  36591. }
  36592. function runClearTimeout(marker) {
  36593. if (cachedClearTimeout === clearTimeout) {
  36594. //normal enviroments in sane situations
  36595. return clearTimeout(marker);
  36596. }
  36597. // if clearTimeout wasn't available but was latter defined
  36598. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36599. cachedClearTimeout = clearTimeout;
  36600. return clearTimeout(marker);
  36601. }
  36602. try {
  36603. // when when somebody has screwed with setTimeout but no I.E. maddness
  36604. return cachedClearTimeout(marker);
  36605. } catch (e){
  36606. try {
  36607. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36608. return cachedClearTimeout.call(null, marker);
  36609. } catch (e){
  36610. // 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.
  36611. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36612. return cachedClearTimeout.call(this, marker);
  36613. }
  36614. }
  36615. }
  36616. var queue = [];
  36617. var draining = false;
  36618. var currentQueue;
  36619. var queueIndex = -1;
  36620. function cleanUpNextTick() {
  36621. if (!draining || !currentQueue) {
  36622. return;
  36623. }
  36624. draining = false;
  36625. if (currentQueue.length) {
  36626. queue = currentQueue.concat(queue);
  36627. } else {
  36628. queueIndex = -1;
  36629. }
  36630. if (queue.length) {
  36631. drainQueue();
  36632. }
  36633. }
  36634. function drainQueue() {
  36635. if (draining) {
  36636. return;
  36637. }
  36638. var timeout = runTimeout(cleanUpNextTick);
  36639. draining = true;
  36640. var len = queue.length;
  36641. while(len) {
  36642. currentQueue = queue;
  36643. queue = [];
  36644. while (++queueIndex < len) {
  36645. if (currentQueue) {
  36646. currentQueue[queueIndex].run();
  36647. }
  36648. }
  36649. queueIndex = -1;
  36650. len = queue.length;
  36651. }
  36652. currentQueue = null;
  36653. draining = false;
  36654. runClearTimeout(timeout);
  36655. }
  36656. process.nextTick = function (fun) {
  36657. var args = new Array(arguments.length - 1);
  36658. if (arguments.length > 1) {
  36659. for (var i = 1; i < arguments.length; i++) {
  36660. args[i - 1] = arguments[i];
  36661. }
  36662. }
  36663. queue.push(new Item(fun, args));
  36664. if (queue.length === 1 && !draining) {
  36665. runTimeout(drainQueue);
  36666. }
  36667. };
  36668. // v8 likes predictible objects
  36669. function Item(fun, array) {
  36670. this.fun = fun;
  36671. this.array = array;
  36672. }
  36673. Item.prototype.run = function () {
  36674. this.fun.apply(null, this.array);
  36675. };
  36676. process.title = 'browser';
  36677. process.browser = true;
  36678. process.env = {};
  36679. process.argv = [];
  36680. process.version = ''; // empty string to avoid regexp issues
  36681. process.versions = {};
  36682. function noop() {}
  36683. process.on = noop;
  36684. process.addListener = noop;
  36685. process.once = noop;
  36686. process.off = noop;
  36687. process.removeListener = noop;
  36688. process.removeAllListeners = noop;
  36689. process.emit = noop;
  36690. process.prependListener = noop;
  36691. process.prependOnceListener = noop;
  36692. process.listeners = function (name) { return [] }
  36693. process.binding = function (name) {
  36694. throw new Error('process.binding is not supported');
  36695. };
  36696. process.cwd = function () { return '/' };
  36697. process.chdir = function (dir) {
  36698. throw new Error('process.chdir is not supported');
  36699. };
  36700. process.umask = function() { return 0; };
  36701. /***/ }),
  36702. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36703. /*!***************************************************!*\
  36704. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36705. \***************************************************/
  36706. /*! no static exports found */
  36707. /***/ (function(module, exports, __webpack_require__) {
  36708. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36709. * Pusher JavaScript Library v5.0.3
  36710. * https://pusher.com/
  36711. *
  36712. * Copyright 2017, Pusher
  36713. * Released under the MIT licence.
  36714. */
  36715. (function webpackUniversalModuleDefinition(root, factory) {
  36716. if(true)
  36717. module.exports = factory();
  36718. else {}
  36719. })(window, function() {
  36720. return /******/ (function(modules) { // webpackBootstrap
  36721. /******/ // The module cache
  36722. /******/ var installedModules = {};
  36723. /******/
  36724. /******/ // The require function
  36725. /******/ function __webpack_require__(moduleId) {
  36726. /******/
  36727. /******/ // Check if module is in cache
  36728. /******/ if(installedModules[moduleId]) {
  36729. /******/ return installedModules[moduleId].exports;
  36730. /******/ }
  36731. /******/ // Create a new module (and put it into the cache)
  36732. /******/ var module = installedModules[moduleId] = {
  36733. /******/ i: moduleId,
  36734. /******/ l: false,
  36735. /******/ exports: {}
  36736. /******/ };
  36737. /******/
  36738. /******/ // Execute the module function
  36739. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36740. /******/
  36741. /******/ // Flag the module as loaded
  36742. /******/ module.l = true;
  36743. /******/
  36744. /******/ // Return the exports of the module
  36745. /******/ return module.exports;
  36746. /******/ }
  36747. /******/
  36748. /******/
  36749. /******/ // expose the modules object (__webpack_modules__)
  36750. /******/ __webpack_require__.m = modules;
  36751. /******/
  36752. /******/ // expose the module cache
  36753. /******/ __webpack_require__.c = installedModules;
  36754. /******/
  36755. /******/ // define getter function for harmony exports
  36756. /******/ __webpack_require__.d = function(exports, name, getter) {
  36757. /******/ if(!__webpack_require__.o(exports, name)) {
  36758. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36759. /******/ }
  36760. /******/ };
  36761. /******/
  36762. /******/ // define __esModule on exports
  36763. /******/ __webpack_require__.r = function(exports) {
  36764. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36765. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36766. /******/ }
  36767. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36768. /******/ };
  36769. /******/
  36770. /******/ // create a fake namespace object
  36771. /******/ // mode & 1: value is a module id, require it
  36772. /******/ // mode & 2: merge all properties of value into the ns
  36773. /******/ // mode & 4: return value when already ns object
  36774. /******/ // mode & 8|1: behave like require
  36775. /******/ __webpack_require__.t = function(value, mode) {
  36776. /******/ if(mode & 1) value = __webpack_require__(value);
  36777. /******/ if(mode & 8) return value;
  36778. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36779. /******/ var ns = Object.create(null);
  36780. /******/ __webpack_require__.r(ns);
  36781. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36782. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36783. /******/ return ns;
  36784. /******/ };
  36785. /******/
  36786. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36787. /******/ __webpack_require__.n = function(module) {
  36788. /******/ var getter = module && module.__esModule ?
  36789. /******/ function getDefault() { return module['default']; } :
  36790. /******/ function getModuleExports() { return module; };
  36791. /******/ __webpack_require__.d(getter, 'a', getter);
  36792. /******/ return getter;
  36793. /******/ };
  36794. /******/
  36795. /******/ // Object.prototype.hasOwnProperty.call
  36796. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36797. /******/
  36798. /******/ // __webpack_public_path__
  36799. /******/ __webpack_require__.p = "";
  36800. /******/
  36801. /******/
  36802. /******/ // Load entry module and return exports
  36803. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36804. /******/ })
  36805. /************************************************************************/
  36806. /******/ ([
  36807. /* 0 */
  36808. /***/ (function(module, exports, __webpack_require__) {
  36809. (function(nacl) {
  36810. 'use strict';
  36811. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36812. // Public domain.
  36813. //
  36814. // Implementation derived from TweetNaCl version 20140427.
  36815. // See for details: http://tweetnacl.cr.yp.to/
  36816. var gf = function(init) {
  36817. var i, r = new Float64Array(16);
  36818. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36819. return r;
  36820. };
  36821. // Pluggable, initialized in high-level API below.
  36822. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36823. var _0 = new Uint8Array(16);
  36824. var _9 = new Uint8Array(32); _9[0] = 9;
  36825. var gf0 = gf(),
  36826. gf1 = gf([1]),
  36827. _121665 = gf([0xdb41, 1]),
  36828. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36829. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36830. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36831. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36832. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36833. function ts64(x, i, h, l) {
  36834. x[i] = (h >> 24) & 0xff;
  36835. x[i+1] = (h >> 16) & 0xff;
  36836. x[i+2] = (h >> 8) & 0xff;
  36837. x[i+3] = h & 0xff;
  36838. x[i+4] = (l >> 24) & 0xff;
  36839. x[i+5] = (l >> 16) & 0xff;
  36840. x[i+6] = (l >> 8) & 0xff;
  36841. x[i+7] = l & 0xff;
  36842. }
  36843. function vn(x, xi, y, yi, n) {
  36844. var i,d = 0;
  36845. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36846. return (1 & ((d - 1) >>> 8)) - 1;
  36847. }
  36848. function crypto_verify_16(x, xi, y, yi) {
  36849. return vn(x,xi,y,yi,16);
  36850. }
  36851. function crypto_verify_32(x, xi, y, yi) {
  36852. return vn(x,xi,y,yi,32);
  36853. }
  36854. function core_salsa20(o, p, k, c) {
  36855. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36856. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36857. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36858. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36859. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36860. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36861. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36862. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36863. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36864. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36865. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36866. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36867. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36868. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36869. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36870. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36871. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36872. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36873. x15 = j15, u;
  36874. for (var i = 0; i < 20; i += 2) {
  36875. u = x0 + x12 | 0;
  36876. x4 ^= u<<7 | u>>>(32-7);
  36877. u = x4 + x0 | 0;
  36878. x8 ^= u<<9 | u>>>(32-9);
  36879. u = x8 + x4 | 0;
  36880. x12 ^= u<<13 | u>>>(32-13);
  36881. u = x12 + x8 | 0;
  36882. x0 ^= u<<18 | u>>>(32-18);
  36883. u = x5 + x1 | 0;
  36884. x9 ^= u<<7 | u>>>(32-7);
  36885. u = x9 + x5 | 0;
  36886. x13 ^= u<<9 | u>>>(32-9);
  36887. u = x13 + x9 | 0;
  36888. x1 ^= u<<13 | u>>>(32-13);
  36889. u = x1 + x13 | 0;
  36890. x5 ^= u<<18 | u>>>(32-18);
  36891. u = x10 + x6 | 0;
  36892. x14 ^= u<<7 | u>>>(32-7);
  36893. u = x14 + x10 | 0;
  36894. x2 ^= u<<9 | u>>>(32-9);
  36895. u = x2 + x14 | 0;
  36896. x6 ^= u<<13 | u>>>(32-13);
  36897. u = x6 + x2 | 0;
  36898. x10 ^= u<<18 | u>>>(32-18);
  36899. u = x15 + x11 | 0;
  36900. x3 ^= u<<7 | u>>>(32-7);
  36901. u = x3 + x15 | 0;
  36902. x7 ^= u<<9 | u>>>(32-9);
  36903. u = x7 + x3 | 0;
  36904. x11 ^= u<<13 | u>>>(32-13);
  36905. u = x11 + x7 | 0;
  36906. x15 ^= u<<18 | u>>>(32-18);
  36907. u = x0 + x3 | 0;
  36908. x1 ^= u<<7 | u>>>(32-7);
  36909. u = x1 + x0 | 0;
  36910. x2 ^= u<<9 | u>>>(32-9);
  36911. u = x2 + x1 | 0;
  36912. x3 ^= u<<13 | u>>>(32-13);
  36913. u = x3 + x2 | 0;
  36914. x0 ^= u<<18 | u>>>(32-18);
  36915. u = x5 + x4 | 0;
  36916. x6 ^= u<<7 | u>>>(32-7);
  36917. u = x6 + x5 | 0;
  36918. x7 ^= u<<9 | u>>>(32-9);
  36919. u = x7 + x6 | 0;
  36920. x4 ^= u<<13 | u>>>(32-13);
  36921. u = x4 + x7 | 0;
  36922. x5 ^= u<<18 | u>>>(32-18);
  36923. u = x10 + x9 | 0;
  36924. x11 ^= u<<7 | u>>>(32-7);
  36925. u = x11 + x10 | 0;
  36926. x8 ^= u<<9 | u>>>(32-9);
  36927. u = x8 + x11 | 0;
  36928. x9 ^= u<<13 | u>>>(32-13);
  36929. u = x9 + x8 | 0;
  36930. x10 ^= u<<18 | u>>>(32-18);
  36931. u = x15 + x14 | 0;
  36932. x12 ^= u<<7 | u>>>(32-7);
  36933. u = x12 + x15 | 0;
  36934. x13 ^= u<<9 | u>>>(32-9);
  36935. u = x13 + x12 | 0;
  36936. x14 ^= u<<13 | u>>>(32-13);
  36937. u = x14 + x13 | 0;
  36938. x15 ^= u<<18 | u>>>(32-18);
  36939. }
  36940. x0 = x0 + j0 | 0;
  36941. x1 = x1 + j1 | 0;
  36942. x2 = x2 + j2 | 0;
  36943. x3 = x3 + j3 | 0;
  36944. x4 = x4 + j4 | 0;
  36945. x5 = x5 + j5 | 0;
  36946. x6 = x6 + j6 | 0;
  36947. x7 = x7 + j7 | 0;
  36948. x8 = x8 + j8 | 0;
  36949. x9 = x9 + j9 | 0;
  36950. x10 = x10 + j10 | 0;
  36951. x11 = x11 + j11 | 0;
  36952. x12 = x12 + j12 | 0;
  36953. x13 = x13 + j13 | 0;
  36954. x14 = x14 + j14 | 0;
  36955. x15 = x15 + j15 | 0;
  36956. o[ 0] = x0 >>> 0 & 0xff;
  36957. o[ 1] = x0 >>> 8 & 0xff;
  36958. o[ 2] = x0 >>> 16 & 0xff;
  36959. o[ 3] = x0 >>> 24 & 0xff;
  36960. o[ 4] = x1 >>> 0 & 0xff;
  36961. o[ 5] = x1 >>> 8 & 0xff;
  36962. o[ 6] = x1 >>> 16 & 0xff;
  36963. o[ 7] = x1 >>> 24 & 0xff;
  36964. o[ 8] = x2 >>> 0 & 0xff;
  36965. o[ 9] = x2 >>> 8 & 0xff;
  36966. o[10] = x2 >>> 16 & 0xff;
  36967. o[11] = x2 >>> 24 & 0xff;
  36968. o[12] = x3 >>> 0 & 0xff;
  36969. o[13] = x3 >>> 8 & 0xff;
  36970. o[14] = x3 >>> 16 & 0xff;
  36971. o[15] = x3 >>> 24 & 0xff;
  36972. o[16] = x4 >>> 0 & 0xff;
  36973. o[17] = x4 >>> 8 & 0xff;
  36974. o[18] = x4 >>> 16 & 0xff;
  36975. o[19] = x4 >>> 24 & 0xff;
  36976. o[20] = x5 >>> 0 & 0xff;
  36977. o[21] = x5 >>> 8 & 0xff;
  36978. o[22] = x5 >>> 16 & 0xff;
  36979. o[23] = x5 >>> 24 & 0xff;
  36980. o[24] = x6 >>> 0 & 0xff;
  36981. o[25] = x6 >>> 8 & 0xff;
  36982. o[26] = x6 >>> 16 & 0xff;
  36983. o[27] = x6 >>> 24 & 0xff;
  36984. o[28] = x7 >>> 0 & 0xff;
  36985. o[29] = x7 >>> 8 & 0xff;
  36986. o[30] = x7 >>> 16 & 0xff;
  36987. o[31] = x7 >>> 24 & 0xff;
  36988. o[32] = x8 >>> 0 & 0xff;
  36989. o[33] = x8 >>> 8 & 0xff;
  36990. o[34] = x8 >>> 16 & 0xff;
  36991. o[35] = x8 >>> 24 & 0xff;
  36992. o[36] = x9 >>> 0 & 0xff;
  36993. o[37] = x9 >>> 8 & 0xff;
  36994. o[38] = x9 >>> 16 & 0xff;
  36995. o[39] = x9 >>> 24 & 0xff;
  36996. o[40] = x10 >>> 0 & 0xff;
  36997. o[41] = x10 >>> 8 & 0xff;
  36998. o[42] = x10 >>> 16 & 0xff;
  36999. o[43] = x10 >>> 24 & 0xff;
  37000. o[44] = x11 >>> 0 & 0xff;
  37001. o[45] = x11 >>> 8 & 0xff;
  37002. o[46] = x11 >>> 16 & 0xff;
  37003. o[47] = x11 >>> 24 & 0xff;
  37004. o[48] = x12 >>> 0 & 0xff;
  37005. o[49] = x12 >>> 8 & 0xff;
  37006. o[50] = x12 >>> 16 & 0xff;
  37007. o[51] = x12 >>> 24 & 0xff;
  37008. o[52] = x13 >>> 0 & 0xff;
  37009. o[53] = x13 >>> 8 & 0xff;
  37010. o[54] = x13 >>> 16 & 0xff;
  37011. o[55] = x13 >>> 24 & 0xff;
  37012. o[56] = x14 >>> 0 & 0xff;
  37013. o[57] = x14 >>> 8 & 0xff;
  37014. o[58] = x14 >>> 16 & 0xff;
  37015. o[59] = x14 >>> 24 & 0xff;
  37016. o[60] = x15 >>> 0 & 0xff;
  37017. o[61] = x15 >>> 8 & 0xff;
  37018. o[62] = x15 >>> 16 & 0xff;
  37019. o[63] = x15 >>> 24 & 0xff;
  37020. }
  37021. function core_hsalsa20(o,p,k,c) {
  37022. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37023. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37024. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37025. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37026. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37027. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37028. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37029. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37030. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37031. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37032. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37033. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37034. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37035. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37036. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37037. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37038. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37039. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37040. x15 = j15, u;
  37041. for (var i = 0; i < 20; i += 2) {
  37042. u = x0 + x12 | 0;
  37043. x4 ^= u<<7 | u>>>(32-7);
  37044. u = x4 + x0 | 0;
  37045. x8 ^= u<<9 | u>>>(32-9);
  37046. u = x8 + x4 | 0;
  37047. x12 ^= u<<13 | u>>>(32-13);
  37048. u = x12 + x8 | 0;
  37049. x0 ^= u<<18 | u>>>(32-18);
  37050. u = x5 + x1 | 0;
  37051. x9 ^= u<<7 | u>>>(32-7);
  37052. u = x9 + x5 | 0;
  37053. x13 ^= u<<9 | u>>>(32-9);
  37054. u = x13 + x9 | 0;
  37055. x1 ^= u<<13 | u>>>(32-13);
  37056. u = x1 + x13 | 0;
  37057. x5 ^= u<<18 | u>>>(32-18);
  37058. u = x10 + x6 | 0;
  37059. x14 ^= u<<7 | u>>>(32-7);
  37060. u = x14 + x10 | 0;
  37061. x2 ^= u<<9 | u>>>(32-9);
  37062. u = x2 + x14 | 0;
  37063. x6 ^= u<<13 | u>>>(32-13);
  37064. u = x6 + x2 | 0;
  37065. x10 ^= u<<18 | u>>>(32-18);
  37066. u = x15 + x11 | 0;
  37067. x3 ^= u<<7 | u>>>(32-7);
  37068. u = x3 + x15 | 0;
  37069. x7 ^= u<<9 | u>>>(32-9);
  37070. u = x7 + x3 | 0;
  37071. x11 ^= u<<13 | u>>>(32-13);
  37072. u = x11 + x7 | 0;
  37073. x15 ^= u<<18 | u>>>(32-18);
  37074. u = x0 + x3 | 0;
  37075. x1 ^= u<<7 | u>>>(32-7);
  37076. u = x1 + x0 | 0;
  37077. x2 ^= u<<9 | u>>>(32-9);
  37078. u = x2 + x1 | 0;
  37079. x3 ^= u<<13 | u>>>(32-13);
  37080. u = x3 + x2 | 0;
  37081. x0 ^= u<<18 | u>>>(32-18);
  37082. u = x5 + x4 | 0;
  37083. x6 ^= u<<7 | u>>>(32-7);
  37084. u = x6 + x5 | 0;
  37085. x7 ^= u<<9 | u>>>(32-9);
  37086. u = x7 + x6 | 0;
  37087. x4 ^= u<<13 | u>>>(32-13);
  37088. u = x4 + x7 | 0;
  37089. x5 ^= u<<18 | u>>>(32-18);
  37090. u = x10 + x9 | 0;
  37091. x11 ^= u<<7 | u>>>(32-7);
  37092. u = x11 + x10 | 0;
  37093. x8 ^= u<<9 | u>>>(32-9);
  37094. u = x8 + x11 | 0;
  37095. x9 ^= u<<13 | u>>>(32-13);
  37096. u = x9 + x8 | 0;
  37097. x10 ^= u<<18 | u>>>(32-18);
  37098. u = x15 + x14 | 0;
  37099. x12 ^= u<<7 | u>>>(32-7);
  37100. u = x12 + x15 | 0;
  37101. x13 ^= u<<9 | u>>>(32-9);
  37102. u = x13 + x12 | 0;
  37103. x14 ^= u<<13 | u>>>(32-13);
  37104. u = x14 + x13 | 0;
  37105. x15 ^= u<<18 | u>>>(32-18);
  37106. }
  37107. o[ 0] = x0 >>> 0 & 0xff;
  37108. o[ 1] = x0 >>> 8 & 0xff;
  37109. o[ 2] = x0 >>> 16 & 0xff;
  37110. o[ 3] = x0 >>> 24 & 0xff;
  37111. o[ 4] = x5 >>> 0 & 0xff;
  37112. o[ 5] = x5 >>> 8 & 0xff;
  37113. o[ 6] = x5 >>> 16 & 0xff;
  37114. o[ 7] = x5 >>> 24 & 0xff;
  37115. o[ 8] = x10 >>> 0 & 0xff;
  37116. o[ 9] = x10 >>> 8 & 0xff;
  37117. o[10] = x10 >>> 16 & 0xff;
  37118. o[11] = x10 >>> 24 & 0xff;
  37119. o[12] = x15 >>> 0 & 0xff;
  37120. o[13] = x15 >>> 8 & 0xff;
  37121. o[14] = x15 >>> 16 & 0xff;
  37122. o[15] = x15 >>> 24 & 0xff;
  37123. o[16] = x6 >>> 0 & 0xff;
  37124. o[17] = x6 >>> 8 & 0xff;
  37125. o[18] = x6 >>> 16 & 0xff;
  37126. o[19] = x6 >>> 24 & 0xff;
  37127. o[20] = x7 >>> 0 & 0xff;
  37128. o[21] = x7 >>> 8 & 0xff;
  37129. o[22] = x7 >>> 16 & 0xff;
  37130. o[23] = x7 >>> 24 & 0xff;
  37131. o[24] = x8 >>> 0 & 0xff;
  37132. o[25] = x8 >>> 8 & 0xff;
  37133. o[26] = x8 >>> 16 & 0xff;
  37134. o[27] = x8 >>> 24 & 0xff;
  37135. o[28] = x9 >>> 0 & 0xff;
  37136. o[29] = x9 >>> 8 & 0xff;
  37137. o[30] = x9 >>> 16 & 0xff;
  37138. o[31] = x9 >>> 24 & 0xff;
  37139. }
  37140. function crypto_core_salsa20(out,inp,k,c) {
  37141. core_salsa20(out,inp,k,c);
  37142. }
  37143. function crypto_core_hsalsa20(out,inp,k,c) {
  37144. core_hsalsa20(out,inp,k,c);
  37145. }
  37146. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37147. // "expand 32-byte k"
  37148. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37149. var z = new Uint8Array(16), x = new Uint8Array(64);
  37150. var u, i;
  37151. for (i = 0; i < 16; i++) z[i] = 0;
  37152. for (i = 0; i < 8; i++) z[i] = n[i];
  37153. while (b >= 64) {
  37154. crypto_core_salsa20(x,z,k,sigma);
  37155. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37156. u = 1;
  37157. for (i = 8; i < 16; i++) {
  37158. u = u + (z[i] & 0xff) | 0;
  37159. z[i] = u & 0xff;
  37160. u >>>= 8;
  37161. }
  37162. b -= 64;
  37163. cpos += 64;
  37164. mpos += 64;
  37165. }
  37166. if (b > 0) {
  37167. crypto_core_salsa20(x,z,k,sigma);
  37168. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37169. }
  37170. return 0;
  37171. }
  37172. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37173. var z = new Uint8Array(16), x = new Uint8Array(64);
  37174. var u, i;
  37175. for (i = 0; i < 16; i++) z[i] = 0;
  37176. for (i = 0; i < 8; i++) z[i] = n[i];
  37177. while (b >= 64) {
  37178. crypto_core_salsa20(x,z,k,sigma);
  37179. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37180. u = 1;
  37181. for (i = 8; i < 16; i++) {
  37182. u = u + (z[i] & 0xff) | 0;
  37183. z[i] = u & 0xff;
  37184. u >>>= 8;
  37185. }
  37186. b -= 64;
  37187. cpos += 64;
  37188. }
  37189. if (b > 0) {
  37190. crypto_core_salsa20(x,z,k,sigma);
  37191. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37192. }
  37193. return 0;
  37194. }
  37195. function crypto_stream(c,cpos,d,n,k) {
  37196. var s = new Uint8Array(32);
  37197. crypto_core_hsalsa20(s,n,k,sigma);
  37198. var sn = new Uint8Array(8);
  37199. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37200. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37201. }
  37202. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37203. var s = new Uint8Array(32);
  37204. crypto_core_hsalsa20(s,n,k,sigma);
  37205. var sn = new Uint8Array(8);
  37206. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37207. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37208. }
  37209. /*
  37210. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37211. * https://github.com/floodyberry/poly1305-donna
  37212. */
  37213. var poly1305 = function(key) {
  37214. this.buffer = new Uint8Array(16);
  37215. this.r = new Uint16Array(10);
  37216. this.h = new Uint16Array(10);
  37217. this.pad = new Uint16Array(8);
  37218. this.leftover = 0;
  37219. this.fin = 0;
  37220. var t0, t1, t2, t3, t4, t5, t6, t7;
  37221. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37222. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37223. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37224. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37225. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37226. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37227. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37228. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37229. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37230. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37231. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37232. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37233. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37234. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37235. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37236. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37237. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37238. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37239. };
  37240. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37241. var hibit = this.fin ? 0 : (1 << 11);
  37242. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37243. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37244. var h0 = this.h[0],
  37245. h1 = this.h[1],
  37246. h2 = this.h[2],
  37247. h3 = this.h[3],
  37248. h4 = this.h[4],
  37249. h5 = this.h[5],
  37250. h6 = this.h[6],
  37251. h7 = this.h[7],
  37252. h8 = this.h[8],
  37253. h9 = this.h[9];
  37254. var r0 = this.r[0],
  37255. r1 = this.r[1],
  37256. r2 = this.r[2],
  37257. r3 = this.r[3],
  37258. r4 = this.r[4],
  37259. r5 = this.r[5],
  37260. r6 = this.r[6],
  37261. r7 = this.r[7],
  37262. r8 = this.r[8],
  37263. r9 = this.r[9];
  37264. while (bytes >= 16) {
  37265. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37266. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37267. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37268. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37269. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37270. h5 += ((t4 >>> 1)) & 0x1fff;
  37271. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37272. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37273. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37274. h9 += ((t7 >>> 5)) | hibit;
  37275. c = 0;
  37276. d0 = c;
  37277. d0 += h0 * r0;
  37278. d0 += h1 * (5 * r9);
  37279. d0 += h2 * (5 * r8);
  37280. d0 += h3 * (5 * r7);
  37281. d0 += h4 * (5 * r6);
  37282. c = (d0 >>> 13); d0 &= 0x1fff;
  37283. d0 += h5 * (5 * r5);
  37284. d0 += h6 * (5 * r4);
  37285. d0 += h7 * (5 * r3);
  37286. d0 += h8 * (5 * r2);
  37287. d0 += h9 * (5 * r1);
  37288. c += (d0 >>> 13); d0 &= 0x1fff;
  37289. d1 = c;
  37290. d1 += h0 * r1;
  37291. d1 += h1 * r0;
  37292. d1 += h2 * (5 * r9);
  37293. d1 += h3 * (5 * r8);
  37294. d1 += h4 * (5 * r7);
  37295. c = (d1 >>> 13); d1 &= 0x1fff;
  37296. d1 += h5 * (5 * r6);
  37297. d1 += h6 * (5 * r5);
  37298. d1 += h7 * (5 * r4);
  37299. d1 += h8 * (5 * r3);
  37300. d1 += h9 * (5 * r2);
  37301. c += (d1 >>> 13); d1 &= 0x1fff;
  37302. d2 = c;
  37303. d2 += h0 * r2;
  37304. d2 += h1 * r1;
  37305. d2 += h2 * r0;
  37306. d2 += h3 * (5 * r9);
  37307. d2 += h4 * (5 * r8);
  37308. c = (d2 >>> 13); d2 &= 0x1fff;
  37309. d2 += h5 * (5 * r7);
  37310. d2 += h6 * (5 * r6);
  37311. d2 += h7 * (5 * r5);
  37312. d2 += h8 * (5 * r4);
  37313. d2 += h9 * (5 * r3);
  37314. c += (d2 >>> 13); d2 &= 0x1fff;
  37315. d3 = c;
  37316. d3 += h0 * r3;
  37317. d3 += h1 * r2;
  37318. d3 += h2 * r1;
  37319. d3 += h3 * r0;
  37320. d3 += h4 * (5 * r9);
  37321. c = (d3 >>> 13); d3 &= 0x1fff;
  37322. d3 += h5 * (5 * r8);
  37323. d3 += h6 * (5 * r7);
  37324. d3 += h7 * (5 * r6);
  37325. d3 += h8 * (5 * r5);
  37326. d3 += h9 * (5 * r4);
  37327. c += (d3 >>> 13); d3 &= 0x1fff;
  37328. d4 = c;
  37329. d4 += h0 * r4;
  37330. d4 += h1 * r3;
  37331. d4 += h2 * r2;
  37332. d4 += h3 * r1;
  37333. d4 += h4 * r0;
  37334. c = (d4 >>> 13); d4 &= 0x1fff;
  37335. d4 += h5 * (5 * r9);
  37336. d4 += h6 * (5 * r8);
  37337. d4 += h7 * (5 * r7);
  37338. d4 += h8 * (5 * r6);
  37339. d4 += h9 * (5 * r5);
  37340. c += (d4 >>> 13); d4 &= 0x1fff;
  37341. d5 = c;
  37342. d5 += h0 * r5;
  37343. d5 += h1 * r4;
  37344. d5 += h2 * r3;
  37345. d5 += h3 * r2;
  37346. d5 += h4 * r1;
  37347. c = (d5 >>> 13); d5 &= 0x1fff;
  37348. d5 += h5 * r0;
  37349. d5 += h6 * (5 * r9);
  37350. d5 += h7 * (5 * r8);
  37351. d5 += h8 * (5 * r7);
  37352. d5 += h9 * (5 * r6);
  37353. c += (d5 >>> 13); d5 &= 0x1fff;
  37354. d6 = c;
  37355. d6 += h0 * r6;
  37356. d6 += h1 * r5;
  37357. d6 += h2 * r4;
  37358. d6 += h3 * r3;
  37359. d6 += h4 * r2;
  37360. c = (d6 >>> 13); d6 &= 0x1fff;
  37361. d6 += h5 * r1;
  37362. d6 += h6 * r0;
  37363. d6 += h7 * (5 * r9);
  37364. d6 += h8 * (5 * r8);
  37365. d6 += h9 * (5 * r7);
  37366. c += (d6 >>> 13); d6 &= 0x1fff;
  37367. d7 = c;
  37368. d7 += h0 * r7;
  37369. d7 += h1 * r6;
  37370. d7 += h2 * r5;
  37371. d7 += h3 * r4;
  37372. d7 += h4 * r3;
  37373. c = (d7 >>> 13); d7 &= 0x1fff;
  37374. d7 += h5 * r2;
  37375. d7 += h6 * r1;
  37376. d7 += h7 * r0;
  37377. d7 += h8 * (5 * r9);
  37378. d7 += h9 * (5 * r8);
  37379. c += (d7 >>> 13); d7 &= 0x1fff;
  37380. d8 = c;
  37381. d8 += h0 * r8;
  37382. d8 += h1 * r7;
  37383. d8 += h2 * r6;
  37384. d8 += h3 * r5;
  37385. d8 += h4 * r4;
  37386. c = (d8 >>> 13); d8 &= 0x1fff;
  37387. d8 += h5 * r3;
  37388. d8 += h6 * r2;
  37389. d8 += h7 * r1;
  37390. d8 += h8 * r0;
  37391. d8 += h9 * (5 * r9);
  37392. c += (d8 >>> 13); d8 &= 0x1fff;
  37393. d9 = c;
  37394. d9 += h0 * r9;
  37395. d9 += h1 * r8;
  37396. d9 += h2 * r7;
  37397. d9 += h3 * r6;
  37398. d9 += h4 * r5;
  37399. c = (d9 >>> 13); d9 &= 0x1fff;
  37400. d9 += h5 * r4;
  37401. d9 += h6 * r3;
  37402. d9 += h7 * r2;
  37403. d9 += h8 * r1;
  37404. d9 += h9 * r0;
  37405. c += (d9 >>> 13); d9 &= 0x1fff;
  37406. c = (((c << 2) + c)) | 0;
  37407. c = (c + d0) | 0;
  37408. d0 = c & 0x1fff;
  37409. c = (c >>> 13);
  37410. d1 += c;
  37411. h0 = d0;
  37412. h1 = d1;
  37413. h2 = d2;
  37414. h3 = d3;
  37415. h4 = d4;
  37416. h5 = d5;
  37417. h6 = d6;
  37418. h7 = d7;
  37419. h8 = d8;
  37420. h9 = d9;
  37421. mpos += 16;
  37422. bytes -= 16;
  37423. }
  37424. this.h[0] = h0;
  37425. this.h[1] = h1;
  37426. this.h[2] = h2;
  37427. this.h[3] = h3;
  37428. this.h[4] = h4;
  37429. this.h[5] = h5;
  37430. this.h[6] = h6;
  37431. this.h[7] = h7;
  37432. this.h[8] = h8;
  37433. this.h[9] = h9;
  37434. };
  37435. poly1305.prototype.finish = function(mac, macpos) {
  37436. var g = new Uint16Array(10);
  37437. var c, mask, f, i;
  37438. if (this.leftover) {
  37439. i = this.leftover;
  37440. this.buffer[i++] = 1;
  37441. for (; i < 16; i++) this.buffer[i] = 0;
  37442. this.fin = 1;
  37443. this.blocks(this.buffer, 0, 16);
  37444. }
  37445. c = this.h[1] >>> 13;
  37446. this.h[1] &= 0x1fff;
  37447. for (i = 2; i < 10; i++) {
  37448. this.h[i] += c;
  37449. c = this.h[i] >>> 13;
  37450. this.h[i] &= 0x1fff;
  37451. }
  37452. this.h[0] += (c * 5);
  37453. c = this.h[0] >>> 13;
  37454. this.h[0] &= 0x1fff;
  37455. this.h[1] += c;
  37456. c = this.h[1] >>> 13;
  37457. this.h[1] &= 0x1fff;
  37458. this.h[2] += c;
  37459. g[0] = this.h[0] + 5;
  37460. c = g[0] >>> 13;
  37461. g[0] &= 0x1fff;
  37462. for (i = 1; i < 10; i++) {
  37463. g[i] = this.h[i] + c;
  37464. c = g[i] >>> 13;
  37465. g[i] &= 0x1fff;
  37466. }
  37467. g[9] -= (1 << 13);
  37468. mask = (c ^ 1) - 1;
  37469. for (i = 0; i < 10; i++) g[i] &= mask;
  37470. mask = ~mask;
  37471. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37472. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37473. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37474. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37475. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37476. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37477. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37478. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37479. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37480. f = this.h[0] + this.pad[0];
  37481. this.h[0] = f & 0xffff;
  37482. for (i = 1; i < 8; i++) {
  37483. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37484. this.h[i] = f & 0xffff;
  37485. }
  37486. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37487. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37488. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37489. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37490. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37491. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37492. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37493. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37494. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37495. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37496. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37497. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37498. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37499. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37500. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37501. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37502. };
  37503. poly1305.prototype.update = function(m, mpos, bytes) {
  37504. var i, want;
  37505. if (this.leftover) {
  37506. want = (16 - this.leftover);
  37507. if (want > bytes)
  37508. want = bytes;
  37509. for (i = 0; i < want; i++)
  37510. this.buffer[this.leftover + i] = m[mpos+i];
  37511. bytes -= want;
  37512. mpos += want;
  37513. this.leftover += want;
  37514. if (this.leftover < 16)
  37515. return;
  37516. this.blocks(this.buffer, 0, 16);
  37517. this.leftover = 0;
  37518. }
  37519. if (bytes >= 16) {
  37520. want = bytes - (bytes % 16);
  37521. this.blocks(m, mpos, want);
  37522. mpos += want;
  37523. bytes -= want;
  37524. }
  37525. if (bytes) {
  37526. for (i = 0; i < bytes; i++)
  37527. this.buffer[this.leftover + i] = m[mpos+i];
  37528. this.leftover += bytes;
  37529. }
  37530. };
  37531. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37532. var s = new poly1305(k);
  37533. s.update(m, mpos, n);
  37534. s.finish(out, outpos);
  37535. return 0;
  37536. }
  37537. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37538. var x = new Uint8Array(16);
  37539. crypto_onetimeauth(x,0,m,mpos,n,k);
  37540. return crypto_verify_16(h,hpos,x,0);
  37541. }
  37542. function crypto_secretbox(c,m,d,n,k) {
  37543. var i;
  37544. if (d < 32) return -1;
  37545. crypto_stream_xor(c,0,m,0,d,n,k);
  37546. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37547. for (i = 0; i < 16; i++) c[i] = 0;
  37548. return 0;
  37549. }
  37550. function crypto_secretbox_open(m,c,d,n,k) {
  37551. var i;
  37552. var x = new Uint8Array(32);
  37553. if (d < 32) return -1;
  37554. crypto_stream(x,0,32,n,k);
  37555. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37556. crypto_stream_xor(m,0,c,0,d,n,k);
  37557. for (i = 0; i < 32; i++) m[i] = 0;
  37558. return 0;
  37559. }
  37560. function set25519(r, a) {
  37561. var i;
  37562. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37563. }
  37564. function car25519(o) {
  37565. var i, v, c = 1;
  37566. for (i = 0; i < 16; i++) {
  37567. v = o[i] + c + 65535;
  37568. c = Math.floor(v / 65536);
  37569. o[i] = v - c * 65536;
  37570. }
  37571. o[0] += c-1 + 37 * (c-1);
  37572. }
  37573. function sel25519(p, q, b) {
  37574. var t, c = ~(b-1);
  37575. for (var i = 0; i < 16; i++) {
  37576. t = c & (p[i] ^ q[i]);
  37577. p[i] ^= t;
  37578. q[i] ^= t;
  37579. }
  37580. }
  37581. function pack25519(o, n) {
  37582. var i, j, b;
  37583. var m = gf(), t = gf();
  37584. for (i = 0; i < 16; i++) t[i] = n[i];
  37585. car25519(t);
  37586. car25519(t);
  37587. car25519(t);
  37588. for (j = 0; j < 2; j++) {
  37589. m[0] = t[0] - 0xffed;
  37590. for (i = 1; i < 15; i++) {
  37591. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37592. m[i-1] &= 0xffff;
  37593. }
  37594. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37595. b = (m[15]>>16) & 1;
  37596. m[14] &= 0xffff;
  37597. sel25519(t, m, 1-b);
  37598. }
  37599. for (i = 0; i < 16; i++) {
  37600. o[2*i] = t[i] & 0xff;
  37601. o[2*i+1] = t[i]>>8;
  37602. }
  37603. }
  37604. function neq25519(a, b) {
  37605. var c = new Uint8Array(32), d = new Uint8Array(32);
  37606. pack25519(c, a);
  37607. pack25519(d, b);
  37608. return crypto_verify_32(c, 0, d, 0);
  37609. }
  37610. function par25519(a) {
  37611. var d = new Uint8Array(32);
  37612. pack25519(d, a);
  37613. return d[0] & 1;
  37614. }
  37615. function unpack25519(o, n) {
  37616. var i;
  37617. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37618. o[15] &= 0x7fff;
  37619. }
  37620. function A(o, a, b) {
  37621. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37622. }
  37623. function Z(o, a, b) {
  37624. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37625. }
  37626. function M(o, a, b) {
  37627. var v, c,
  37628. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37629. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37630. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37631. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37632. b0 = b[0],
  37633. b1 = b[1],
  37634. b2 = b[2],
  37635. b3 = b[3],
  37636. b4 = b[4],
  37637. b5 = b[5],
  37638. b6 = b[6],
  37639. b7 = b[7],
  37640. b8 = b[8],
  37641. b9 = b[9],
  37642. b10 = b[10],
  37643. b11 = b[11],
  37644. b12 = b[12],
  37645. b13 = b[13],
  37646. b14 = b[14],
  37647. b15 = b[15];
  37648. v = a[0];
  37649. t0 += v * b0;
  37650. t1 += v * b1;
  37651. t2 += v * b2;
  37652. t3 += v * b3;
  37653. t4 += v * b4;
  37654. t5 += v * b5;
  37655. t6 += v * b6;
  37656. t7 += v * b7;
  37657. t8 += v * b8;
  37658. t9 += v * b9;
  37659. t10 += v * b10;
  37660. t11 += v * b11;
  37661. t12 += v * b12;
  37662. t13 += v * b13;
  37663. t14 += v * b14;
  37664. t15 += v * b15;
  37665. v = a[1];
  37666. t1 += v * b0;
  37667. t2 += v * b1;
  37668. t3 += v * b2;
  37669. t4 += v * b3;
  37670. t5 += v * b4;
  37671. t6 += v * b5;
  37672. t7 += v * b6;
  37673. t8 += v * b7;
  37674. t9 += v * b8;
  37675. t10 += v * b9;
  37676. t11 += v * b10;
  37677. t12 += v * b11;
  37678. t13 += v * b12;
  37679. t14 += v * b13;
  37680. t15 += v * b14;
  37681. t16 += v * b15;
  37682. v = a[2];
  37683. t2 += v * b0;
  37684. t3 += v * b1;
  37685. t4 += v * b2;
  37686. t5 += v * b3;
  37687. t6 += v * b4;
  37688. t7 += v * b5;
  37689. t8 += v * b6;
  37690. t9 += v * b7;
  37691. t10 += v * b8;
  37692. t11 += v * b9;
  37693. t12 += v * b10;
  37694. t13 += v * b11;
  37695. t14 += v * b12;
  37696. t15 += v * b13;
  37697. t16 += v * b14;
  37698. t17 += v * b15;
  37699. v = a[3];
  37700. t3 += v * b0;
  37701. t4 += v * b1;
  37702. t5 += v * b2;
  37703. t6 += v * b3;
  37704. t7 += v * b4;
  37705. t8 += v * b5;
  37706. t9 += v * b6;
  37707. t10 += v * b7;
  37708. t11 += v * b8;
  37709. t12 += v * b9;
  37710. t13 += v * b10;
  37711. t14 += v * b11;
  37712. t15 += v * b12;
  37713. t16 += v * b13;
  37714. t17 += v * b14;
  37715. t18 += v * b15;
  37716. v = a[4];
  37717. t4 += v * b0;
  37718. t5 += v * b1;
  37719. t6 += v * b2;
  37720. t7 += v * b3;
  37721. t8 += v * b4;
  37722. t9 += v * b5;
  37723. t10 += v * b6;
  37724. t11 += v * b7;
  37725. t12 += v * b8;
  37726. t13 += v * b9;
  37727. t14 += v * b10;
  37728. t15 += v * b11;
  37729. t16 += v * b12;
  37730. t17 += v * b13;
  37731. t18 += v * b14;
  37732. t19 += v * b15;
  37733. v = a[5];
  37734. t5 += v * b0;
  37735. t6 += v * b1;
  37736. t7 += v * b2;
  37737. t8 += v * b3;
  37738. t9 += v * b4;
  37739. t10 += v * b5;
  37740. t11 += v * b6;
  37741. t12 += v * b7;
  37742. t13 += v * b8;
  37743. t14 += v * b9;
  37744. t15 += v * b10;
  37745. t16 += v * b11;
  37746. t17 += v * b12;
  37747. t18 += v * b13;
  37748. t19 += v * b14;
  37749. t20 += v * b15;
  37750. v = a[6];
  37751. t6 += v * b0;
  37752. t7 += v * b1;
  37753. t8 += v * b2;
  37754. t9 += v * b3;
  37755. t10 += v * b4;
  37756. t11 += v * b5;
  37757. t12 += v * b6;
  37758. t13 += v * b7;
  37759. t14 += v * b8;
  37760. t15 += v * b9;
  37761. t16 += v * b10;
  37762. t17 += v * b11;
  37763. t18 += v * b12;
  37764. t19 += v * b13;
  37765. t20 += v * b14;
  37766. t21 += v * b15;
  37767. v = a[7];
  37768. t7 += v * b0;
  37769. t8 += v * b1;
  37770. t9 += v * b2;
  37771. t10 += v * b3;
  37772. t11 += v * b4;
  37773. t12 += v * b5;
  37774. t13 += v * b6;
  37775. t14 += v * b7;
  37776. t15 += v * b8;
  37777. t16 += v * b9;
  37778. t17 += v * b10;
  37779. t18 += v * b11;
  37780. t19 += v * b12;
  37781. t20 += v * b13;
  37782. t21 += v * b14;
  37783. t22 += v * b15;
  37784. v = a[8];
  37785. t8 += v * b0;
  37786. t9 += v * b1;
  37787. t10 += v * b2;
  37788. t11 += v * b3;
  37789. t12 += v * b4;
  37790. t13 += v * b5;
  37791. t14 += v * b6;
  37792. t15 += v * b7;
  37793. t16 += v * b8;
  37794. t17 += v * b9;
  37795. t18 += v * b10;
  37796. t19 += v * b11;
  37797. t20 += v * b12;
  37798. t21 += v * b13;
  37799. t22 += v * b14;
  37800. t23 += v * b15;
  37801. v = a[9];
  37802. t9 += v * b0;
  37803. t10 += v * b1;
  37804. t11 += v * b2;
  37805. t12 += v * b3;
  37806. t13 += v * b4;
  37807. t14 += v * b5;
  37808. t15 += v * b6;
  37809. t16 += v * b7;
  37810. t17 += v * b8;
  37811. t18 += v * b9;
  37812. t19 += v * b10;
  37813. t20 += v * b11;
  37814. t21 += v * b12;
  37815. t22 += v * b13;
  37816. t23 += v * b14;
  37817. t24 += v * b15;
  37818. v = a[10];
  37819. t10 += v * b0;
  37820. t11 += v * b1;
  37821. t12 += v * b2;
  37822. t13 += v * b3;
  37823. t14 += v * b4;
  37824. t15 += v * b5;
  37825. t16 += v * b6;
  37826. t17 += v * b7;
  37827. t18 += v * b8;
  37828. t19 += v * b9;
  37829. t20 += v * b10;
  37830. t21 += v * b11;
  37831. t22 += v * b12;
  37832. t23 += v * b13;
  37833. t24 += v * b14;
  37834. t25 += v * b15;
  37835. v = a[11];
  37836. t11 += v * b0;
  37837. t12 += v * b1;
  37838. t13 += v * b2;
  37839. t14 += v * b3;
  37840. t15 += v * b4;
  37841. t16 += v * b5;
  37842. t17 += v * b6;
  37843. t18 += v * b7;
  37844. t19 += v * b8;
  37845. t20 += v * b9;
  37846. t21 += v * b10;
  37847. t22 += v * b11;
  37848. t23 += v * b12;
  37849. t24 += v * b13;
  37850. t25 += v * b14;
  37851. t26 += v * b15;
  37852. v = a[12];
  37853. t12 += v * b0;
  37854. t13 += v * b1;
  37855. t14 += v * b2;
  37856. t15 += v * b3;
  37857. t16 += v * b4;
  37858. t17 += v * b5;
  37859. t18 += v * b6;
  37860. t19 += v * b7;
  37861. t20 += v * b8;
  37862. t21 += v * b9;
  37863. t22 += v * b10;
  37864. t23 += v * b11;
  37865. t24 += v * b12;
  37866. t25 += v * b13;
  37867. t26 += v * b14;
  37868. t27 += v * b15;
  37869. v = a[13];
  37870. t13 += v * b0;
  37871. t14 += v * b1;
  37872. t15 += v * b2;
  37873. t16 += v * b3;
  37874. t17 += v * b4;
  37875. t18 += v * b5;
  37876. t19 += v * b6;
  37877. t20 += v * b7;
  37878. t21 += v * b8;
  37879. t22 += v * b9;
  37880. t23 += v * b10;
  37881. t24 += v * b11;
  37882. t25 += v * b12;
  37883. t26 += v * b13;
  37884. t27 += v * b14;
  37885. t28 += v * b15;
  37886. v = a[14];
  37887. t14 += v * b0;
  37888. t15 += v * b1;
  37889. t16 += v * b2;
  37890. t17 += v * b3;
  37891. t18 += v * b4;
  37892. t19 += v * b5;
  37893. t20 += v * b6;
  37894. t21 += v * b7;
  37895. t22 += v * b8;
  37896. t23 += v * b9;
  37897. t24 += v * b10;
  37898. t25 += v * b11;
  37899. t26 += v * b12;
  37900. t27 += v * b13;
  37901. t28 += v * b14;
  37902. t29 += v * b15;
  37903. v = a[15];
  37904. t15 += v * b0;
  37905. t16 += v * b1;
  37906. t17 += v * b2;
  37907. t18 += v * b3;
  37908. t19 += v * b4;
  37909. t20 += v * b5;
  37910. t21 += v * b6;
  37911. t22 += v * b7;
  37912. t23 += v * b8;
  37913. t24 += v * b9;
  37914. t25 += v * b10;
  37915. t26 += v * b11;
  37916. t27 += v * b12;
  37917. t28 += v * b13;
  37918. t29 += v * b14;
  37919. t30 += v * b15;
  37920. t0 += 38 * t16;
  37921. t1 += 38 * t17;
  37922. t2 += 38 * t18;
  37923. t3 += 38 * t19;
  37924. t4 += 38 * t20;
  37925. t5 += 38 * t21;
  37926. t6 += 38 * t22;
  37927. t7 += 38 * t23;
  37928. t8 += 38 * t24;
  37929. t9 += 38 * t25;
  37930. t10 += 38 * t26;
  37931. t11 += 38 * t27;
  37932. t12 += 38 * t28;
  37933. t13 += 38 * t29;
  37934. t14 += 38 * t30;
  37935. // t15 left as is
  37936. // first car
  37937. c = 1;
  37938. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37939. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37940. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37941. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37942. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37943. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37944. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37945. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37946. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37947. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37948. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37949. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37950. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37951. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37952. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37953. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37954. t0 += c-1 + 37 * (c-1);
  37955. // second car
  37956. c = 1;
  37957. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37958. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37959. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37960. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37961. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37962. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37963. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37964. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37965. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37966. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37967. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37968. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37969. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37970. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37971. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37972. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37973. t0 += c-1 + 37 * (c-1);
  37974. o[ 0] = t0;
  37975. o[ 1] = t1;
  37976. o[ 2] = t2;
  37977. o[ 3] = t3;
  37978. o[ 4] = t4;
  37979. o[ 5] = t5;
  37980. o[ 6] = t6;
  37981. o[ 7] = t7;
  37982. o[ 8] = t8;
  37983. o[ 9] = t9;
  37984. o[10] = t10;
  37985. o[11] = t11;
  37986. o[12] = t12;
  37987. o[13] = t13;
  37988. o[14] = t14;
  37989. o[15] = t15;
  37990. }
  37991. function S(o, a) {
  37992. M(o, a, a);
  37993. }
  37994. function inv25519(o, i) {
  37995. var c = gf();
  37996. var a;
  37997. for (a = 0; a < 16; a++) c[a] = i[a];
  37998. for (a = 253; a >= 0; a--) {
  37999. S(c, c);
  38000. if(a !== 2 && a !== 4) M(c, c, i);
  38001. }
  38002. for (a = 0; a < 16; a++) o[a] = c[a];
  38003. }
  38004. function pow2523(o, i) {
  38005. var c = gf();
  38006. var a;
  38007. for (a = 0; a < 16; a++) c[a] = i[a];
  38008. for (a = 250; a >= 0; a--) {
  38009. S(c, c);
  38010. if(a !== 1) M(c, c, i);
  38011. }
  38012. for (a = 0; a < 16; a++) o[a] = c[a];
  38013. }
  38014. function crypto_scalarmult(q, n, p) {
  38015. var z = new Uint8Array(32);
  38016. var x = new Float64Array(80), r, i;
  38017. var a = gf(), b = gf(), c = gf(),
  38018. d = gf(), e = gf(), f = gf();
  38019. for (i = 0; i < 31; i++) z[i] = n[i];
  38020. z[31]=(n[31]&127)|64;
  38021. z[0]&=248;
  38022. unpack25519(x,p);
  38023. for (i = 0; i < 16; i++) {
  38024. b[i]=x[i];
  38025. d[i]=a[i]=c[i]=0;
  38026. }
  38027. a[0]=d[0]=1;
  38028. for (i=254; i>=0; --i) {
  38029. r=(z[i>>>3]>>>(i&7))&1;
  38030. sel25519(a,b,r);
  38031. sel25519(c,d,r);
  38032. A(e,a,c);
  38033. Z(a,a,c);
  38034. A(c,b,d);
  38035. Z(b,b,d);
  38036. S(d,e);
  38037. S(f,a);
  38038. M(a,c,a);
  38039. M(c,b,e);
  38040. A(e,a,c);
  38041. Z(a,a,c);
  38042. S(b,a);
  38043. Z(c,d,f);
  38044. M(a,c,_121665);
  38045. A(a,a,d);
  38046. M(c,c,a);
  38047. M(a,d,f);
  38048. M(d,b,x);
  38049. S(b,e);
  38050. sel25519(a,b,r);
  38051. sel25519(c,d,r);
  38052. }
  38053. for (i = 0; i < 16; i++) {
  38054. x[i+16]=a[i];
  38055. x[i+32]=c[i];
  38056. x[i+48]=b[i];
  38057. x[i+64]=d[i];
  38058. }
  38059. var x32 = x.subarray(32);
  38060. var x16 = x.subarray(16);
  38061. inv25519(x32,x32);
  38062. M(x16,x16,x32);
  38063. pack25519(q,x16);
  38064. return 0;
  38065. }
  38066. function crypto_scalarmult_base(q, n) {
  38067. return crypto_scalarmult(q, n, _9);
  38068. }
  38069. function crypto_box_keypair(y, x) {
  38070. randombytes(x, 32);
  38071. return crypto_scalarmult_base(y, x);
  38072. }
  38073. function crypto_box_beforenm(k, y, x) {
  38074. var s = new Uint8Array(32);
  38075. crypto_scalarmult(s, x, y);
  38076. return crypto_core_hsalsa20(k, _0, s, sigma);
  38077. }
  38078. var crypto_box_afternm = crypto_secretbox;
  38079. var crypto_box_open_afternm = crypto_secretbox_open;
  38080. function crypto_box(c, m, d, n, y, x) {
  38081. var k = new Uint8Array(32);
  38082. crypto_box_beforenm(k, y, x);
  38083. return crypto_box_afternm(c, m, d, n, k);
  38084. }
  38085. function crypto_box_open(m, c, d, n, y, x) {
  38086. var k = new Uint8Array(32);
  38087. crypto_box_beforenm(k, y, x);
  38088. return crypto_box_open_afternm(m, c, d, n, k);
  38089. }
  38090. var K = [
  38091. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38092. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38093. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38094. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38095. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38096. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38097. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38098. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38099. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38100. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38101. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38102. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38103. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38104. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38105. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38106. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38107. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38108. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38109. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38110. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38111. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38112. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38113. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38114. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38115. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38116. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38117. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38118. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38119. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38120. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38121. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38122. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38123. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38124. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38125. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38126. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38127. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38128. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38129. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38130. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38131. ];
  38132. function crypto_hashblocks_hl(hh, hl, m, n) {
  38133. var wh = new Int32Array(16), wl = new Int32Array(16),
  38134. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38135. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38136. th, tl, i, j, h, l, a, b, c, d;
  38137. var ah0 = hh[0],
  38138. ah1 = hh[1],
  38139. ah2 = hh[2],
  38140. ah3 = hh[3],
  38141. ah4 = hh[4],
  38142. ah5 = hh[5],
  38143. ah6 = hh[6],
  38144. ah7 = hh[7],
  38145. al0 = hl[0],
  38146. al1 = hl[1],
  38147. al2 = hl[2],
  38148. al3 = hl[3],
  38149. al4 = hl[4],
  38150. al5 = hl[5],
  38151. al6 = hl[6],
  38152. al7 = hl[7];
  38153. var pos = 0;
  38154. while (n >= 128) {
  38155. for (i = 0; i < 16; i++) {
  38156. j = 8 * i + pos;
  38157. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38158. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38159. }
  38160. for (i = 0; i < 80; i++) {
  38161. bh0 = ah0;
  38162. bh1 = ah1;
  38163. bh2 = ah2;
  38164. bh3 = ah3;
  38165. bh4 = ah4;
  38166. bh5 = ah5;
  38167. bh6 = ah6;
  38168. bh7 = ah7;
  38169. bl0 = al0;
  38170. bl1 = al1;
  38171. bl2 = al2;
  38172. bl3 = al3;
  38173. bl4 = al4;
  38174. bl5 = al5;
  38175. bl6 = al6;
  38176. bl7 = al7;
  38177. // add
  38178. h = ah7;
  38179. l = al7;
  38180. a = l & 0xffff; b = l >>> 16;
  38181. c = h & 0xffff; d = h >>> 16;
  38182. // Sigma1
  38183. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38184. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38185. a += l & 0xffff; b += l >>> 16;
  38186. c += h & 0xffff; d += h >>> 16;
  38187. // Ch
  38188. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38189. l = (al4 & al5) ^ (~al4 & al6);
  38190. a += l & 0xffff; b += l >>> 16;
  38191. c += h & 0xffff; d += h >>> 16;
  38192. // K
  38193. h = K[i*2];
  38194. l = K[i*2+1];
  38195. a += l & 0xffff; b += l >>> 16;
  38196. c += h & 0xffff; d += h >>> 16;
  38197. // w
  38198. h = wh[i%16];
  38199. l = wl[i%16];
  38200. a += l & 0xffff; b += l >>> 16;
  38201. c += h & 0xffff; d += h >>> 16;
  38202. b += a >>> 16;
  38203. c += b >>> 16;
  38204. d += c >>> 16;
  38205. th = c & 0xffff | d << 16;
  38206. tl = a & 0xffff | b << 16;
  38207. // add
  38208. h = th;
  38209. l = tl;
  38210. a = l & 0xffff; b = l >>> 16;
  38211. c = h & 0xffff; d = h >>> 16;
  38212. // Sigma0
  38213. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38214. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38215. a += l & 0xffff; b += l >>> 16;
  38216. c += h & 0xffff; d += h >>> 16;
  38217. // Maj
  38218. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38219. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38220. a += l & 0xffff; b += l >>> 16;
  38221. c += h & 0xffff; d += h >>> 16;
  38222. b += a >>> 16;
  38223. c += b >>> 16;
  38224. d += c >>> 16;
  38225. bh7 = (c & 0xffff) | (d << 16);
  38226. bl7 = (a & 0xffff) | (b << 16);
  38227. // add
  38228. h = bh3;
  38229. l = bl3;
  38230. a = l & 0xffff; b = l >>> 16;
  38231. c = h & 0xffff; d = h >>> 16;
  38232. h = th;
  38233. l = tl;
  38234. a += l & 0xffff; b += l >>> 16;
  38235. c += h & 0xffff; d += h >>> 16;
  38236. b += a >>> 16;
  38237. c += b >>> 16;
  38238. d += c >>> 16;
  38239. bh3 = (c & 0xffff) | (d << 16);
  38240. bl3 = (a & 0xffff) | (b << 16);
  38241. ah1 = bh0;
  38242. ah2 = bh1;
  38243. ah3 = bh2;
  38244. ah4 = bh3;
  38245. ah5 = bh4;
  38246. ah6 = bh5;
  38247. ah7 = bh6;
  38248. ah0 = bh7;
  38249. al1 = bl0;
  38250. al2 = bl1;
  38251. al3 = bl2;
  38252. al4 = bl3;
  38253. al5 = bl4;
  38254. al6 = bl5;
  38255. al7 = bl6;
  38256. al0 = bl7;
  38257. if (i%16 === 15) {
  38258. for (j = 0; j < 16; j++) {
  38259. // add
  38260. h = wh[j];
  38261. l = wl[j];
  38262. a = l & 0xffff; b = l >>> 16;
  38263. c = h & 0xffff; d = h >>> 16;
  38264. h = wh[(j+9)%16];
  38265. l = wl[(j+9)%16];
  38266. a += l & 0xffff; b += l >>> 16;
  38267. c += h & 0xffff; d += h >>> 16;
  38268. // sigma0
  38269. th = wh[(j+1)%16];
  38270. tl = wl[(j+1)%16];
  38271. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38272. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38273. a += l & 0xffff; b += l >>> 16;
  38274. c += h & 0xffff; d += h >>> 16;
  38275. // sigma1
  38276. th = wh[(j+14)%16];
  38277. tl = wl[(j+14)%16];
  38278. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38279. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38280. a += l & 0xffff; b += l >>> 16;
  38281. c += h & 0xffff; d += h >>> 16;
  38282. b += a >>> 16;
  38283. c += b >>> 16;
  38284. d += c >>> 16;
  38285. wh[j] = (c & 0xffff) | (d << 16);
  38286. wl[j] = (a & 0xffff) | (b << 16);
  38287. }
  38288. }
  38289. }
  38290. // add
  38291. h = ah0;
  38292. l = al0;
  38293. a = l & 0xffff; b = l >>> 16;
  38294. c = h & 0xffff; d = h >>> 16;
  38295. h = hh[0];
  38296. l = hl[0];
  38297. a += l & 0xffff; b += l >>> 16;
  38298. c += h & 0xffff; d += h >>> 16;
  38299. b += a >>> 16;
  38300. c += b >>> 16;
  38301. d += c >>> 16;
  38302. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38303. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38304. h = ah1;
  38305. l = al1;
  38306. a = l & 0xffff; b = l >>> 16;
  38307. c = h & 0xffff; d = h >>> 16;
  38308. h = hh[1];
  38309. l = hl[1];
  38310. a += l & 0xffff; b += l >>> 16;
  38311. c += h & 0xffff; d += h >>> 16;
  38312. b += a >>> 16;
  38313. c += b >>> 16;
  38314. d += c >>> 16;
  38315. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38316. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38317. h = ah2;
  38318. l = al2;
  38319. a = l & 0xffff; b = l >>> 16;
  38320. c = h & 0xffff; d = h >>> 16;
  38321. h = hh[2];
  38322. l = hl[2];
  38323. a += l & 0xffff; b += l >>> 16;
  38324. c += h & 0xffff; d += h >>> 16;
  38325. b += a >>> 16;
  38326. c += b >>> 16;
  38327. d += c >>> 16;
  38328. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38329. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38330. h = ah3;
  38331. l = al3;
  38332. a = l & 0xffff; b = l >>> 16;
  38333. c = h & 0xffff; d = h >>> 16;
  38334. h = hh[3];
  38335. l = hl[3];
  38336. a += l & 0xffff; b += l >>> 16;
  38337. c += h & 0xffff; d += h >>> 16;
  38338. b += a >>> 16;
  38339. c += b >>> 16;
  38340. d += c >>> 16;
  38341. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38342. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38343. h = ah4;
  38344. l = al4;
  38345. a = l & 0xffff; b = l >>> 16;
  38346. c = h & 0xffff; d = h >>> 16;
  38347. h = hh[4];
  38348. l = hl[4];
  38349. a += l & 0xffff; b += l >>> 16;
  38350. c += h & 0xffff; d += h >>> 16;
  38351. b += a >>> 16;
  38352. c += b >>> 16;
  38353. d += c >>> 16;
  38354. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38355. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38356. h = ah5;
  38357. l = al5;
  38358. a = l & 0xffff; b = l >>> 16;
  38359. c = h & 0xffff; d = h >>> 16;
  38360. h = hh[5];
  38361. l = hl[5];
  38362. a += l & 0xffff; b += l >>> 16;
  38363. c += h & 0xffff; d += h >>> 16;
  38364. b += a >>> 16;
  38365. c += b >>> 16;
  38366. d += c >>> 16;
  38367. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38368. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38369. h = ah6;
  38370. l = al6;
  38371. a = l & 0xffff; b = l >>> 16;
  38372. c = h & 0xffff; d = h >>> 16;
  38373. h = hh[6];
  38374. l = hl[6];
  38375. a += l & 0xffff; b += l >>> 16;
  38376. c += h & 0xffff; d += h >>> 16;
  38377. b += a >>> 16;
  38378. c += b >>> 16;
  38379. d += c >>> 16;
  38380. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38381. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38382. h = ah7;
  38383. l = al7;
  38384. a = l & 0xffff; b = l >>> 16;
  38385. c = h & 0xffff; d = h >>> 16;
  38386. h = hh[7];
  38387. l = hl[7];
  38388. a += l & 0xffff; b += l >>> 16;
  38389. c += h & 0xffff; d += h >>> 16;
  38390. b += a >>> 16;
  38391. c += b >>> 16;
  38392. d += c >>> 16;
  38393. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38394. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38395. pos += 128;
  38396. n -= 128;
  38397. }
  38398. return n;
  38399. }
  38400. function crypto_hash(out, m, n) {
  38401. var hh = new Int32Array(8),
  38402. hl = new Int32Array(8),
  38403. x = new Uint8Array(256),
  38404. i, b = n;
  38405. hh[0] = 0x6a09e667;
  38406. hh[1] = 0xbb67ae85;
  38407. hh[2] = 0x3c6ef372;
  38408. hh[3] = 0xa54ff53a;
  38409. hh[4] = 0x510e527f;
  38410. hh[5] = 0x9b05688c;
  38411. hh[6] = 0x1f83d9ab;
  38412. hh[7] = 0x5be0cd19;
  38413. hl[0] = 0xf3bcc908;
  38414. hl[1] = 0x84caa73b;
  38415. hl[2] = 0xfe94f82b;
  38416. hl[3] = 0x5f1d36f1;
  38417. hl[4] = 0xade682d1;
  38418. hl[5] = 0x2b3e6c1f;
  38419. hl[6] = 0xfb41bd6b;
  38420. hl[7] = 0x137e2179;
  38421. crypto_hashblocks_hl(hh, hl, m, n);
  38422. n %= 128;
  38423. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38424. x[n] = 128;
  38425. n = 256-128*(n<112?1:0);
  38426. x[n-9] = 0;
  38427. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38428. crypto_hashblocks_hl(hh, hl, x, n);
  38429. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38430. return 0;
  38431. }
  38432. function add(p, q) {
  38433. var a = gf(), b = gf(), c = gf(),
  38434. d = gf(), e = gf(), f = gf(),
  38435. g = gf(), h = gf(), t = gf();
  38436. Z(a, p[1], p[0]);
  38437. Z(t, q[1], q[0]);
  38438. M(a, a, t);
  38439. A(b, p[0], p[1]);
  38440. A(t, q[0], q[1]);
  38441. M(b, b, t);
  38442. M(c, p[3], q[3]);
  38443. M(c, c, D2);
  38444. M(d, p[2], q[2]);
  38445. A(d, d, d);
  38446. Z(e, b, a);
  38447. Z(f, d, c);
  38448. A(g, d, c);
  38449. A(h, b, a);
  38450. M(p[0], e, f);
  38451. M(p[1], h, g);
  38452. M(p[2], g, f);
  38453. M(p[3], e, h);
  38454. }
  38455. function cswap(p, q, b) {
  38456. var i;
  38457. for (i = 0; i < 4; i++) {
  38458. sel25519(p[i], q[i], b);
  38459. }
  38460. }
  38461. function pack(r, p) {
  38462. var tx = gf(), ty = gf(), zi = gf();
  38463. inv25519(zi, p[2]);
  38464. M(tx, p[0], zi);
  38465. M(ty, p[1], zi);
  38466. pack25519(r, ty);
  38467. r[31] ^= par25519(tx) << 7;
  38468. }
  38469. function scalarmult(p, q, s) {
  38470. var b, i;
  38471. set25519(p[0], gf0);
  38472. set25519(p[1], gf1);
  38473. set25519(p[2], gf1);
  38474. set25519(p[3], gf0);
  38475. for (i = 255; i >= 0; --i) {
  38476. b = (s[(i/8)|0] >> (i&7)) & 1;
  38477. cswap(p, q, b);
  38478. add(q, p);
  38479. add(p, p);
  38480. cswap(p, q, b);
  38481. }
  38482. }
  38483. function scalarbase(p, s) {
  38484. var q = [gf(), gf(), gf(), gf()];
  38485. set25519(q[0], X);
  38486. set25519(q[1], Y);
  38487. set25519(q[2], gf1);
  38488. M(q[3], X, Y);
  38489. scalarmult(p, q, s);
  38490. }
  38491. function crypto_sign_keypair(pk, sk, seeded) {
  38492. var d = new Uint8Array(64);
  38493. var p = [gf(), gf(), gf(), gf()];
  38494. var i;
  38495. if (!seeded) randombytes(sk, 32);
  38496. crypto_hash(d, sk, 32);
  38497. d[0] &= 248;
  38498. d[31] &= 127;
  38499. d[31] |= 64;
  38500. scalarbase(p, d);
  38501. pack(pk, p);
  38502. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38503. return 0;
  38504. }
  38505. 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]);
  38506. function modL(r, x) {
  38507. var carry, i, j, k;
  38508. for (i = 63; i >= 32; --i) {
  38509. carry = 0;
  38510. for (j = i - 32, k = i - 12; j < k; ++j) {
  38511. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38512. carry = (x[j] + 128) >> 8;
  38513. x[j] -= carry * 256;
  38514. }
  38515. x[j] += carry;
  38516. x[i] = 0;
  38517. }
  38518. carry = 0;
  38519. for (j = 0; j < 32; j++) {
  38520. x[j] += carry - (x[31] >> 4) * L[j];
  38521. carry = x[j] >> 8;
  38522. x[j] &= 255;
  38523. }
  38524. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38525. for (i = 0; i < 32; i++) {
  38526. x[i+1] += x[i] >> 8;
  38527. r[i] = x[i] & 255;
  38528. }
  38529. }
  38530. function reduce(r) {
  38531. var x = new Float64Array(64), i;
  38532. for (i = 0; i < 64; i++) x[i] = r[i];
  38533. for (i = 0; i < 64; i++) r[i] = 0;
  38534. modL(r, x);
  38535. }
  38536. // Note: difference from C - smlen returned, not passed as argument.
  38537. function crypto_sign(sm, m, n, sk) {
  38538. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38539. var i, j, x = new Float64Array(64);
  38540. var p = [gf(), gf(), gf(), gf()];
  38541. crypto_hash(d, sk, 32);
  38542. d[0] &= 248;
  38543. d[31] &= 127;
  38544. d[31] |= 64;
  38545. var smlen = n + 64;
  38546. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38547. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38548. crypto_hash(r, sm.subarray(32), n+32);
  38549. reduce(r);
  38550. scalarbase(p, r);
  38551. pack(sm, p);
  38552. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38553. crypto_hash(h, sm, n + 64);
  38554. reduce(h);
  38555. for (i = 0; i < 64; i++) x[i] = 0;
  38556. for (i = 0; i < 32; i++) x[i] = r[i];
  38557. for (i = 0; i < 32; i++) {
  38558. for (j = 0; j < 32; j++) {
  38559. x[i+j] += h[i] * d[j];
  38560. }
  38561. }
  38562. modL(sm.subarray(32), x);
  38563. return smlen;
  38564. }
  38565. function unpackneg(r, p) {
  38566. var t = gf(), chk = gf(), num = gf(),
  38567. den = gf(), den2 = gf(), den4 = gf(),
  38568. den6 = gf();
  38569. set25519(r[2], gf1);
  38570. unpack25519(r[1], p);
  38571. S(num, r[1]);
  38572. M(den, num, D);
  38573. Z(num, num, r[2]);
  38574. A(den, r[2], den);
  38575. S(den2, den);
  38576. S(den4, den2);
  38577. M(den6, den4, den2);
  38578. M(t, den6, num);
  38579. M(t, t, den);
  38580. pow2523(t, t);
  38581. M(t, t, num);
  38582. M(t, t, den);
  38583. M(t, t, den);
  38584. M(r[0], t, den);
  38585. S(chk, r[0]);
  38586. M(chk, chk, den);
  38587. if (neq25519(chk, num)) M(r[0], r[0], I);
  38588. S(chk, r[0]);
  38589. M(chk, chk, den);
  38590. if (neq25519(chk, num)) return -1;
  38591. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38592. M(r[3], r[0], r[1]);
  38593. return 0;
  38594. }
  38595. function crypto_sign_open(m, sm, n, pk) {
  38596. var i, mlen;
  38597. var t = new Uint8Array(32), h = new Uint8Array(64);
  38598. var p = [gf(), gf(), gf(), gf()],
  38599. q = [gf(), gf(), gf(), gf()];
  38600. mlen = -1;
  38601. if (n < 64) return -1;
  38602. if (unpackneg(q, pk)) return -1;
  38603. for (i = 0; i < n; i++) m[i] = sm[i];
  38604. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38605. crypto_hash(h, m, n);
  38606. reduce(h);
  38607. scalarmult(p, q, h);
  38608. scalarbase(q, sm.subarray(32));
  38609. add(p, q);
  38610. pack(t, p);
  38611. n -= 64;
  38612. if (crypto_verify_32(sm, 0, t, 0)) {
  38613. for (i = 0; i < n; i++) m[i] = 0;
  38614. return -1;
  38615. }
  38616. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38617. mlen = n;
  38618. return mlen;
  38619. }
  38620. var crypto_secretbox_KEYBYTES = 32,
  38621. crypto_secretbox_NONCEBYTES = 24,
  38622. crypto_secretbox_ZEROBYTES = 32,
  38623. crypto_secretbox_BOXZEROBYTES = 16,
  38624. crypto_scalarmult_BYTES = 32,
  38625. crypto_scalarmult_SCALARBYTES = 32,
  38626. crypto_box_PUBLICKEYBYTES = 32,
  38627. crypto_box_SECRETKEYBYTES = 32,
  38628. crypto_box_BEFORENMBYTES = 32,
  38629. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38630. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38631. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38632. crypto_sign_BYTES = 64,
  38633. crypto_sign_PUBLICKEYBYTES = 32,
  38634. crypto_sign_SECRETKEYBYTES = 64,
  38635. crypto_sign_SEEDBYTES = 32,
  38636. crypto_hash_BYTES = 64;
  38637. nacl.lowlevel = {
  38638. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38639. crypto_stream_xor: crypto_stream_xor,
  38640. crypto_stream: crypto_stream,
  38641. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38642. crypto_stream_salsa20: crypto_stream_salsa20,
  38643. crypto_onetimeauth: crypto_onetimeauth,
  38644. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38645. crypto_verify_16: crypto_verify_16,
  38646. crypto_verify_32: crypto_verify_32,
  38647. crypto_secretbox: crypto_secretbox,
  38648. crypto_secretbox_open: crypto_secretbox_open,
  38649. crypto_scalarmult: crypto_scalarmult,
  38650. crypto_scalarmult_base: crypto_scalarmult_base,
  38651. crypto_box_beforenm: crypto_box_beforenm,
  38652. crypto_box_afternm: crypto_box_afternm,
  38653. crypto_box: crypto_box,
  38654. crypto_box_open: crypto_box_open,
  38655. crypto_box_keypair: crypto_box_keypair,
  38656. crypto_hash: crypto_hash,
  38657. crypto_sign: crypto_sign,
  38658. crypto_sign_keypair: crypto_sign_keypair,
  38659. crypto_sign_open: crypto_sign_open,
  38660. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38661. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38662. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38663. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38664. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38665. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38666. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38667. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38668. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38669. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38670. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38671. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38672. crypto_sign_BYTES: crypto_sign_BYTES,
  38673. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38674. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38675. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38676. crypto_hash_BYTES: crypto_hash_BYTES
  38677. };
  38678. /* High-level API */
  38679. function checkLengths(k, n) {
  38680. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38681. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38682. }
  38683. function checkBoxLengths(pk, sk) {
  38684. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38685. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38686. }
  38687. function checkArrayTypes() {
  38688. for (var i = 0; i < arguments.length; i++) {
  38689. if (!(arguments[i] instanceof Uint8Array))
  38690. throw new TypeError('unexpected type, use Uint8Array');
  38691. }
  38692. }
  38693. function cleanup(arr) {
  38694. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38695. }
  38696. nacl.randomBytes = function(n) {
  38697. var b = new Uint8Array(n);
  38698. randombytes(b, n);
  38699. return b;
  38700. };
  38701. nacl.secretbox = function(msg, nonce, key) {
  38702. checkArrayTypes(msg, nonce, key);
  38703. checkLengths(key, nonce);
  38704. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38705. var c = new Uint8Array(m.length);
  38706. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38707. crypto_secretbox(c, m, m.length, nonce, key);
  38708. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38709. };
  38710. nacl.secretbox.open = function(box, nonce, key) {
  38711. checkArrayTypes(box, nonce, key);
  38712. checkLengths(key, nonce);
  38713. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38714. var m = new Uint8Array(c.length);
  38715. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38716. if (c.length < 32) return null;
  38717. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38718. return m.subarray(crypto_secretbox_ZEROBYTES);
  38719. };
  38720. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38721. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38722. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38723. nacl.scalarMult = function(n, p) {
  38724. checkArrayTypes(n, p);
  38725. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38726. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38727. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38728. crypto_scalarmult(q, n, p);
  38729. return q;
  38730. };
  38731. nacl.scalarMult.base = function(n) {
  38732. checkArrayTypes(n);
  38733. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38734. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38735. crypto_scalarmult_base(q, n);
  38736. return q;
  38737. };
  38738. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38739. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38740. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38741. var k = nacl.box.before(publicKey, secretKey);
  38742. return nacl.secretbox(msg, nonce, k);
  38743. };
  38744. nacl.box.before = function(publicKey, secretKey) {
  38745. checkArrayTypes(publicKey, secretKey);
  38746. checkBoxLengths(publicKey, secretKey);
  38747. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38748. crypto_box_beforenm(k, publicKey, secretKey);
  38749. return k;
  38750. };
  38751. nacl.box.after = nacl.secretbox;
  38752. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38753. var k = nacl.box.before(publicKey, secretKey);
  38754. return nacl.secretbox.open(msg, nonce, k);
  38755. };
  38756. nacl.box.open.after = nacl.secretbox.open;
  38757. nacl.box.keyPair = function() {
  38758. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38759. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38760. crypto_box_keypair(pk, sk);
  38761. return {publicKey: pk, secretKey: sk};
  38762. };
  38763. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38764. checkArrayTypes(secretKey);
  38765. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38766. throw new Error('bad secret key size');
  38767. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38768. crypto_scalarmult_base(pk, secretKey);
  38769. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38770. };
  38771. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38772. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38773. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38774. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38775. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38776. nacl.sign = function(msg, secretKey) {
  38777. checkArrayTypes(msg, secretKey);
  38778. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38779. throw new Error('bad secret key size');
  38780. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38781. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38782. return signedMsg;
  38783. };
  38784. nacl.sign.open = function(signedMsg, publicKey) {
  38785. checkArrayTypes(signedMsg, publicKey);
  38786. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38787. throw new Error('bad public key size');
  38788. var tmp = new Uint8Array(signedMsg.length);
  38789. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38790. if (mlen < 0) return null;
  38791. var m = new Uint8Array(mlen);
  38792. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38793. return m;
  38794. };
  38795. nacl.sign.detached = function(msg, secretKey) {
  38796. var signedMsg = nacl.sign(msg, secretKey);
  38797. var sig = new Uint8Array(crypto_sign_BYTES);
  38798. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38799. return sig;
  38800. };
  38801. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38802. checkArrayTypes(msg, sig, publicKey);
  38803. if (sig.length !== crypto_sign_BYTES)
  38804. throw new Error('bad signature size');
  38805. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38806. throw new Error('bad public key size');
  38807. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38808. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38809. var i;
  38810. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38811. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38812. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38813. };
  38814. nacl.sign.keyPair = function() {
  38815. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38816. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38817. crypto_sign_keypair(pk, sk);
  38818. return {publicKey: pk, secretKey: sk};
  38819. };
  38820. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38821. checkArrayTypes(secretKey);
  38822. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38823. throw new Error('bad secret key size');
  38824. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38825. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38826. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38827. };
  38828. nacl.sign.keyPair.fromSeed = function(seed) {
  38829. checkArrayTypes(seed);
  38830. if (seed.length !== crypto_sign_SEEDBYTES)
  38831. throw new Error('bad seed size');
  38832. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38833. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38834. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38835. crypto_sign_keypair(pk, sk, true);
  38836. return {publicKey: pk, secretKey: sk};
  38837. };
  38838. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38839. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38840. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38841. nacl.sign.signatureLength = crypto_sign_BYTES;
  38842. nacl.hash = function(msg) {
  38843. checkArrayTypes(msg);
  38844. var h = new Uint8Array(crypto_hash_BYTES);
  38845. crypto_hash(h, msg, msg.length);
  38846. return h;
  38847. };
  38848. nacl.hash.hashLength = crypto_hash_BYTES;
  38849. nacl.verify = function(x, y) {
  38850. checkArrayTypes(x, y);
  38851. // Zero length arguments are considered not equal.
  38852. if (x.length === 0 || y.length === 0) return false;
  38853. if (x.length !== y.length) return false;
  38854. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38855. };
  38856. nacl.setPRNG = function(fn) {
  38857. randombytes = fn;
  38858. };
  38859. (function() {
  38860. // Initialize PRNG if environment provides CSPRNG.
  38861. // If not, methods calling randombytes will throw.
  38862. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38863. if (crypto && crypto.getRandomValues) {
  38864. // Browsers.
  38865. var QUOTA = 65536;
  38866. nacl.setPRNG(function(x, n) {
  38867. var i, v = new Uint8Array(n);
  38868. for (i = 0; i < n; i += QUOTA) {
  38869. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38870. }
  38871. for (i = 0; i < n; i++) x[i] = v[i];
  38872. cleanup(v);
  38873. });
  38874. } else if (true) {
  38875. // Node.js.
  38876. crypto = __webpack_require__(3);
  38877. if (crypto && crypto.randomBytes) {
  38878. nacl.setPRNG(function(x, n) {
  38879. var i, v = crypto.randomBytes(n);
  38880. for (i = 0; i < n; i++) x[i] = v[i];
  38881. cleanup(v);
  38882. });
  38883. }
  38884. }
  38885. })();
  38886. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38887. /***/ }),
  38888. /* 1 */
  38889. /***/ (function(module, exports, __webpack_require__) {
  38890. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38891. // Public domain.
  38892. (function(root, f) {
  38893. 'use strict';
  38894. if ( true && module.exports) module.exports = f();
  38895. else if (root.nacl) root.nacl.util = f();
  38896. else {
  38897. root.nacl = {};
  38898. root.nacl.util = f();
  38899. }
  38900. }(this, function() {
  38901. 'use strict';
  38902. var util = {};
  38903. function validateBase64(s) {
  38904. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38905. throw new TypeError('invalid encoding');
  38906. }
  38907. }
  38908. util.decodeUTF8 = function(s) {
  38909. if (typeof s !== 'string') throw new TypeError('expected string');
  38910. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  38911. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38912. return b;
  38913. };
  38914. util.encodeUTF8 = function(arr) {
  38915. var i, s = [];
  38916. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  38917. return decodeURIComponent(escape(s.join('')));
  38918. };
  38919. if (typeof atob === 'undefined') {
  38920. // Node.js
  38921. if (typeof Buffer.from !== 'undefined') {
  38922. // Node v6 and later
  38923. util.encodeBase64 = function (arr) { // v6 and later
  38924. return Buffer.from(arr).toString('base64');
  38925. };
  38926. util.decodeBase64 = function (s) {
  38927. validateBase64(s);
  38928. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  38929. };
  38930. } else {
  38931. // Node earlier than v6
  38932. util.encodeBase64 = function (arr) { // v6 and later
  38933. return (new Buffer(arr)).toString('base64');
  38934. };
  38935. util.decodeBase64 = function(s) {
  38936. validateBase64(s);
  38937. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  38938. };
  38939. }
  38940. } else {
  38941. // Browsers
  38942. util.encodeBase64 = function(arr) {
  38943. var i, s = [], len = arr.length;
  38944. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  38945. return btoa(s.join(''));
  38946. };
  38947. util.decodeBase64 = function(s) {
  38948. validateBase64(s);
  38949. var i, d = atob(s), b = new Uint8Array(d.length);
  38950. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38951. return b;
  38952. };
  38953. }
  38954. return util;
  38955. }));
  38956. /***/ }),
  38957. /* 2 */
  38958. /***/ (function(module, exports, __webpack_require__) {
  38959. // required so we don't have to do require('pusher').default etc.
  38960. module.exports = __webpack_require__(4).default;
  38961. /***/ }),
  38962. /* 3 */
  38963. /***/ (function(module, exports) {
  38964. /* (ignored) */
  38965. /***/ }),
  38966. /* 4 */
  38967. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38968. "use strict";
  38969. __webpack_require__.r(__webpack_exports__);
  38970. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  38971. var ScriptReceiverFactory = (function () {
  38972. function ScriptReceiverFactory(prefix, name) {
  38973. this.lastId = 0;
  38974. this.prefix = prefix;
  38975. this.name = name;
  38976. }
  38977. ScriptReceiverFactory.prototype.create = function (callback) {
  38978. this.lastId++;
  38979. var number = this.lastId;
  38980. var id = this.prefix + number;
  38981. var name = this.name + "[" + number + "]";
  38982. var called = false;
  38983. var callbackWrapper = function () {
  38984. if (!called) {
  38985. callback.apply(null, arguments);
  38986. called = true;
  38987. }
  38988. };
  38989. this[number] = callbackWrapper;
  38990. return { number: number, id: id, name: name, callback: callbackWrapper };
  38991. };
  38992. ScriptReceiverFactory.prototype.remove = function (receiver) {
  38993. delete this[receiver.number];
  38994. };
  38995. return ScriptReceiverFactory;
  38996. }());
  38997. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  38998. // CONCATENATED MODULE: ./src/core/defaults.ts
  38999. var Defaults = {
  39000. VERSION: "5.0.3",
  39001. PROTOCOL: 7,
  39002. host: 'ws.pusherapp.com',
  39003. ws_port: 80,
  39004. wss_port: 443,
  39005. ws_path: '',
  39006. sockjs_host: 'sockjs.pusher.com',
  39007. sockjs_http_port: 80,
  39008. sockjs_https_port: 443,
  39009. sockjs_path: '/pusher',
  39010. stats_host: 'stats.pusher.com',
  39011. channel_auth_endpoint: '/pusher/auth',
  39012. channel_auth_transport: 'ajax',
  39013. activity_timeout: 120000,
  39014. pong_timeout: 30000,
  39015. unavailable_timeout: 10000,
  39016. cdn_http: "http://js.pusher.com",
  39017. cdn_https: "https://js.pusher.com",
  39018. dependency_suffix: ""
  39019. };
  39020. /* harmony default export */ var defaults = (Defaults);
  39021. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39022. var dependency_loader_DependencyLoader = (function () {
  39023. function DependencyLoader(options) {
  39024. this.options = options;
  39025. this.receivers = options.receivers || ScriptReceivers;
  39026. this.loading = {};
  39027. }
  39028. DependencyLoader.prototype.load = function (name, options, callback) {
  39029. var self = this;
  39030. if (self.loading[name] && self.loading[name].length > 0) {
  39031. self.loading[name].push(callback);
  39032. }
  39033. else {
  39034. self.loading[name] = [callback];
  39035. var request = runtime.createScriptRequest(self.getPath(name, options));
  39036. var receiver = self.receivers.create(function (error) {
  39037. self.receivers.remove(receiver);
  39038. if (self.loading[name]) {
  39039. var callbacks = self.loading[name];
  39040. delete self.loading[name];
  39041. var successCallback = function (wasSuccessful) {
  39042. if (!wasSuccessful) {
  39043. request.cleanup();
  39044. }
  39045. };
  39046. for (var i = 0; i < callbacks.length; i++) {
  39047. callbacks[i](error, successCallback);
  39048. }
  39049. }
  39050. });
  39051. request.send(receiver);
  39052. }
  39053. };
  39054. DependencyLoader.prototype.getRoot = function (options) {
  39055. var cdn;
  39056. var protocol = runtime.getDocument().location.protocol;
  39057. if ((options && options.useTLS) || protocol === "https:") {
  39058. cdn = this.options.cdn_https;
  39059. }
  39060. else {
  39061. cdn = this.options.cdn_http;
  39062. }
  39063. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39064. };
  39065. DependencyLoader.prototype.getPath = function (name, options) {
  39066. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39067. };
  39068. ;
  39069. return DependencyLoader;
  39070. }());
  39071. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39072. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39073. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39074. var Dependencies = new dependency_loader({
  39075. cdn_http: defaults.cdn_http,
  39076. cdn_https: defaults.cdn_https,
  39077. version: defaults.VERSION,
  39078. suffix: defaults.dependency_suffix,
  39079. receivers: DependenciesReceivers
  39080. });
  39081. // CONCATENATED MODULE: ./src/core/base64.ts
  39082. function encode(s) {
  39083. return btoa(utob(s));
  39084. }
  39085. var fromCharCode = String.fromCharCode;
  39086. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39087. var b64tab = {};
  39088. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39089. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39090. }
  39091. var cb_utob = function (c) {
  39092. var cc = c.charCodeAt(0);
  39093. return cc < 0x80
  39094. ? c
  39095. : cc < 0x800
  39096. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39097. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39098. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39099. fromCharCode(0x80 | (cc & 0x3f));
  39100. };
  39101. var utob = function (u) {
  39102. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39103. };
  39104. var cb_encode = function (ccc) {
  39105. var padlen = [0, 2, 1][ccc.length % 3];
  39106. var ord = (ccc.charCodeAt(0) << 16) |
  39107. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39108. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39109. var chars = [
  39110. b64chars.charAt(ord >>> 18),
  39111. b64chars.charAt((ord >>> 12) & 63),
  39112. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39113. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39114. ];
  39115. return chars.join('');
  39116. };
  39117. var btoa = window.btoa ||
  39118. function (b) {
  39119. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39120. };
  39121. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39122. var Timer = (function () {
  39123. function Timer(set, clear, delay, callback) {
  39124. var _this = this;
  39125. this.clear = clear;
  39126. this.timer = set(function () {
  39127. if (_this.timer) {
  39128. _this.timer = callback(_this.timer);
  39129. }
  39130. }, delay);
  39131. }
  39132. Timer.prototype.isRunning = function () {
  39133. return this.timer !== null;
  39134. };
  39135. Timer.prototype.ensureAborted = function () {
  39136. if (this.timer) {
  39137. this.clear(this.timer);
  39138. this.timer = null;
  39139. }
  39140. };
  39141. return Timer;
  39142. }());
  39143. /* harmony default export */ var abstract_timer = (Timer);
  39144. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39145. var __extends = (undefined && undefined.__extends) || (function () {
  39146. var extendStatics = function (d, b) {
  39147. extendStatics = Object.setPrototypeOf ||
  39148. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39149. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39150. return extendStatics(d, b);
  39151. };
  39152. return function (d, b) {
  39153. extendStatics(d, b);
  39154. function __() { this.constructor = d; }
  39155. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39156. };
  39157. })();
  39158. function timers_clearTimeout(timer) {
  39159. window.clearTimeout(timer);
  39160. }
  39161. function timers_clearInterval(timer) {
  39162. window.clearInterval(timer);
  39163. }
  39164. var OneOffTimer = (function (_super) {
  39165. __extends(OneOffTimer, _super);
  39166. function OneOffTimer(delay, callback) {
  39167. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39168. callback();
  39169. return null;
  39170. }) || this;
  39171. }
  39172. return OneOffTimer;
  39173. }(abstract_timer));
  39174. var PeriodicTimer = (function (_super) {
  39175. __extends(PeriodicTimer, _super);
  39176. function PeriodicTimer(delay, callback) {
  39177. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39178. callback();
  39179. return timer;
  39180. }) || this;
  39181. }
  39182. return PeriodicTimer;
  39183. }(abstract_timer));
  39184. // CONCATENATED MODULE: ./src/core/util.ts
  39185. var Util = {
  39186. now: function () {
  39187. if (Date.now) {
  39188. return Date.now();
  39189. }
  39190. else {
  39191. return new Date().valueOf();
  39192. }
  39193. },
  39194. defer: function (callback) {
  39195. return new OneOffTimer(0, callback);
  39196. },
  39197. method: function (name) {
  39198. var args = [];
  39199. for (var _i = 1; _i < arguments.length; _i++) {
  39200. args[_i - 1] = arguments[_i];
  39201. }
  39202. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39203. return function (object) {
  39204. return object[name].apply(object, boundArguments.concat(arguments));
  39205. };
  39206. }
  39207. };
  39208. /* harmony default export */ var util = (Util);
  39209. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39210. function extend(target) {
  39211. var sources = [];
  39212. for (var _i = 1; _i < arguments.length; _i++) {
  39213. sources[_i - 1] = arguments[_i];
  39214. }
  39215. for (var i = 0; i < sources.length; i++) {
  39216. var extensions = sources[i];
  39217. for (var property in extensions) {
  39218. if (extensions[property] && extensions[property].constructor &&
  39219. extensions[property].constructor === Object) {
  39220. target[property] = extend(target[property] || {}, extensions[property]);
  39221. }
  39222. else {
  39223. target[property] = extensions[property];
  39224. }
  39225. }
  39226. }
  39227. return target;
  39228. }
  39229. function stringify() {
  39230. var m = ["Pusher"];
  39231. for (var i = 0; i < arguments.length; i++) {
  39232. if (typeof arguments[i] === "string") {
  39233. m.push(arguments[i]);
  39234. }
  39235. else {
  39236. m.push(safeJSONStringify(arguments[i]));
  39237. }
  39238. }
  39239. return m.join(" : ");
  39240. }
  39241. function arrayIndexOf(array, item) {
  39242. var nativeIndexOf = Array.prototype.indexOf;
  39243. if (array === null) {
  39244. return -1;
  39245. }
  39246. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39247. return array.indexOf(item);
  39248. }
  39249. for (var i = 0, l = array.length; i < l; i++) {
  39250. if (array[i] === item) {
  39251. return i;
  39252. }
  39253. }
  39254. return -1;
  39255. }
  39256. function objectApply(object, f) {
  39257. for (var key in object) {
  39258. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39259. f(object[key], key, object);
  39260. }
  39261. }
  39262. }
  39263. function keys(object) {
  39264. var keys = [];
  39265. objectApply(object, function (_, key) {
  39266. keys.push(key);
  39267. });
  39268. return keys;
  39269. }
  39270. function values(object) {
  39271. var values = [];
  39272. objectApply(object, function (value) {
  39273. values.push(value);
  39274. });
  39275. return values;
  39276. }
  39277. function apply(array, f, context) {
  39278. for (var i = 0; i < array.length; i++) {
  39279. f.call(context || window, array[i], i, array);
  39280. }
  39281. }
  39282. function map(array, f) {
  39283. var result = [];
  39284. for (var i = 0; i < array.length; i++) {
  39285. result.push(f(array[i], i, array, result));
  39286. }
  39287. return result;
  39288. }
  39289. function mapObject(object, f) {
  39290. var result = {};
  39291. objectApply(object, function (value, key) {
  39292. result[key] = f(value);
  39293. });
  39294. return result;
  39295. }
  39296. function filter(array, test) {
  39297. test = test || function (value) { return !!value; };
  39298. var result = [];
  39299. for (var i = 0; i < array.length; i++) {
  39300. if (test(array[i], i, array, result)) {
  39301. result.push(array[i]);
  39302. }
  39303. }
  39304. return result;
  39305. }
  39306. function filterObject(object, test) {
  39307. var result = {};
  39308. objectApply(object, function (value, key) {
  39309. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39310. result[key] = value;
  39311. }
  39312. });
  39313. return result;
  39314. }
  39315. function flatten(object) {
  39316. var result = [];
  39317. objectApply(object, function (value, key) {
  39318. result.push([key, value]);
  39319. });
  39320. return result;
  39321. }
  39322. function any(array, test) {
  39323. for (var i = 0; i < array.length; i++) {
  39324. if (test(array[i], i, array)) {
  39325. return true;
  39326. }
  39327. }
  39328. return false;
  39329. }
  39330. function collections_all(array, test) {
  39331. for (var i = 0; i < array.length; i++) {
  39332. if (!test(array[i], i, array)) {
  39333. return false;
  39334. }
  39335. }
  39336. return true;
  39337. }
  39338. function encodeParamsObject(data) {
  39339. return mapObject(data, function (value) {
  39340. if (typeof value === "object") {
  39341. value = safeJSONStringify(value);
  39342. }
  39343. return encodeURIComponent(encode(value.toString()));
  39344. });
  39345. }
  39346. function buildQueryString(data) {
  39347. var params = filterObject(data, function (value) {
  39348. return value !== undefined;
  39349. });
  39350. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39351. return query;
  39352. }
  39353. function decycleObject(object) {
  39354. var objects = [], paths = [];
  39355. return (function derez(value, path) {
  39356. var i, name, nu;
  39357. switch (typeof value) {
  39358. case 'object':
  39359. if (!value) {
  39360. return null;
  39361. }
  39362. for (i = 0; i < objects.length; i += 1) {
  39363. if (objects[i] === value) {
  39364. return { $ref: paths[i] };
  39365. }
  39366. }
  39367. objects.push(value);
  39368. paths.push(path);
  39369. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39370. nu = [];
  39371. for (i = 0; i < value.length; i += 1) {
  39372. nu[i] = derez(value[i], path + '[' + i + ']');
  39373. }
  39374. }
  39375. else {
  39376. nu = {};
  39377. for (name in value) {
  39378. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39379. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39380. }
  39381. }
  39382. }
  39383. return nu;
  39384. case 'number':
  39385. case 'string':
  39386. case 'boolean':
  39387. return value;
  39388. }
  39389. }(object, '$'));
  39390. }
  39391. function safeJSONStringify(source) {
  39392. try {
  39393. return JSON.stringify(source);
  39394. }
  39395. catch (e) {
  39396. return JSON.stringify(decycleObject(source));
  39397. }
  39398. }
  39399. // CONCATENATED MODULE: ./src/core/logger.ts
  39400. var logger_Logger = (function () {
  39401. function Logger() {
  39402. this.globalLog = function (message) {
  39403. if (window.console && window.console.log) {
  39404. window.console.log(message);
  39405. }
  39406. };
  39407. }
  39408. Logger.prototype.debug = function () {
  39409. var args = [];
  39410. for (var _i = 0; _i < arguments.length; _i++) {
  39411. args[_i] = arguments[_i];
  39412. }
  39413. this.log(this.globalLog, args);
  39414. };
  39415. Logger.prototype.warn = function () {
  39416. var args = [];
  39417. for (var _i = 0; _i < arguments.length; _i++) {
  39418. args[_i] = arguments[_i];
  39419. }
  39420. this.log(this.globalLogWarn, args);
  39421. };
  39422. Logger.prototype.error = function () {
  39423. var args = [];
  39424. for (var _i = 0; _i < arguments.length; _i++) {
  39425. args[_i] = arguments[_i];
  39426. }
  39427. this.log(this.globalLogError, args);
  39428. };
  39429. Logger.prototype.globalLogWarn = function (message) {
  39430. if (window.console && window.console.warn) {
  39431. window.console.warn(message);
  39432. }
  39433. else {
  39434. this.globalLog(message);
  39435. }
  39436. };
  39437. Logger.prototype.globalLogError = function (message) {
  39438. if (window.console && window.console.error) {
  39439. window.console.error(message);
  39440. }
  39441. else {
  39442. this.globalLogWarn(message);
  39443. }
  39444. };
  39445. Logger.prototype.log = function (defaultLoggingFunction) {
  39446. var args = [];
  39447. for (var _i = 1; _i < arguments.length; _i++) {
  39448. args[_i - 1] = arguments[_i];
  39449. }
  39450. var message = stringify.apply(this, arguments);
  39451. if (core_pusher.log) {
  39452. core_pusher.log(message);
  39453. }
  39454. else if (core_pusher.logToConsole) {
  39455. var log = defaultLoggingFunction.bind(this);
  39456. log(message);
  39457. }
  39458. };
  39459. return Logger;
  39460. }());
  39461. /* harmony default export */ var logger = (new logger_Logger());
  39462. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39463. var urlStore = {
  39464. baseUrl: "https://pusher.com",
  39465. urls: {
  39466. authenticationEndpoint: {
  39467. path: "/docs/authenticating_users",
  39468. },
  39469. javascriptQuickStart: {
  39470. path: "/docs/javascript_quick_start"
  39471. },
  39472. triggeringClientEvents: {
  39473. path: "/docs/client_api_guide/client_events#trigger-events"
  39474. }
  39475. }
  39476. };
  39477. var buildLogSuffix = function (key) {
  39478. var urlPrefix = "See:";
  39479. var urlObj = urlStore.urls[key];
  39480. if (!urlObj)
  39481. return "";
  39482. var url;
  39483. if (urlObj.fullUrl) {
  39484. url = urlObj.fullUrl;
  39485. }
  39486. else if (urlObj.path) {
  39487. url = urlStore.baseUrl + urlObj.path;
  39488. }
  39489. if (!url)
  39490. return "";
  39491. return urlPrefix + " " + url;
  39492. };
  39493. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39494. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39495. var ajax = function (context, socketId, callback) {
  39496. var self = this, xhr;
  39497. xhr = runtime.createXHR();
  39498. xhr.open("POST", self.options.authEndpoint, true);
  39499. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39500. for (var headerName in this.authOptions.headers) {
  39501. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39502. }
  39503. xhr.onreadystatechange = function () {
  39504. if (xhr.readyState === 4) {
  39505. if (xhr.status === 200) {
  39506. var data, parsed = false;
  39507. try {
  39508. data = JSON.parse(xhr.responseText);
  39509. parsed = true;
  39510. }
  39511. catch (e) {
  39512. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39513. }
  39514. if (parsed) {
  39515. callback(false, data);
  39516. }
  39517. }
  39518. else {
  39519. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39520. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39521. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39522. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39523. callback(true, xhr.status);
  39524. }
  39525. }
  39526. };
  39527. xhr.send(this.composeQuery(socketId));
  39528. return xhr;
  39529. };
  39530. /* harmony default export */ var xhr_auth = (ajax);
  39531. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39532. var jsonp = function (context, socketId, callback) {
  39533. if (this.authOptions.headers !== undefined) {
  39534. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39535. }
  39536. var callbackName = context.nextAuthCallbackID.toString();
  39537. context.nextAuthCallbackID++;
  39538. var document = context.getDocument();
  39539. var script = document.createElement("script");
  39540. context.auth_callbacks[callbackName] = function (data) {
  39541. callback(false, data);
  39542. };
  39543. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39544. script.src = this.options.authEndpoint +
  39545. '?callback=' +
  39546. encodeURIComponent(callback_name) +
  39547. '&' +
  39548. this.composeQuery(socketId);
  39549. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39550. head.insertBefore(script, head.firstChild);
  39551. };
  39552. /* harmony default export */ var jsonp_auth = (jsonp);
  39553. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39554. var ScriptRequest = (function () {
  39555. function ScriptRequest(src) {
  39556. this.src = src;
  39557. }
  39558. ScriptRequest.prototype.send = function (receiver) {
  39559. var self = this;
  39560. var errorString = "Error loading " + self.src;
  39561. self.script = document.createElement("script");
  39562. self.script.id = receiver.id;
  39563. self.script.src = self.src;
  39564. self.script.type = "text/javascript";
  39565. self.script.charset = "UTF-8";
  39566. if (self.script.addEventListener) {
  39567. self.script.onerror = function () {
  39568. receiver.callback(errorString);
  39569. };
  39570. self.script.onload = function () {
  39571. receiver.callback(null);
  39572. };
  39573. }
  39574. else {
  39575. self.script.onreadystatechange = function () {
  39576. if (self.script.readyState === 'loaded' ||
  39577. self.script.readyState === 'complete') {
  39578. receiver.callback(null);
  39579. }
  39580. };
  39581. }
  39582. if (self.script.async === undefined && document.attachEvent &&
  39583. /opera/i.test(navigator.userAgent)) {
  39584. self.errorScript = document.createElement("script");
  39585. self.errorScript.id = receiver.id + "_error";
  39586. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39587. self.script.async = self.errorScript.async = false;
  39588. }
  39589. else {
  39590. self.script.async = true;
  39591. }
  39592. var head = document.getElementsByTagName('head')[0];
  39593. head.insertBefore(self.script, head.firstChild);
  39594. if (self.errorScript) {
  39595. head.insertBefore(self.errorScript, self.script.nextSibling);
  39596. }
  39597. };
  39598. ScriptRequest.prototype.cleanup = function () {
  39599. if (this.script) {
  39600. this.script.onload = this.script.onerror = null;
  39601. this.script.onreadystatechange = null;
  39602. }
  39603. if (this.script && this.script.parentNode) {
  39604. this.script.parentNode.removeChild(this.script);
  39605. }
  39606. if (this.errorScript && this.errorScript.parentNode) {
  39607. this.errorScript.parentNode.removeChild(this.errorScript);
  39608. }
  39609. this.script = null;
  39610. this.errorScript = null;
  39611. };
  39612. return ScriptRequest;
  39613. }());
  39614. /* harmony default export */ var script_request = (ScriptRequest);
  39615. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39616. var jsonp_request_JSONPRequest = (function () {
  39617. function JSONPRequest(url, data) {
  39618. this.url = url;
  39619. this.data = data;
  39620. }
  39621. JSONPRequest.prototype.send = function (receiver) {
  39622. if (this.request) {
  39623. return;
  39624. }
  39625. var query = buildQueryString(this.data);
  39626. var url = this.url + "/" + receiver.number + "?" + query;
  39627. this.request = runtime.createScriptRequest(url);
  39628. this.request.send(receiver);
  39629. };
  39630. JSONPRequest.prototype.cleanup = function () {
  39631. if (this.request) {
  39632. this.request.cleanup();
  39633. }
  39634. };
  39635. return JSONPRequest;
  39636. }());
  39637. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39638. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39639. var getAgent = function (sender, useTLS) {
  39640. return function (data, callback) {
  39641. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39642. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39643. var request = runtime.createJSONPRequest(url, data);
  39644. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39645. ScriptReceivers.remove(receiver);
  39646. request.cleanup();
  39647. if (result && result.host) {
  39648. sender.host = result.host;
  39649. }
  39650. if (callback) {
  39651. callback(error, result);
  39652. }
  39653. });
  39654. request.send(receiver);
  39655. };
  39656. };
  39657. var jsonp_timeline_jsonp = {
  39658. name: 'jsonp',
  39659. getAgent: getAgent
  39660. };
  39661. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39662. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39663. function getGenericURL(baseScheme, params, path) {
  39664. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39665. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39666. return scheme + "://" + host + path;
  39667. }
  39668. function getGenericPath(key, queryString) {
  39669. var path = "/app/" + key;
  39670. var query = "?protocol=" + defaults.PROTOCOL +
  39671. "&client=js" +
  39672. "&version=" + defaults.VERSION +
  39673. (queryString ? ("&" + queryString) : "");
  39674. return path + query;
  39675. }
  39676. var ws = {
  39677. getInitial: function (key, params) {
  39678. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39679. return getGenericURL("ws", params, path);
  39680. }
  39681. };
  39682. var http = {
  39683. getInitial: function (key, params) {
  39684. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39685. return getGenericURL("http", params, path);
  39686. }
  39687. };
  39688. var sockjs = {
  39689. getInitial: function (key, params) {
  39690. return getGenericURL("http", params, params.httpPath || "/pusher");
  39691. },
  39692. getPath: function (key, params) {
  39693. return getGenericPath(key);
  39694. }
  39695. };
  39696. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39697. var callback_registry_CallbackRegistry = (function () {
  39698. function CallbackRegistry() {
  39699. this._callbacks = {};
  39700. }
  39701. CallbackRegistry.prototype.get = function (name) {
  39702. return this._callbacks[prefix(name)];
  39703. };
  39704. CallbackRegistry.prototype.add = function (name, callback, context) {
  39705. var prefixedEventName = prefix(name);
  39706. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39707. this._callbacks[prefixedEventName].push({
  39708. fn: callback,
  39709. context: context
  39710. });
  39711. };
  39712. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39713. if (!name && !callback && !context) {
  39714. this._callbacks = {};
  39715. return;
  39716. }
  39717. var names = name ? [prefix(name)] : keys(this._callbacks);
  39718. if (callback || context) {
  39719. this.removeCallback(names, callback, context);
  39720. }
  39721. else {
  39722. this.removeAllCallbacks(names);
  39723. }
  39724. };
  39725. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39726. apply(names, function (name) {
  39727. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39728. return (callback && callback !== binding.fn) ||
  39729. (context && context !== binding.context);
  39730. });
  39731. if (this._callbacks[name].length === 0) {
  39732. delete this._callbacks[name];
  39733. }
  39734. }, this);
  39735. };
  39736. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39737. apply(names, function (name) {
  39738. delete this._callbacks[name];
  39739. }, this);
  39740. };
  39741. return CallbackRegistry;
  39742. }());
  39743. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39744. function prefix(name) {
  39745. return "_" + name;
  39746. }
  39747. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39748. var dispatcher_Dispatcher = (function () {
  39749. function Dispatcher(failThrough) {
  39750. this.callbacks = new callback_registry();
  39751. this.global_callbacks = [];
  39752. this.failThrough = failThrough;
  39753. }
  39754. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39755. this.callbacks.add(eventName, callback, context);
  39756. return this;
  39757. };
  39758. Dispatcher.prototype.bind_global = function (callback) {
  39759. this.global_callbacks.push(callback);
  39760. return this;
  39761. };
  39762. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39763. this.callbacks.remove(eventName, callback, context);
  39764. return this;
  39765. };
  39766. Dispatcher.prototype.unbind_global = function (callback) {
  39767. if (!callback) {
  39768. this.global_callbacks = [];
  39769. return this;
  39770. }
  39771. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39772. return this;
  39773. };
  39774. Dispatcher.prototype.unbind_all = function () {
  39775. this.unbind();
  39776. this.unbind_global();
  39777. return this;
  39778. };
  39779. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39780. for (var i = 0; i < this.global_callbacks.length; i++) {
  39781. this.global_callbacks[i](eventName, data);
  39782. }
  39783. var callbacks = this.callbacks.get(eventName);
  39784. var args = [];
  39785. if (metadata) {
  39786. args.push(data, metadata);
  39787. }
  39788. else if (data) {
  39789. args.push(data);
  39790. }
  39791. if (callbacks && callbacks.length > 0) {
  39792. for (var i = 0; i < callbacks.length; i++) {
  39793. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39794. }
  39795. }
  39796. else if (this.failThrough) {
  39797. this.failThrough(eventName, data);
  39798. }
  39799. return this;
  39800. };
  39801. return Dispatcher;
  39802. }());
  39803. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39804. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39805. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39806. var extendStatics = function (d, b) {
  39807. extendStatics = Object.setPrototypeOf ||
  39808. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39809. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39810. return extendStatics(d, b);
  39811. };
  39812. return function (d, b) {
  39813. extendStatics(d, b);
  39814. function __() { this.constructor = d; }
  39815. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39816. };
  39817. })();
  39818. var transport_connection_TransportConnection = (function (_super) {
  39819. transport_connection_extends(TransportConnection, _super);
  39820. function TransportConnection(hooks, name, priority, key, options) {
  39821. var _this = _super.call(this) || this;
  39822. _this.initialize = runtime.transportConnectionInitializer;
  39823. _this.hooks = hooks;
  39824. _this.name = name;
  39825. _this.priority = priority;
  39826. _this.key = key;
  39827. _this.options = options;
  39828. _this.state = "new";
  39829. _this.timeline = options.timeline;
  39830. _this.activityTimeout = options.activityTimeout;
  39831. _this.id = _this.timeline.generateUniqueID();
  39832. return _this;
  39833. }
  39834. TransportConnection.prototype.handlesActivityChecks = function () {
  39835. return Boolean(this.hooks.handlesActivityChecks);
  39836. };
  39837. TransportConnection.prototype.supportsPing = function () {
  39838. return Boolean(this.hooks.supportsPing);
  39839. };
  39840. TransportConnection.prototype.connect = function () {
  39841. var _this = this;
  39842. if (this.socket || this.state !== "initialized") {
  39843. return false;
  39844. }
  39845. var url = this.hooks.urls.getInitial(this.key, this.options);
  39846. try {
  39847. this.socket = this.hooks.getSocket(url, this.options);
  39848. }
  39849. catch (e) {
  39850. util.defer(function () {
  39851. _this.onError(e);
  39852. _this.changeState("closed");
  39853. });
  39854. return false;
  39855. }
  39856. this.bindListeners();
  39857. logger.debug("Connecting", { transport: this.name, url: url });
  39858. this.changeState("connecting");
  39859. return true;
  39860. };
  39861. TransportConnection.prototype.close = function () {
  39862. if (this.socket) {
  39863. this.socket.close();
  39864. return true;
  39865. }
  39866. else {
  39867. return false;
  39868. }
  39869. };
  39870. TransportConnection.prototype.send = function (data) {
  39871. var _this = this;
  39872. if (this.state === "open") {
  39873. util.defer(function () {
  39874. if (_this.socket) {
  39875. _this.socket.send(data);
  39876. }
  39877. });
  39878. return true;
  39879. }
  39880. else {
  39881. return false;
  39882. }
  39883. };
  39884. TransportConnection.prototype.ping = function () {
  39885. if (this.state === "open" && this.supportsPing()) {
  39886. this.socket.ping();
  39887. }
  39888. };
  39889. TransportConnection.prototype.onOpen = function () {
  39890. if (this.hooks.beforeOpen) {
  39891. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39892. }
  39893. this.changeState("open");
  39894. this.socket.onopen = undefined;
  39895. };
  39896. TransportConnection.prototype.onError = function (error) {
  39897. this.emit("error", { type: 'WebSocketError', error: error });
  39898. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39899. };
  39900. TransportConnection.prototype.onClose = function (closeEvent) {
  39901. if (closeEvent) {
  39902. this.changeState("closed", {
  39903. code: closeEvent.code,
  39904. reason: closeEvent.reason,
  39905. wasClean: closeEvent.wasClean
  39906. });
  39907. }
  39908. else {
  39909. this.changeState("closed");
  39910. }
  39911. this.unbindListeners();
  39912. this.socket = undefined;
  39913. };
  39914. TransportConnection.prototype.onMessage = function (message) {
  39915. this.emit("message", message);
  39916. };
  39917. TransportConnection.prototype.onActivity = function () {
  39918. this.emit("activity");
  39919. };
  39920. TransportConnection.prototype.bindListeners = function () {
  39921. var _this = this;
  39922. this.socket.onopen = function () {
  39923. _this.onOpen();
  39924. };
  39925. this.socket.onerror = function (error) {
  39926. _this.onError(error);
  39927. };
  39928. this.socket.onclose = function (closeEvent) {
  39929. _this.onClose(closeEvent);
  39930. };
  39931. this.socket.onmessage = function (message) {
  39932. _this.onMessage(message);
  39933. };
  39934. if (this.supportsPing()) {
  39935. this.socket.onactivity = function () { _this.onActivity(); };
  39936. }
  39937. };
  39938. TransportConnection.prototype.unbindListeners = function () {
  39939. if (this.socket) {
  39940. this.socket.onopen = undefined;
  39941. this.socket.onerror = undefined;
  39942. this.socket.onclose = undefined;
  39943. this.socket.onmessage = undefined;
  39944. if (this.supportsPing()) {
  39945. this.socket.onactivity = undefined;
  39946. }
  39947. }
  39948. };
  39949. TransportConnection.prototype.changeState = function (state, params) {
  39950. this.state = state;
  39951. this.timeline.info(this.buildTimelineMessage({
  39952. state: state,
  39953. params: params
  39954. }));
  39955. this.emit(state, params);
  39956. };
  39957. TransportConnection.prototype.buildTimelineMessage = function (message) {
  39958. return extend({ cid: this.id }, message);
  39959. };
  39960. return TransportConnection;
  39961. }(dispatcher));
  39962. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  39963. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  39964. var transport_Transport = (function () {
  39965. function Transport(hooks) {
  39966. this.hooks = hooks;
  39967. }
  39968. Transport.prototype.isSupported = function (environment) {
  39969. return this.hooks.isSupported(environment);
  39970. };
  39971. Transport.prototype.createConnection = function (name, priority, key, options) {
  39972. return new transport_connection(this.hooks, name, priority, key, options);
  39973. };
  39974. return Transport;
  39975. }());
  39976. /* harmony default export */ var transports_transport = (transport_Transport);
  39977. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  39978. var WSTransport = new transports_transport({
  39979. urls: ws,
  39980. handlesActivityChecks: false,
  39981. supportsPing: false,
  39982. isInitialized: function () {
  39983. return Boolean(runtime.getWebSocketAPI());
  39984. },
  39985. isSupported: function () {
  39986. return Boolean(runtime.getWebSocketAPI());
  39987. },
  39988. getSocket: function (url) {
  39989. return runtime.createWebSocket(url);
  39990. }
  39991. });
  39992. var httpConfiguration = {
  39993. urls: http,
  39994. handlesActivityChecks: false,
  39995. supportsPing: true,
  39996. isInitialized: function () {
  39997. return true;
  39998. }
  39999. };
  40000. var streamingConfiguration = extend({ getSocket: function (url) {
  40001. return runtime.HTTPFactory.createStreamingSocket(url);
  40002. }
  40003. }, httpConfiguration);
  40004. var pollingConfiguration = extend({ getSocket: function (url) {
  40005. return runtime.HTTPFactory.createPollingSocket(url);
  40006. }
  40007. }, httpConfiguration);
  40008. var xhrConfiguration = {
  40009. isSupported: function () {
  40010. return runtime.isXHRSupported();
  40011. }
  40012. };
  40013. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40014. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40015. var Transports = {
  40016. ws: WSTransport,
  40017. xhr_streaming: XHRStreamingTransport,
  40018. xhr_polling: XHRPollingTransport
  40019. };
  40020. /* harmony default export */ var transports = (Transports);
  40021. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40022. var SockJSTransport = new transports_transport({
  40023. file: "sockjs",
  40024. urls: sockjs,
  40025. handlesActivityChecks: true,
  40026. supportsPing: false,
  40027. isSupported: function () {
  40028. return true;
  40029. },
  40030. isInitialized: function () {
  40031. return window.SockJS !== undefined;
  40032. },
  40033. getSocket: function (url, options) {
  40034. return new window.SockJS(url, null, {
  40035. js_path: Dependencies.getPath("sockjs", {
  40036. useTLS: options.useTLS
  40037. }),
  40038. ignore_null_origin: options.ignoreNullOrigin
  40039. });
  40040. },
  40041. beforeOpen: function (socket, path) {
  40042. socket.send(JSON.stringify({
  40043. path: path
  40044. }));
  40045. }
  40046. });
  40047. var xdrConfiguration = {
  40048. isSupported: function (environment) {
  40049. var yes = runtime.isXDRSupported(environment.useTLS);
  40050. return yes;
  40051. }
  40052. };
  40053. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40054. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40055. transports.xdr_streaming = XDRStreamingTransport;
  40056. transports.xdr_polling = XDRPollingTransport;
  40057. transports.sockjs = SockJSTransport;
  40058. /* harmony default export */ var transports_transports = (transports);
  40059. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40060. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40061. var extendStatics = function (d, b) {
  40062. extendStatics = Object.setPrototypeOf ||
  40063. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40064. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40065. return extendStatics(d, b);
  40066. };
  40067. return function (d, b) {
  40068. extendStatics(d, b);
  40069. function __() { this.constructor = d; }
  40070. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40071. };
  40072. })();
  40073. var NetInfo = (function (_super) {
  40074. net_info_extends(NetInfo, _super);
  40075. function NetInfo() {
  40076. var _this = _super.call(this) || this;
  40077. var self = _this;
  40078. if (window.addEventListener !== undefined) {
  40079. window.addEventListener("online", function () {
  40080. self.emit('online');
  40081. }, false);
  40082. window.addEventListener("offline", function () {
  40083. self.emit('offline');
  40084. }, false);
  40085. }
  40086. return _this;
  40087. }
  40088. NetInfo.prototype.isOnline = function () {
  40089. if (window.navigator.onLine === undefined) {
  40090. return true;
  40091. }
  40092. else {
  40093. return window.navigator.onLine;
  40094. }
  40095. };
  40096. return NetInfo;
  40097. }(dispatcher));
  40098. var net_info_Network = new NetInfo();
  40099. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40100. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40101. function AssistantToTheTransportManager(manager, transport, options) {
  40102. this.manager = manager;
  40103. this.transport = transport;
  40104. this.minPingDelay = options.minPingDelay;
  40105. this.maxPingDelay = options.maxPingDelay;
  40106. this.pingDelay = undefined;
  40107. }
  40108. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40109. var _this = this;
  40110. options = extend({}, options, {
  40111. activityTimeout: this.pingDelay
  40112. });
  40113. var connection = this.transport.createConnection(name, priority, key, options);
  40114. var openTimestamp = null;
  40115. var onOpen = function () {
  40116. connection.unbind("open", onOpen);
  40117. connection.bind("closed", onClosed);
  40118. openTimestamp = util.now();
  40119. };
  40120. var onClosed = function (closeEvent) {
  40121. connection.unbind("closed", onClosed);
  40122. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40123. _this.manager.reportDeath();
  40124. }
  40125. else if (!closeEvent.wasClean && openTimestamp) {
  40126. var lifespan = util.now() - openTimestamp;
  40127. if (lifespan < 2 * _this.maxPingDelay) {
  40128. _this.manager.reportDeath();
  40129. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40130. }
  40131. }
  40132. };
  40133. connection.bind("open", onOpen);
  40134. return connection;
  40135. };
  40136. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40137. return this.manager.isAlive() && this.transport.isSupported(environment);
  40138. };
  40139. return AssistantToTheTransportManager;
  40140. }());
  40141. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40142. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40143. var Protocol = {
  40144. decodeMessage: function (messageEvent) {
  40145. try {
  40146. var messageData = JSON.parse(messageEvent.data);
  40147. var pusherEventData = messageData.data;
  40148. if (typeof pusherEventData === 'string') {
  40149. try {
  40150. pusherEventData = JSON.parse(messageData.data);
  40151. }
  40152. catch (e) { }
  40153. }
  40154. var pusherEvent = {
  40155. event: messageData.event,
  40156. channel: messageData.channel,
  40157. data: pusherEventData,
  40158. };
  40159. if (messageData.user_id) {
  40160. pusherEvent.user_id = messageData.user_id;
  40161. }
  40162. return pusherEvent;
  40163. }
  40164. catch (e) {
  40165. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40166. }
  40167. },
  40168. encodeMessage: function (event) {
  40169. return JSON.stringify(event);
  40170. },
  40171. processHandshake: function (messageEvent) {
  40172. var message = Protocol.decodeMessage(messageEvent);
  40173. if (message.event === "pusher:connection_established") {
  40174. if (!message.data.activity_timeout) {
  40175. throw "No activity timeout specified in handshake";
  40176. }
  40177. return {
  40178. action: "connected",
  40179. id: message.data.socket_id,
  40180. activityTimeout: message.data.activity_timeout * 1000
  40181. };
  40182. }
  40183. else if (message.event === "pusher:error") {
  40184. return {
  40185. action: this.getCloseAction(message.data),
  40186. error: this.getCloseError(message.data)
  40187. };
  40188. }
  40189. else {
  40190. throw "Invalid handshake";
  40191. }
  40192. },
  40193. getCloseAction: function (closeEvent) {
  40194. if (closeEvent.code < 4000) {
  40195. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40196. return "backoff";
  40197. }
  40198. else {
  40199. return null;
  40200. }
  40201. }
  40202. else if (closeEvent.code === 4000) {
  40203. return "tls_only";
  40204. }
  40205. else if (closeEvent.code < 4100) {
  40206. return "refused";
  40207. }
  40208. else if (closeEvent.code < 4200) {
  40209. return "backoff";
  40210. }
  40211. else if (closeEvent.code < 4300) {
  40212. return "retry";
  40213. }
  40214. else {
  40215. return "refused";
  40216. }
  40217. },
  40218. getCloseError: function (closeEvent) {
  40219. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40220. return {
  40221. type: 'PusherError',
  40222. data: {
  40223. code: closeEvent.code,
  40224. message: closeEvent.reason || closeEvent.message
  40225. }
  40226. };
  40227. }
  40228. else {
  40229. return null;
  40230. }
  40231. }
  40232. };
  40233. /* harmony default export */ var protocol_protocol = (Protocol);
  40234. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40235. var connection_extends = (undefined && undefined.__extends) || (function () {
  40236. var extendStatics = function (d, b) {
  40237. extendStatics = Object.setPrototypeOf ||
  40238. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40239. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40240. return extendStatics(d, b);
  40241. };
  40242. return function (d, b) {
  40243. extendStatics(d, b);
  40244. function __() { this.constructor = d; }
  40245. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40246. };
  40247. })();
  40248. var connection_Connection = (function (_super) {
  40249. connection_extends(Connection, _super);
  40250. function Connection(id, transport) {
  40251. var _this = _super.call(this) || this;
  40252. _this.id = id;
  40253. _this.transport = transport;
  40254. _this.activityTimeout = transport.activityTimeout;
  40255. _this.bindListeners();
  40256. return _this;
  40257. }
  40258. Connection.prototype.handlesActivityChecks = function () {
  40259. return this.transport.handlesActivityChecks();
  40260. };
  40261. Connection.prototype.send = function (data) {
  40262. return this.transport.send(data);
  40263. };
  40264. Connection.prototype.send_event = function (name, data, channel) {
  40265. var event = { event: name, data: data };
  40266. if (channel) {
  40267. event.channel = channel;
  40268. }
  40269. logger.debug('Event sent', event);
  40270. return this.send(protocol_protocol.encodeMessage(event));
  40271. };
  40272. Connection.prototype.ping = function () {
  40273. if (this.transport.supportsPing()) {
  40274. this.transport.ping();
  40275. }
  40276. else {
  40277. this.send_event('pusher:ping', {});
  40278. }
  40279. };
  40280. Connection.prototype.close = function () {
  40281. this.transport.close();
  40282. };
  40283. Connection.prototype.bindListeners = function () {
  40284. var _this = this;
  40285. var listeners = {
  40286. message: function (messageEvent) {
  40287. var pusherEvent;
  40288. try {
  40289. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40290. }
  40291. catch (e) {
  40292. _this.emit('error', {
  40293. type: 'MessageParseError',
  40294. error: e,
  40295. data: messageEvent.data
  40296. });
  40297. }
  40298. if (pusherEvent !== undefined) {
  40299. logger.debug('Event recd', pusherEvent);
  40300. switch (pusherEvent.event) {
  40301. case 'pusher:error':
  40302. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40303. break;
  40304. case 'pusher:ping':
  40305. _this.emit("ping");
  40306. break;
  40307. case 'pusher:pong':
  40308. _this.emit("pong");
  40309. break;
  40310. }
  40311. _this.emit('message', pusherEvent);
  40312. }
  40313. },
  40314. activity: function () {
  40315. _this.emit("activity");
  40316. },
  40317. error: function (error) {
  40318. _this.emit("error", { type: "WebSocketError", error: error });
  40319. },
  40320. closed: function (closeEvent) {
  40321. unbindListeners();
  40322. if (closeEvent && closeEvent.code) {
  40323. _this.handleCloseEvent(closeEvent);
  40324. }
  40325. _this.transport = null;
  40326. _this.emit("closed");
  40327. }
  40328. };
  40329. var unbindListeners = function () {
  40330. objectApply(listeners, function (listener, event) {
  40331. _this.transport.unbind(event, listener);
  40332. });
  40333. };
  40334. objectApply(listeners, function (listener, event) {
  40335. _this.transport.bind(event, listener);
  40336. });
  40337. };
  40338. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40339. var action = protocol_protocol.getCloseAction(closeEvent);
  40340. var error = protocol_protocol.getCloseError(closeEvent);
  40341. if (error) {
  40342. this.emit('error', error);
  40343. }
  40344. if (action) {
  40345. this.emit(action, { action: action, error: error });
  40346. }
  40347. };
  40348. return Connection;
  40349. }(dispatcher));
  40350. /* harmony default export */ var connection_connection = (connection_Connection);
  40351. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40352. var handshake_Handshake = (function () {
  40353. function Handshake(transport, callback) {
  40354. this.transport = transport;
  40355. this.callback = callback;
  40356. this.bindListeners();
  40357. }
  40358. Handshake.prototype.close = function () {
  40359. this.unbindListeners();
  40360. this.transport.close();
  40361. };
  40362. Handshake.prototype.bindListeners = function () {
  40363. var _this = this;
  40364. this.onMessage = function (m) {
  40365. _this.unbindListeners();
  40366. var result;
  40367. try {
  40368. result = protocol_protocol.processHandshake(m);
  40369. }
  40370. catch (e) {
  40371. _this.finish("error", { error: e });
  40372. _this.transport.close();
  40373. return;
  40374. }
  40375. if (result.action === "connected") {
  40376. _this.finish("connected", {
  40377. connection: new connection_connection(result.id, _this.transport),
  40378. activityTimeout: result.activityTimeout
  40379. });
  40380. }
  40381. else {
  40382. _this.finish(result.action, { error: result.error });
  40383. _this.transport.close();
  40384. }
  40385. };
  40386. this.onClosed = function (closeEvent) {
  40387. _this.unbindListeners();
  40388. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40389. var error = protocol_protocol.getCloseError(closeEvent);
  40390. _this.finish(action, { error: error });
  40391. };
  40392. this.transport.bind("message", this.onMessage);
  40393. this.transport.bind("closed", this.onClosed);
  40394. };
  40395. Handshake.prototype.unbindListeners = function () {
  40396. this.transport.unbind("message", this.onMessage);
  40397. this.transport.unbind("closed", this.onClosed);
  40398. };
  40399. Handshake.prototype.finish = function (action, params) {
  40400. this.callback(extend({ transport: this.transport, action: action }, params));
  40401. };
  40402. return Handshake;
  40403. }());
  40404. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40405. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40406. var pusher_authorizer_PusherAuthorizer = (function () {
  40407. function PusherAuthorizer(channel, options) {
  40408. this.channel = channel;
  40409. var authTransport = options.authTransport;
  40410. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40411. throw "'" + authTransport + "' is not a recognized auth transport";
  40412. }
  40413. this.type = authTransport;
  40414. this.options = options;
  40415. this.authOptions = (options || {}).auth || {};
  40416. }
  40417. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40418. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40419. '&channel_name=' + encodeURIComponent(this.channel.name);
  40420. for (var i in this.authOptions.params) {
  40421. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40422. }
  40423. return query;
  40424. };
  40425. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40426. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40427. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40428. };
  40429. return PusherAuthorizer;
  40430. }());
  40431. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40432. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40433. var timeline_sender_TimelineSender = (function () {
  40434. function TimelineSender(timeline, options) {
  40435. this.timeline = timeline;
  40436. this.options = options || {};
  40437. }
  40438. TimelineSender.prototype.send = function (useTLS, callback) {
  40439. if (this.timeline.isEmpty()) {
  40440. return;
  40441. }
  40442. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40443. };
  40444. return TimelineSender;
  40445. }());
  40446. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40447. // CONCATENATED MODULE: ./src/core/errors.ts
  40448. var errors_extends = (undefined && undefined.__extends) || (function () {
  40449. var extendStatics = function (d, b) {
  40450. extendStatics = Object.setPrototypeOf ||
  40451. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40452. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40453. return extendStatics(d, b);
  40454. };
  40455. return function (d, b) {
  40456. extendStatics(d, b);
  40457. function __() { this.constructor = d; }
  40458. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40459. };
  40460. })();
  40461. var BadEventName = (function (_super) {
  40462. errors_extends(BadEventName, _super);
  40463. function BadEventName(msg) {
  40464. var _newTarget = this.constructor;
  40465. var _this = _super.call(this, msg) || this;
  40466. Object.setPrototypeOf(_this, _newTarget.prototype);
  40467. return _this;
  40468. }
  40469. return BadEventName;
  40470. }(Error));
  40471. var RequestTimedOut = (function (_super) {
  40472. errors_extends(RequestTimedOut, _super);
  40473. function RequestTimedOut(msg) {
  40474. var _newTarget = this.constructor;
  40475. var _this = _super.call(this, msg) || this;
  40476. Object.setPrototypeOf(_this, _newTarget.prototype);
  40477. return _this;
  40478. }
  40479. return RequestTimedOut;
  40480. }(Error));
  40481. var TransportPriorityTooLow = (function (_super) {
  40482. errors_extends(TransportPriorityTooLow, _super);
  40483. function TransportPriorityTooLow(msg) {
  40484. var _newTarget = this.constructor;
  40485. var _this = _super.call(this, msg) || this;
  40486. Object.setPrototypeOf(_this, _newTarget.prototype);
  40487. return _this;
  40488. }
  40489. return TransportPriorityTooLow;
  40490. }(Error));
  40491. var TransportClosed = (function (_super) {
  40492. errors_extends(TransportClosed, _super);
  40493. function TransportClosed(msg) {
  40494. var _newTarget = this.constructor;
  40495. var _this = _super.call(this, msg) || this;
  40496. Object.setPrototypeOf(_this, _newTarget.prototype);
  40497. return _this;
  40498. }
  40499. return TransportClosed;
  40500. }(Error));
  40501. var UnsupportedFeature = (function (_super) {
  40502. errors_extends(UnsupportedFeature, _super);
  40503. function UnsupportedFeature(msg) {
  40504. var _newTarget = this.constructor;
  40505. var _this = _super.call(this, msg) || this;
  40506. Object.setPrototypeOf(_this, _newTarget.prototype);
  40507. return _this;
  40508. }
  40509. return UnsupportedFeature;
  40510. }(Error));
  40511. var UnsupportedTransport = (function (_super) {
  40512. errors_extends(UnsupportedTransport, _super);
  40513. function UnsupportedTransport(msg) {
  40514. var _newTarget = this.constructor;
  40515. var _this = _super.call(this, msg) || this;
  40516. Object.setPrototypeOf(_this, _newTarget.prototype);
  40517. return _this;
  40518. }
  40519. return UnsupportedTransport;
  40520. }(Error));
  40521. var UnsupportedStrategy = (function (_super) {
  40522. errors_extends(UnsupportedStrategy, _super);
  40523. function UnsupportedStrategy(msg) {
  40524. var _newTarget = this.constructor;
  40525. var _this = _super.call(this, msg) || this;
  40526. Object.setPrototypeOf(_this, _newTarget.prototype);
  40527. return _this;
  40528. }
  40529. return UnsupportedStrategy;
  40530. }(Error));
  40531. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40532. var channel_extends = (undefined && undefined.__extends) || (function () {
  40533. var extendStatics = function (d, b) {
  40534. extendStatics = Object.setPrototypeOf ||
  40535. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40536. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40537. return extendStatics(d, b);
  40538. };
  40539. return function (d, b) {
  40540. extendStatics(d, b);
  40541. function __() { this.constructor = d; }
  40542. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40543. };
  40544. })();
  40545. var channel_Channel = (function (_super) {
  40546. channel_extends(Channel, _super);
  40547. function Channel(name, pusher) {
  40548. var _this = _super.call(this, function (event, data) {
  40549. logger.debug('No callbacks on ' + name + ' for ' + event);
  40550. }) || this;
  40551. _this.name = name;
  40552. _this.pusher = pusher;
  40553. _this.subscribed = false;
  40554. _this.subscriptionPending = false;
  40555. _this.subscriptionCancelled = false;
  40556. return _this;
  40557. }
  40558. Channel.prototype.authorize = function (socketId, callback) {
  40559. return callback(false, {});
  40560. };
  40561. Channel.prototype.trigger = function (event, data) {
  40562. if (event.indexOf("client-") !== 0) {
  40563. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40564. }
  40565. if (!this.subscribed) {
  40566. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40567. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40568. }
  40569. return this.pusher.send_event(event, data, this.name);
  40570. };
  40571. Channel.prototype.disconnect = function () {
  40572. this.subscribed = false;
  40573. this.subscriptionPending = false;
  40574. };
  40575. Channel.prototype.handleEvent = function (event) {
  40576. var eventName = event.event;
  40577. var data = event.data;
  40578. if (eventName === "pusher_internal:subscription_succeeded") {
  40579. this.handleSubscriptionSucceededEvent(event);
  40580. }
  40581. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40582. var metadata = {};
  40583. this.emit(eventName, data, metadata);
  40584. }
  40585. };
  40586. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40587. this.subscriptionPending = false;
  40588. this.subscribed = true;
  40589. if (this.subscriptionCancelled) {
  40590. this.pusher.unsubscribe(this.name);
  40591. }
  40592. else {
  40593. this.emit("pusher:subscription_succeeded", event.data);
  40594. }
  40595. };
  40596. Channel.prototype.subscribe = function () {
  40597. var _this = this;
  40598. if (this.subscribed) {
  40599. return;
  40600. }
  40601. this.subscriptionPending = true;
  40602. this.subscriptionCancelled = false;
  40603. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40604. if (error) {
  40605. logger.error(data);
  40606. _this.emit('pusher:subscription_error', data);
  40607. }
  40608. else {
  40609. _this.pusher.send_event('pusher:subscribe', {
  40610. auth: data.auth,
  40611. channel_data: data.channel_data,
  40612. channel: _this.name
  40613. });
  40614. }
  40615. });
  40616. };
  40617. Channel.prototype.unsubscribe = function () {
  40618. this.subscribed = false;
  40619. this.pusher.send_event('pusher:unsubscribe', {
  40620. channel: this.name
  40621. });
  40622. };
  40623. Channel.prototype.cancelSubscription = function () {
  40624. this.subscriptionCancelled = true;
  40625. };
  40626. Channel.prototype.reinstateSubscription = function () {
  40627. this.subscriptionCancelled = false;
  40628. };
  40629. return Channel;
  40630. }(dispatcher));
  40631. /* harmony default export */ var channels_channel = (channel_Channel);
  40632. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40633. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40634. var extendStatics = function (d, b) {
  40635. extendStatics = Object.setPrototypeOf ||
  40636. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40637. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40638. return extendStatics(d, b);
  40639. };
  40640. return function (d, b) {
  40641. extendStatics(d, b);
  40642. function __() { this.constructor = d; }
  40643. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40644. };
  40645. })();
  40646. var private_channel_PrivateChannel = (function (_super) {
  40647. private_channel_extends(PrivateChannel, _super);
  40648. function PrivateChannel() {
  40649. return _super !== null && _super.apply(this, arguments) || this;
  40650. }
  40651. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40652. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40653. return authorizer.authorize(socketId, callback);
  40654. };
  40655. return PrivateChannel;
  40656. }(channels_channel));
  40657. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40658. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40659. var members_Members = (function () {
  40660. function Members() {
  40661. this.reset();
  40662. }
  40663. Members.prototype.get = function (id) {
  40664. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40665. return {
  40666. id: id,
  40667. info: this.members[id]
  40668. };
  40669. }
  40670. else {
  40671. return null;
  40672. }
  40673. };
  40674. Members.prototype.each = function (callback) {
  40675. var _this = this;
  40676. objectApply(this.members, function (member, id) {
  40677. callback(_this.get(id));
  40678. });
  40679. };
  40680. Members.prototype.setMyID = function (id) {
  40681. this.myID = id;
  40682. };
  40683. Members.prototype.onSubscription = function (subscriptionData) {
  40684. this.members = subscriptionData.presence.hash;
  40685. this.count = subscriptionData.presence.count;
  40686. this.me = this.get(this.myID);
  40687. };
  40688. Members.prototype.addMember = function (memberData) {
  40689. if (this.get(memberData.user_id) === null) {
  40690. this.count++;
  40691. }
  40692. this.members[memberData.user_id] = memberData.user_info;
  40693. return this.get(memberData.user_id);
  40694. };
  40695. Members.prototype.removeMember = function (memberData) {
  40696. var member = this.get(memberData.user_id);
  40697. if (member) {
  40698. delete this.members[memberData.user_id];
  40699. this.count--;
  40700. }
  40701. return member;
  40702. };
  40703. Members.prototype.reset = function () {
  40704. this.members = {};
  40705. this.count = 0;
  40706. this.myID = null;
  40707. this.me = null;
  40708. };
  40709. return Members;
  40710. }());
  40711. /* harmony default export */ var members = (members_Members);
  40712. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40713. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40714. var extendStatics = function (d, b) {
  40715. extendStatics = Object.setPrototypeOf ||
  40716. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40717. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40718. return extendStatics(d, b);
  40719. };
  40720. return function (d, b) {
  40721. extendStatics(d, b);
  40722. function __() { this.constructor = d; }
  40723. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40724. };
  40725. })();
  40726. var presence_channel_PresenceChannel = (function (_super) {
  40727. presence_channel_extends(PresenceChannel, _super);
  40728. function PresenceChannel(name, pusher) {
  40729. var _this = _super.call(this, name, pusher) || this;
  40730. _this.members = new members();
  40731. return _this;
  40732. }
  40733. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40734. var _this = this;
  40735. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40736. if (!error) {
  40737. if (authData.channel_data === undefined) {
  40738. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40739. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40740. ("expected 'channel_data' field. " + suffix));
  40741. callback("Invalid auth response");
  40742. return;
  40743. }
  40744. var channelData = JSON.parse(authData.channel_data);
  40745. _this.members.setMyID(channelData.user_id);
  40746. }
  40747. callback(error, authData);
  40748. });
  40749. };
  40750. PresenceChannel.prototype.handleEvent = function (event) {
  40751. var eventName = event.event;
  40752. if (eventName.indexOf("pusher_internal:") === 0) {
  40753. this.handleInternalEvent(event);
  40754. }
  40755. else {
  40756. var data = event.data;
  40757. var metadata = {};
  40758. if (event.user_id) {
  40759. metadata.user_id = event.user_id;
  40760. }
  40761. this.emit(eventName, data, metadata);
  40762. }
  40763. };
  40764. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40765. var eventName = event.event;
  40766. var data = event.data;
  40767. switch (eventName) {
  40768. case "pusher_internal:subscription_succeeded":
  40769. this.handleSubscriptionSucceededEvent(event);
  40770. break;
  40771. case "pusher_internal:member_added":
  40772. var addedMember = this.members.addMember(data);
  40773. this.emit('pusher:member_added', addedMember);
  40774. break;
  40775. case "pusher_internal:member_removed":
  40776. var removedMember = this.members.removeMember(data);
  40777. if (removedMember) {
  40778. this.emit('pusher:member_removed', removedMember);
  40779. }
  40780. break;
  40781. }
  40782. };
  40783. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40784. this.subscriptionPending = false;
  40785. this.subscribed = true;
  40786. if (this.subscriptionCancelled) {
  40787. this.pusher.unsubscribe(this.name);
  40788. }
  40789. else {
  40790. this.members.onSubscription(event.data);
  40791. this.emit("pusher:subscription_succeeded", this.members);
  40792. }
  40793. };
  40794. PresenceChannel.prototype.disconnect = function () {
  40795. this.members.reset();
  40796. _super.prototype.disconnect.call(this);
  40797. };
  40798. return PresenceChannel;
  40799. }(private_channel));
  40800. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40801. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40802. var nacl_fast = __webpack_require__(0);
  40803. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40804. var nacl_util = __webpack_require__(1);
  40805. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40806. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40807. var extendStatics = function (d, b) {
  40808. extendStatics = Object.setPrototypeOf ||
  40809. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40810. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40811. return extendStatics(d, b);
  40812. };
  40813. return function (d, b) {
  40814. extendStatics(d, b);
  40815. function __() { this.constructor = d; }
  40816. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40817. };
  40818. })();
  40819. var encrypted_channel_EncryptedChannel = (function (_super) {
  40820. encrypted_channel_extends(EncryptedChannel, _super);
  40821. function EncryptedChannel() {
  40822. var _this = _super !== null && _super.apply(this, arguments) || this;
  40823. _this.key = null;
  40824. return _this;
  40825. }
  40826. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40827. var _this = this;
  40828. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40829. if (error) {
  40830. callback(true, authData);
  40831. return;
  40832. }
  40833. var sharedSecret = authData["shared_secret"];
  40834. if (!sharedSecret) {
  40835. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40836. callback(true, errorMsg);
  40837. return;
  40838. }
  40839. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40840. delete authData["shared_secret"];
  40841. callback(false, authData);
  40842. });
  40843. };
  40844. EncryptedChannel.prototype.trigger = function (event, data) {
  40845. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40846. };
  40847. EncryptedChannel.prototype.handleEvent = function (event) {
  40848. var eventName = event.event;
  40849. var data = event.data;
  40850. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40851. _super.prototype.handleEvent.call(this, event);
  40852. return;
  40853. }
  40854. this.handleEncryptedEvent(eventName, data);
  40855. };
  40856. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40857. var _this = this;
  40858. if (!this.key) {
  40859. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40860. return;
  40861. }
  40862. if (!data.ciphertext || !data.nonce) {
  40863. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40864. return;
  40865. }
  40866. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40867. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40868. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40869. return;
  40870. }
  40871. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40872. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40873. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40874. return;
  40875. }
  40876. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40877. if (bytes === null) {
  40878. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40879. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40880. if (error) {
  40881. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40882. return;
  40883. }
  40884. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40885. if (bytes === null) {
  40886. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40887. return;
  40888. }
  40889. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40890. return;
  40891. });
  40892. return;
  40893. }
  40894. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40895. };
  40896. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40897. try {
  40898. this.emit(eventName, JSON.parse(data));
  40899. }
  40900. catch (e) {
  40901. this.emit(eventName, data);
  40902. }
  40903. return this;
  40904. };
  40905. return EncryptedChannel;
  40906. }(private_channel));
  40907. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  40908. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  40909. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  40910. var extendStatics = function (d, b) {
  40911. extendStatics = Object.setPrototypeOf ||
  40912. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40913. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40914. return extendStatics(d, b);
  40915. };
  40916. return function (d, b) {
  40917. extendStatics(d, b);
  40918. function __() { this.constructor = d; }
  40919. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40920. };
  40921. })();
  40922. var connection_manager_ConnectionManager = (function (_super) {
  40923. connection_manager_extends(ConnectionManager, _super);
  40924. function ConnectionManager(key, options) {
  40925. var _this = _super.call(this) || this;
  40926. _this.key = key;
  40927. _this.options = options || {};
  40928. _this.state = "initialized";
  40929. _this.connection = null;
  40930. _this.usingTLS = !!options.useTLS;
  40931. _this.timeline = _this.options.timeline;
  40932. _this.errorCallbacks = _this.buildErrorCallbacks();
  40933. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  40934. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  40935. var Network = runtime.getNetwork();
  40936. Network.bind("online", function () {
  40937. _this.timeline.info({ netinfo: "online" });
  40938. if (_this.state === "connecting" || _this.state === "unavailable") {
  40939. _this.retryIn(0);
  40940. }
  40941. });
  40942. Network.bind("offline", function () {
  40943. _this.timeline.info({ netinfo: "offline" });
  40944. if (_this.connection) {
  40945. _this.sendActivityCheck();
  40946. }
  40947. });
  40948. _this.updateStrategy();
  40949. return _this;
  40950. }
  40951. ConnectionManager.prototype.connect = function () {
  40952. if (this.connection || this.runner) {
  40953. return;
  40954. }
  40955. if (!this.strategy.isSupported()) {
  40956. this.updateState("failed");
  40957. return;
  40958. }
  40959. this.updateState("connecting");
  40960. this.startConnecting();
  40961. this.setUnavailableTimer();
  40962. };
  40963. ;
  40964. ConnectionManager.prototype.send = function (data) {
  40965. if (this.connection) {
  40966. return this.connection.send(data);
  40967. }
  40968. else {
  40969. return false;
  40970. }
  40971. };
  40972. ;
  40973. ConnectionManager.prototype.send_event = function (name, data, channel) {
  40974. if (this.connection) {
  40975. return this.connection.send_event(name, data, channel);
  40976. }
  40977. else {
  40978. return false;
  40979. }
  40980. };
  40981. ;
  40982. ConnectionManager.prototype.disconnect = function () {
  40983. this.disconnectInternally();
  40984. this.updateState("disconnected");
  40985. };
  40986. ;
  40987. ConnectionManager.prototype.isUsingTLS = function () {
  40988. return this.usingTLS;
  40989. };
  40990. ;
  40991. ConnectionManager.prototype.startConnecting = function () {
  40992. var _this = this;
  40993. var callback = function (error, handshake) {
  40994. if (error) {
  40995. _this.runner = _this.strategy.connect(0, callback);
  40996. }
  40997. else {
  40998. if (handshake.action === "error") {
  40999. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41000. _this.timeline.error({ handshakeError: handshake.error });
  41001. }
  41002. else {
  41003. _this.abortConnecting();
  41004. _this.handshakeCallbacks[handshake.action](handshake);
  41005. }
  41006. }
  41007. };
  41008. this.runner = this.strategy.connect(0, callback);
  41009. };
  41010. ;
  41011. ConnectionManager.prototype.abortConnecting = function () {
  41012. if (this.runner) {
  41013. this.runner.abort();
  41014. this.runner = null;
  41015. }
  41016. };
  41017. ;
  41018. ConnectionManager.prototype.disconnectInternally = function () {
  41019. this.abortConnecting();
  41020. this.clearRetryTimer();
  41021. this.clearUnavailableTimer();
  41022. if (this.connection) {
  41023. var connection = this.abandonConnection();
  41024. connection.close();
  41025. }
  41026. };
  41027. ;
  41028. ConnectionManager.prototype.updateStrategy = function () {
  41029. this.strategy = this.options.getStrategy({
  41030. key: this.key,
  41031. timeline: this.timeline,
  41032. useTLS: this.usingTLS
  41033. });
  41034. };
  41035. ;
  41036. ConnectionManager.prototype.retryIn = function (delay) {
  41037. var _this = this;
  41038. this.timeline.info({ action: "retry", delay: delay });
  41039. if (delay > 0) {
  41040. this.emit("connecting_in", Math.round(delay / 1000));
  41041. }
  41042. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41043. _this.disconnectInternally();
  41044. _this.connect();
  41045. });
  41046. };
  41047. ;
  41048. ConnectionManager.prototype.clearRetryTimer = function () {
  41049. if (this.retryTimer) {
  41050. this.retryTimer.ensureAborted();
  41051. this.retryTimer = null;
  41052. }
  41053. };
  41054. ;
  41055. ConnectionManager.prototype.setUnavailableTimer = function () {
  41056. var _this = this;
  41057. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41058. _this.updateState("unavailable");
  41059. });
  41060. };
  41061. ;
  41062. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41063. if (this.unavailableTimer) {
  41064. this.unavailableTimer.ensureAborted();
  41065. }
  41066. };
  41067. ;
  41068. ConnectionManager.prototype.sendActivityCheck = function () {
  41069. var _this = this;
  41070. this.stopActivityCheck();
  41071. this.connection.ping();
  41072. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41073. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41074. _this.retryIn(0);
  41075. });
  41076. };
  41077. ;
  41078. ConnectionManager.prototype.resetActivityCheck = function () {
  41079. var _this = this;
  41080. this.stopActivityCheck();
  41081. if (this.connection && !this.connection.handlesActivityChecks()) {
  41082. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41083. _this.sendActivityCheck();
  41084. });
  41085. }
  41086. };
  41087. ;
  41088. ConnectionManager.prototype.stopActivityCheck = function () {
  41089. if (this.activityTimer) {
  41090. this.activityTimer.ensureAborted();
  41091. }
  41092. };
  41093. ;
  41094. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41095. var _this = this;
  41096. return extend({}, errorCallbacks, {
  41097. message: function (message) {
  41098. _this.resetActivityCheck();
  41099. _this.emit('message', message);
  41100. },
  41101. ping: function () {
  41102. _this.send_event('pusher:pong', {});
  41103. },
  41104. activity: function () {
  41105. _this.resetActivityCheck();
  41106. },
  41107. error: function (error) {
  41108. _this.emit("error", { type: "WebSocketError", error: error });
  41109. },
  41110. closed: function () {
  41111. _this.abandonConnection();
  41112. if (_this.shouldRetry()) {
  41113. _this.retryIn(1000);
  41114. }
  41115. }
  41116. });
  41117. };
  41118. ;
  41119. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41120. var _this = this;
  41121. return extend({}, errorCallbacks, {
  41122. connected: function (handshake) {
  41123. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41124. _this.clearUnavailableTimer();
  41125. _this.setConnection(handshake.connection);
  41126. _this.socket_id = _this.connection.id;
  41127. _this.updateState("connected", { socket_id: _this.socket_id });
  41128. }
  41129. });
  41130. };
  41131. ;
  41132. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41133. var _this = this;
  41134. var withErrorEmitted = function (callback) {
  41135. return function (result) {
  41136. if (result.error) {
  41137. _this.emit("error", { type: "WebSocketError", error: result.error });
  41138. }
  41139. callback(result);
  41140. };
  41141. };
  41142. return {
  41143. tls_only: withErrorEmitted(function () {
  41144. _this.usingTLS = true;
  41145. _this.updateStrategy();
  41146. _this.retryIn(0);
  41147. }),
  41148. refused: withErrorEmitted(function () {
  41149. _this.disconnect();
  41150. }),
  41151. backoff: withErrorEmitted(function () {
  41152. _this.retryIn(1000);
  41153. }),
  41154. retry: withErrorEmitted(function () {
  41155. _this.retryIn(0);
  41156. })
  41157. };
  41158. };
  41159. ;
  41160. ConnectionManager.prototype.setConnection = function (connection) {
  41161. this.connection = connection;
  41162. for (var event in this.connectionCallbacks) {
  41163. this.connection.bind(event, this.connectionCallbacks[event]);
  41164. }
  41165. this.resetActivityCheck();
  41166. };
  41167. ;
  41168. ConnectionManager.prototype.abandonConnection = function () {
  41169. if (!this.connection) {
  41170. return;
  41171. }
  41172. this.stopActivityCheck();
  41173. for (var event in this.connectionCallbacks) {
  41174. this.connection.unbind(event, this.connectionCallbacks[event]);
  41175. }
  41176. var connection = this.connection;
  41177. this.connection = null;
  41178. return connection;
  41179. };
  41180. ConnectionManager.prototype.updateState = function (newState, data) {
  41181. var previousState = this.state;
  41182. this.state = newState;
  41183. if (previousState !== newState) {
  41184. var newStateDescription = newState;
  41185. if (newStateDescription === "connected") {
  41186. newStateDescription += " with new socket ID " + data.socket_id;
  41187. }
  41188. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41189. this.timeline.info({ state: newState, params: data });
  41190. this.emit('state_change', { previous: previousState, current: newState });
  41191. this.emit(newState, data);
  41192. }
  41193. };
  41194. ConnectionManager.prototype.shouldRetry = function () {
  41195. return this.state === "connecting" || this.state === "connected";
  41196. };
  41197. return ConnectionManager;
  41198. }(dispatcher));
  41199. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41200. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41201. var channels_Channels = (function () {
  41202. function Channels() {
  41203. this.channels = {};
  41204. }
  41205. Channels.prototype.add = function (name, pusher) {
  41206. if (!this.channels[name]) {
  41207. this.channels[name] = createChannel(name, pusher);
  41208. }
  41209. return this.channels[name];
  41210. };
  41211. Channels.prototype.all = function () {
  41212. return values(this.channels);
  41213. };
  41214. Channels.prototype.find = function (name) {
  41215. return this.channels[name];
  41216. };
  41217. Channels.prototype.remove = function (name) {
  41218. var channel = this.channels[name];
  41219. delete this.channels[name];
  41220. return channel;
  41221. };
  41222. Channels.prototype.disconnect = function () {
  41223. objectApply(this.channels, function (channel) {
  41224. channel.disconnect();
  41225. });
  41226. };
  41227. return Channels;
  41228. }());
  41229. /* harmony default export */ var channels = (channels_Channels);
  41230. function createChannel(name, pusher) {
  41231. if (name.indexOf('private-encrypted-') === 0) {
  41232. if (false) { var errorMsg; }
  41233. return factory.createEncryptedChannel(name, pusher);
  41234. }
  41235. else if (name.indexOf('private-') === 0) {
  41236. return factory.createPrivateChannel(name, pusher);
  41237. }
  41238. else if (name.indexOf('presence-') === 0) {
  41239. return factory.createPresenceChannel(name, pusher);
  41240. }
  41241. else {
  41242. return factory.createChannel(name, pusher);
  41243. }
  41244. }
  41245. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41246. var Factory = {
  41247. createChannels: function () {
  41248. return new channels();
  41249. },
  41250. createConnectionManager: function (key, options) {
  41251. return new connection_manager(key, options);
  41252. },
  41253. createChannel: function (name, pusher) {
  41254. return new channels_channel(name, pusher);
  41255. },
  41256. createPrivateChannel: function (name, pusher) {
  41257. return new private_channel(name, pusher);
  41258. },
  41259. createPresenceChannel: function (name, pusher) {
  41260. return new presence_channel(name, pusher);
  41261. },
  41262. createEncryptedChannel: function (name, pusher) {
  41263. return new encrypted_channel(name, pusher);
  41264. },
  41265. createTimelineSender: function (timeline, options) {
  41266. return new timeline_sender(timeline, options);
  41267. },
  41268. createAuthorizer: function (channel, options) {
  41269. if (options.authorizer) {
  41270. return options.authorizer(channel, options);
  41271. }
  41272. return new pusher_authorizer(channel, options);
  41273. },
  41274. createHandshake: function (transport, callback) {
  41275. return new connection_handshake(transport, callback);
  41276. },
  41277. createAssistantToTheTransportManager: function (manager, transport, options) {
  41278. return new assistant_to_the_transport_manager(manager, transport, options);
  41279. }
  41280. };
  41281. /* harmony default export */ var factory = (Factory);
  41282. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41283. var transport_manager_TransportManager = (function () {
  41284. function TransportManager(options) {
  41285. this.options = options || {};
  41286. this.livesLeft = this.options.lives || Infinity;
  41287. }
  41288. TransportManager.prototype.getAssistant = function (transport) {
  41289. return factory.createAssistantToTheTransportManager(this, transport, {
  41290. minPingDelay: this.options.minPingDelay,
  41291. maxPingDelay: this.options.maxPingDelay
  41292. });
  41293. };
  41294. TransportManager.prototype.isAlive = function () {
  41295. return this.livesLeft > 0;
  41296. };
  41297. TransportManager.prototype.reportDeath = function () {
  41298. this.livesLeft -= 1;
  41299. };
  41300. return TransportManager;
  41301. }());
  41302. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41303. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41304. var sequential_strategy_SequentialStrategy = (function () {
  41305. function SequentialStrategy(strategies, options) {
  41306. this.strategies = strategies;
  41307. this.loop = Boolean(options.loop);
  41308. this.failFast = Boolean(options.failFast);
  41309. this.timeout = options.timeout;
  41310. this.timeoutLimit = options.timeoutLimit;
  41311. }
  41312. SequentialStrategy.prototype.isSupported = function () {
  41313. return any(this.strategies, util.method("isSupported"));
  41314. };
  41315. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41316. var _this = this;
  41317. var strategies = this.strategies;
  41318. var current = 0;
  41319. var timeout = this.timeout;
  41320. var runner = null;
  41321. var tryNextStrategy = function (error, handshake) {
  41322. if (handshake) {
  41323. callback(null, handshake);
  41324. }
  41325. else {
  41326. current = current + 1;
  41327. if (_this.loop) {
  41328. current = current % strategies.length;
  41329. }
  41330. if (current < strategies.length) {
  41331. if (timeout) {
  41332. timeout = timeout * 2;
  41333. if (_this.timeoutLimit) {
  41334. timeout = Math.min(timeout, _this.timeoutLimit);
  41335. }
  41336. }
  41337. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41338. }
  41339. else {
  41340. callback(true);
  41341. }
  41342. }
  41343. };
  41344. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41345. return {
  41346. abort: function () {
  41347. runner.abort();
  41348. },
  41349. forceMinPriority: function (p) {
  41350. minPriority = p;
  41351. if (runner) {
  41352. runner.forceMinPriority(p);
  41353. }
  41354. }
  41355. };
  41356. };
  41357. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41358. var timer = null;
  41359. var runner = null;
  41360. if (options.timeout > 0) {
  41361. timer = new OneOffTimer(options.timeout, function () {
  41362. runner.abort();
  41363. callback(true);
  41364. });
  41365. }
  41366. runner = strategy.connect(minPriority, function (error, handshake) {
  41367. if (error && timer && timer.isRunning() && !options.failFast) {
  41368. return;
  41369. }
  41370. if (timer) {
  41371. timer.ensureAborted();
  41372. }
  41373. callback(error, handshake);
  41374. });
  41375. return {
  41376. abort: function () {
  41377. if (timer) {
  41378. timer.ensureAborted();
  41379. }
  41380. runner.abort();
  41381. },
  41382. forceMinPriority: function (p) {
  41383. runner.forceMinPriority(p);
  41384. }
  41385. };
  41386. };
  41387. return SequentialStrategy;
  41388. }());
  41389. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41390. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41391. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41392. function BestConnectedEverStrategy(strategies) {
  41393. this.strategies = strategies;
  41394. }
  41395. BestConnectedEverStrategy.prototype.isSupported = function () {
  41396. return any(this.strategies, util.method("isSupported"));
  41397. };
  41398. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41399. return connect(this.strategies, minPriority, function (i, runners) {
  41400. return function (error, handshake) {
  41401. runners[i].error = error;
  41402. if (error) {
  41403. if (allRunnersFailed(runners)) {
  41404. callback(true);
  41405. }
  41406. return;
  41407. }
  41408. apply(runners, function (runner) {
  41409. runner.forceMinPriority(handshake.transport.priority);
  41410. });
  41411. callback(null, handshake);
  41412. };
  41413. });
  41414. };
  41415. return BestConnectedEverStrategy;
  41416. }());
  41417. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41418. function connect(strategies, minPriority, callbackBuilder) {
  41419. var runners = map(strategies, function (strategy, i, _, rs) {
  41420. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41421. });
  41422. return {
  41423. abort: function () {
  41424. apply(runners, abortRunner);
  41425. },
  41426. forceMinPriority: function (p) {
  41427. apply(runners, function (runner) {
  41428. runner.forceMinPriority(p);
  41429. });
  41430. }
  41431. };
  41432. }
  41433. function allRunnersFailed(runners) {
  41434. return collections_all(runners, function (runner) {
  41435. return Boolean(runner.error);
  41436. });
  41437. }
  41438. function abortRunner(runner) {
  41439. if (!runner.error && !runner.aborted) {
  41440. runner.abort();
  41441. runner.aborted = true;
  41442. }
  41443. }
  41444. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41445. var cached_strategy_CachedStrategy = (function () {
  41446. function CachedStrategy(strategy, transports, options) {
  41447. this.strategy = strategy;
  41448. this.transports = transports;
  41449. this.ttl = options.ttl || 1800 * 1000;
  41450. this.usingTLS = options.useTLS;
  41451. this.timeline = options.timeline;
  41452. }
  41453. CachedStrategy.prototype.isSupported = function () {
  41454. return this.strategy.isSupported();
  41455. };
  41456. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41457. var usingTLS = this.usingTLS;
  41458. var info = fetchTransportCache(usingTLS);
  41459. var strategies = [this.strategy];
  41460. if (info && info.timestamp + this.ttl >= util.now()) {
  41461. var transport = this.transports[info.transport];
  41462. if (transport) {
  41463. this.timeline.info({
  41464. cached: true,
  41465. transport: info.transport,
  41466. latency: info.latency
  41467. });
  41468. strategies.push(new sequential_strategy([transport], {
  41469. timeout: info.latency * 2 + 1000,
  41470. failFast: true
  41471. }));
  41472. }
  41473. }
  41474. var startTimestamp = util.now();
  41475. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41476. if (error) {
  41477. flushTransportCache(usingTLS);
  41478. if (strategies.length > 0) {
  41479. startTimestamp = util.now();
  41480. runner = strategies.pop().connect(minPriority, cb);
  41481. }
  41482. else {
  41483. callback(error);
  41484. }
  41485. }
  41486. else {
  41487. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41488. callback(null, handshake);
  41489. }
  41490. });
  41491. return {
  41492. abort: function () {
  41493. runner.abort();
  41494. },
  41495. forceMinPriority: function (p) {
  41496. minPriority = p;
  41497. if (runner) {
  41498. runner.forceMinPriority(p);
  41499. }
  41500. }
  41501. };
  41502. };
  41503. return CachedStrategy;
  41504. }());
  41505. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41506. function getTransportCacheKey(usingTLS) {
  41507. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41508. }
  41509. function fetchTransportCache(usingTLS) {
  41510. var storage = runtime.getLocalStorage();
  41511. if (storage) {
  41512. try {
  41513. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41514. if (serializedCache) {
  41515. return JSON.parse(serializedCache);
  41516. }
  41517. }
  41518. catch (e) {
  41519. flushTransportCache(usingTLS);
  41520. }
  41521. }
  41522. return null;
  41523. }
  41524. function storeTransportCache(usingTLS, transport, latency) {
  41525. var storage = runtime.getLocalStorage();
  41526. if (storage) {
  41527. try {
  41528. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41529. timestamp: util.now(),
  41530. transport: transport,
  41531. latency: latency
  41532. });
  41533. }
  41534. catch (e) {
  41535. }
  41536. }
  41537. }
  41538. function flushTransportCache(usingTLS) {
  41539. var storage = runtime.getLocalStorage();
  41540. if (storage) {
  41541. try {
  41542. delete storage[getTransportCacheKey(usingTLS)];
  41543. }
  41544. catch (e) {
  41545. }
  41546. }
  41547. }
  41548. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41549. var delayed_strategy_DelayedStrategy = (function () {
  41550. function DelayedStrategy(strategy, _a) {
  41551. var number = _a.delay;
  41552. this.strategy = strategy;
  41553. this.options = { delay: number };
  41554. }
  41555. DelayedStrategy.prototype.isSupported = function () {
  41556. return this.strategy.isSupported();
  41557. };
  41558. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41559. var strategy = this.strategy;
  41560. var runner;
  41561. var timer = new OneOffTimer(this.options.delay, function () {
  41562. runner = strategy.connect(minPriority, callback);
  41563. });
  41564. return {
  41565. abort: function () {
  41566. timer.ensureAborted();
  41567. if (runner) {
  41568. runner.abort();
  41569. }
  41570. },
  41571. forceMinPriority: function (p) {
  41572. minPriority = p;
  41573. if (runner) {
  41574. runner.forceMinPriority(p);
  41575. }
  41576. }
  41577. };
  41578. };
  41579. return DelayedStrategy;
  41580. }());
  41581. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41582. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41583. var IfStrategy = (function () {
  41584. function IfStrategy(test, trueBranch, falseBranch) {
  41585. this.test = test;
  41586. this.trueBranch = trueBranch;
  41587. this.falseBranch = falseBranch;
  41588. }
  41589. IfStrategy.prototype.isSupported = function () {
  41590. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41591. return branch.isSupported();
  41592. };
  41593. IfStrategy.prototype.connect = function (minPriority, callback) {
  41594. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41595. return branch.connect(minPriority, callback);
  41596. };
  41597. return IfStrategy;
  41598. }());
  41599. /* harmony default export */ var if_strategy = (IfStrategy);
  41600. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41601. var FirstConnectedStrategy = (function () {
  41602. function FirstConnectedStrategy(strategy) {
  41603. this.strategy = strategy;
  41604. }
  41605. FirstConnectedStrategy.prototype.isSupported = function () {
  41606. return this.strategy.isSupported();
  41607. };
  41608. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41609. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41610. if (handshake) {
  41611. runner.abort();
  41612. }
  41613. callback(error, handshake);
  41614. });
  41615. return runner;
  41616. };
  41617. return FirstConnectedStrategy;
  41618. }());
  41619. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41620. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41621. function testSupportsStrategy(strategy) {
  41622. return function () {
  41623. return strategy.isSupported();
  41624. };
  41625. }
  41626. var getDefaultStrategy = function (config, defineTransport) {
  41627. var definedTransports = {};
  41628. function defineTransportStrategy(name, type, priority, options, manager) {
  41629. var transport = defineTransport(config, name, type, priority, options, manager);
  41630. definedTransports[name] = transport;
  41631. return transport;
  41632. }
  41633. var ws_options = {
  41634. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41635. hostTLS: config.wsHost + ":" + config.wssPort,
  41636. httpPath: config.wsPath
  41637. };
  41638. var wss_options = extend({}, ws_options, {
  41639. useTLS: true
  41640. });
  41641. var sockjs_options = {
  41642. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41643. hostTLS: config.httpHost + ":" + config.httpsPort,
  41644. httpPath: config.httpPath
  41645. };
  41646. var timeouts = {
  41647. loop: true,
  41648. timeout: 15000,
  41649. timeoutLimit: 60000
  41650. };
  41651. var ws_manager = new transport_manager({
  41652. lives: 2,
  41653. minPingDelay: 10000,
  41654. maxPingDelay: config.activity_timeout
  41655. });
  41656. var streaming_manager = new transport_manager({
  41657. lives: 2,
  41658. minPingDelay: 10000,
  41659. maxPingDelay: config.activity_timeout
  41660. });
  41661. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41662. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41663. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41664. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41665. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41666. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41667. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41668. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41669. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41670. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41671. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41672. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41673. 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);
  41674. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41675. var wsStrategy;
  41676. if (config.useTLS) {
  41677. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41678. }
  41679. else {
  41680. wsStrategy = new best_connected_ever_strategy([
  41681. ws_loop,
  41682. new delayed_strategy(wss_loop, { delay: 2000 }),
  41683. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41684. ]);
  41685. }
  41686. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41687. ttl: 1800000,
  41688. timeline: config.timeline,
  41689. useTLS: config.useTLS
  41690. });
  41691. };
  41692. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41693. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41694. /* harmony default export */ var transport_connection_initializer = (function () {
  41695. var self = this;
  41696. self.timeline.info(self.buildTimelineMessage({
  41697. transport: self.name + (self.options.useTLS ? "s" : "")
  41698. }));
  41699. if (self.hooks.isInitialized()) {
  41700. self.changeState("initialized");
  41701. }
  41702. else if (self.hooks.file) {
  41703. self.changeState("initializing");
  41704. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41705. if (self.hooks.isInitialized()) {
  41706. self.changeState("initialized");
  41707. callback(true);
  41708. }
  41709. else {
  41710. if (error) {
  41711. self.onError(error);
  41712. }
  41713. self.onClose();
  41714. callback(false);
  41715. }
  41716. });
  41717. }
  41718. else {
  41719. self.onClose();
  41720. }
  41721. });
  41722. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41723. var http_xdomain_request_hooks = {
  41724. getRequest: function (socket) {
  41725. var xdr = new window.XDomainRequest();
  41726. xdr.ontimeout = function () {
  41727. socket.emit("error", new RequestTimedOut());
  41728. socket.close();
  41729. };
  41730. xdr.onerror = function (e) {
  41731. socket.emit("error", e);
  41732. socket.close();
  41733. };
  41734. xdr.onprogress = function () {
  41735. if (xdr.responseText && xdr.responseText.length > 0) {
  41736. socket.onChunk(200, xdr.responseText);
  41737. }
  41738. };
  41739. xdr.onload = function () {
  41740. if (xdr.responseText && xdr.responseText.length > 0) {
  41741. socket.onChunk(200, xdr.responseText);
  41742. }
  41743. socket.emit("finished", 200);
  41744. socket.close();
  41745. };
  41746. return xdr;
  41747. },
  41748. abortRequest: function (xdr) {
  41749. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41750. xdr.abort();
  41751. }
  41752. };
  41753. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41754. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41755. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41756. var extendStatics = function (d, b) {
  41757. extendStatics = Object.setPrototypeOf ||
  41758. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41759. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41760. return extendStatics(d, b);
  41761. };
  41762. return function (d, b) {
  41763. extendStatics(d, b);
  41764. function __() { this.constructor = d; }
  41765. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41766. };
  41767. })();
  41768. var MAX_BUFFER_LENGTH = 256 * 1024;
  41769. var http_request_HTTPRequest = (function (_super) {
  41770. http_request_extends(HTTPRequest, _super);
  41771. function HTTPRequest(hooks, method, url) {
  41772. var _this = _super.call(this) || this;
  41773. _this.hooks = hooks;
  41774. _this.method = method;
  41775. _this.url = url;
  41776. return _this;
  41777. }
  41778. HTTPRequest.prototype.start = function (payload) {
  41779. var _this = this;
  41780. this.position = 0;
  41781. this.xhr = this.hooks.getRequest(this);
  41782. this.unloader = function () {
  41783. _this.close();
  41784. };
  41785. runtime.addUnloadListener(this.unloader);
  41786. this.xhr.open(this.method, this.url, true);
  41787. if (this.xhr.setRequestHeader) {
  41788. this.xhr.setRequestHeader("Content-Type", "application/json");
  41789. }
  41790. this.xhr.send(payload);
  41791. };
  41792. HTTPRequest.prototype.close = function () {
  41793. if (this.unloader) {
  41794. runtime.removeUnloadListener(this.unloader);
  41795. this.unloader = null;
  41796. }
  41797. if (this.xhr) {
  41798. this.hooks.abortRequest(this.xhr);
  41799. this.xhr = null;
  41800. }
  41801. };
  41802. HTTPRequest.prototype.onChunk = function (status, data) {
  41803. while (true) {
  41804. var chunk = this.advanceBuffer(data);
  41805. if (chunk) {
  41806. this.emit("chunk", { status: status, data: chunk });
  41807. }
  41808. else {
  41809. break;
  41810. }
  41811. }
  41812. if (this.isBufferTooLong(data)) {
  41813. this.emit("buffer_too_long");
  41814. }
  41815. };
  41816. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41817. var unreadData = buffer.slice(this.position);
  41818. var endOfLinePosition = unreadData.indexOf("\n");
  41819. if (endOfLinePosition !== -1) {
  41820. this.position += endOfLinePosition + 1;
  41821. return unreadData.slice(0, endOfLinePosition);
  41822. }
  41823. else {
  41824. return null;
  41825. }
  41826. };
  41827. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41828. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41829. };
  41830. return HTTPRequest;
  41831. }(dispatcher));
  41832. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41833. // CONCATENATED MODULE: ./src/core/http/state.ts
  41834. var State;
  41835. (function (State) {
  41836. State[State["CONNECTING"] = 0] = "CONNECTING";
  41837. State[State["OPEN"] = 1] = "OPEN";
  41838. State[State["CLOSED"] = 3] = "CLOSED";
  41839. })(State || (State = {}));
  41840. /* harmony default export */ var state = (State);
  41841. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41842. var autoIncrement = 1;
  41843. var http_socket_HTTPSocket = (function () {
  41844. function HTTPSocket(hooks, url) {
  41845. this.hooks = hooks;
  41846. this.session = randomNumber(1000) + "/" + randomString(8);
  41847. this.location = getLocation(url);
  41848. this.readyState = state.CONNECTING;
  41849. this.openStream();
  41850. }
  41851. HTTPSocket.prototype.send = function (payload) {
  41852. return this.sendRaw(JSON.stringify([payload]));
  41853. };
  41854. HTTPSocket.prototype.ping = function () {
  41855. this.hooks.sendHeartbeat(this);
  41856. };
  41857. HTTPSocket.prototype.close = function (code, reason) {
  41858. this.onClose(code, reason, true);
  41859. };
  41860. HTTPSocket.prototype.sendRaw = function (payload) {
  41861. if (this.readyState === state.OPEN) {
  41862. try {
  41863. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41864. return true;
  41865. }
  41866. catch (e) {
  41867. return false;
  41868. }
  41869. }
  41870. else {
  41871. return false;
  41872. }
  41873. };
  41874. HTTPSocket.prototype.reconnect = function () {
  41875. this.closeStream();
  41876. this.openStream();
  41877. };
  41878. ;
  41879. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41880. this.closeStream();
  41881. this.readyState = state.CLOSED;
  41882. if (this.onclose) {
  41883. this.onclose({
  41884. code: code,
  41885. reason: reason,
  41886. wasClean: wasClean
  41887. });
  41888. }
  41889. };
  41890. HTTPSocket.prototype.onChunk = function (chunk) {
  41891. if (chunk.status !== 200) {
  41892. return;
  41893. }
  41894. if (this.readyState === state.OPEN) {
  41895. this.onActivity();
  41896. }
  41897. var payload;
  41898. var type = chunk.data.slice(0, 1);
  41899. switch (type) {
  41900. case 'o':
  41901. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41902. this.onOpen(payload);
  41903. break;
  41904. case 'a':
  41905. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41906. for (var i = 0; i < payload.length; i++) {
  41907. this.onEvent(payload[i]);
  41908. }
  41909. break;
  41910. case 'm':
  41911. payload = JSON.parse(chunk.data.slice(1) || 'null');
  41912. this.onEvent(payload);
  41913. break;
  41914. case 'h':
  41915. this.hooks.onHeartbeat(this);
  41916. break;
  41917. case 'c':
  41918. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41919. this.onClose(payload[0], payload[1], true);
  41920. break;
  41921. }
  41922. };
  41923. HTTPSocket.prototype.onOpen = function (options) {
  41924. if (this.readyState === state.CONNECTING) {
  41925. if (options && options.hostname) {
  41926. this.location.base = replaceHost(this.location.base, options.hostname);
  41927. }
  41928. this.readyState = state.OPEN;
  41929. if (this.onopen) {
  41930. this.onopen();
  41931. }
  41932. }
  41933. else {
  41934. this.onClose(1006, "Server lost session", true);
  41935. }
  41936. };
  41937. HTTPSocket.prototype.onEvent = function (event) {
  41938. if (this.readyState === state.OPEN && this.onmessage) {
  41939. this.onmessage({ data: event });
  41940. }
  41941. };
  41942. HTTPSocket.prototype.onActivity = function () {
  41943. if (this.onactivity) {
  41944. this.onactivity();
  41945. }
  41946. };
  41947. HTTPSocket.prototype.onError = function (error) {
  41948. if (this.onerror) {
  41949. this.onerror(error);
  41950. }
  41951. };
  41952. HTTPSocket.prototype.openStream = function () {
  41953. var _this = this;
  41954. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  41955. this.stream.bind("chunk", function (chunk) {
  41956. _this.onChunk(chunk);
  41957. });
  41958. this.stream.bind("finished", function (status) {
  41959. _this.hooks.onFinished(_this, status);
  41960. });
  41961. this.stream.bind("buffer_too_long", function () {
  41962. _this.reconnect();
  41963. });
  41964. try {
  41965. this.stream.start();
  41966. }
  41967. catch (error) {
  41968. util.defer(function () {
  41969. _this.onError(error);
  41970. _this.onClose(1006, "Could not start streaming", false);
  41971. });
  41972. }
  41973. };
  41974. HTTPSocket.prototype.closeStream = function () {
  41975. if (this.stream) {
  41976. this.stream.unbind_all();
  41977. this.stream.close();
  41978. this.stream = null;
  41979. }
  41980. };
  41981. return HTTPSocket;
  41982. }());
  41983. function getLocation(url) {
  41984. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  41985. return {
  41986. base: parts[1],
  41987. queryString: parts[2]
  41988. };
  41989. }
  41990. function getSendURL(url, session) {
  41991. return url.base + "/" + session + "/xhr_send";
  41992. }
  41993. function getUniqueURL(url) {
  41994. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  41995. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  41996. }
  41997. function replaceHost(url, hostname) {
  41998. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  41999. return urlParts[1] + hostname + urlParts[3];
  42000. }
  42001. function randomNumber(max) {
  42002. return Math.floor(Math.random() * max);
  42003. }
  42004. function randomString(length) {
  42005. var result = [];
  42006. for (var i = 0; i < length; i++) {
  42007. result.push(randomNumber(32).toString(32));
  42008. }
  42009. return result.join('');
  42010. }
  42011. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42012. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42013. var http_streaming_socket_hooks = {
  42014. getReceiveURL: function (url, session) {
  42015. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42016. },
  42017. onHeartbeat: function (socket) {
  42018. socket.sendRaw("[]");
  42019. },
  42020. sendHeartbeat: function (socket) {
  42021. socket.sendRaw("[]");
  42022. },
  42023. onFinished: function (socket, status) {
  42024. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42025. }
  42026. };
  42027. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42028. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42029. var http_polling_socket_hooks = {
  42030. getReceiveURL: function (url, session) {
  42031. return url.base + "/" + session + "/xhr" + url.queryString;
  42032. },
  42033. onHeartbeat: function () {
  42034. },
  42035. sendHeartbeat: function (socket) {
  42036. socket.sendRaw("[]");
  42037. },
  42038. onFinished: function (socket, status) {
  42039. if (status === 200) {
  42040. socket.reconnect();
  42041. }
  42042. else {
  42043. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42044. }
  42045. }
  42046. };
  42047. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42048. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42049. var http_xhr_request_hooks = {
  42050. getRequest: function (socket) {
  42051. var Constructor = runtime.getXHRAPI();
  42052. var xhr = new Constructor();
  42053. xhr.onreadystatechange = xhr.onprogress = function () {
  42054. switch (xhr.readyState) {
  42055. case 3:
  42056. if (xhr.responseText && xhr.responseText.length > 0) {
  42057. socket.onChunk(xhr.status, xhr.responseText);
  42058. }
  42059. break;
  42060. case 4:
  42061. if (xhr.responseText && xhr.responseText.length > 0) {
  42062. socket.onChunk(xhr.status, xhr.responseText);
  42063. }
  42064. socket.emit("finished", xhr.status);
  42065. socket.close();
  42066. break;
  42067. }
  42068. };
  42069. return xhr;
  42070. },
  42071. abortRequest: function (xhr) {
  42072. xhr.onreadystatechange = null;
  42073. xhr.abort();
  42074. }
  42075. };
  42076. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42077. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42078. var HTTP = {
  42079. createStreamingSocket: function (url) {
  42080. return this.createSocket(http_streaming_socket, url);
  42081. },
  42082. createPollingSocket: function (url) {
  42083. return this.createSocket(http_polling_socket, url);
  42084. },
  42085. createSocket: function (hooks, url) {
  42086. return new http_socket(hooks, url);
  42087. },
  42088. createXHR: function (method, url) {
  42089. return this.createRequest(http_xhr_request, method, url);
  42090. },
  42091. createRequest: function (hooks, method, url) {
  42092. return new http_request(hooks, method, url);
  42093. }
  42094. };
  42095. /* harmony default export */ var http_http = (HTTP);
  42096. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42097. http_http.createXDR = function (method, url) {
  42098. return this.createRequest(http_xdomain_request, method, url);
  42099. };
  42100. /* harmony default export */ var web_http_http = (http_http);
  42101. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42102. var Runtime = {
  42103. nextAuthCallbackID: 1,
  42104. auth_callbacks: {},
  42105. ScriptReceivers: ScriptReceivers,
  42106. DependenciesReceivers: DependenciesReceivers,
  42107. getDefaultStrategy: default_strategy,
  42108. Transports: transports_transports,
  42109. transportConnectionInitializer: transport_connection_initializer,
  42110. HTTPFactory: web_http_http,
  42111. TimelineTransport: jsonp_timeline,
  42112. getXHRAPI: function () {
  42113. return window.XMLHttpRequest;
  42114. },
  42115. getWebSocketAPI: function () {
  42116. return window.WebSocket || window.MozWebSocket;
  42117. },
  42118. setup: function (PusherClass) {
  42119. var _this = this;
  42120. window.Pusher = PusherClass;
  42121. var initializeOnDocumentBody = function () {
  42122. _this.onDocumentBody(PusherClass.ready);
  42123. };
  42124. if (!window.JSON) {
  42125. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42126. }
  42127. else {
  42128. initializeOnDocumentBody();
  42129. }
  42130. },
  42131. getDocument: function () {
  42132. return document;
  42133. },
  42134. getProtocol: function () {
  42135. return this.getDocument().location.protocol;
  42136. },
  42137. getAuthorizers: function () {
  42138. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42139. },
  42140. onDocumentBody: function (callback) {
  42141. var _this = this;
  42142. if (document.body) {
  42143. callback();
  42144. }
  42145. else {
  42146. setTimeout(function () {
  42147. _this.onDocumentBody(callback);
  42148. }, 0);
  42149. }
  42150. },
  42151. createJSONPRequest: function (url, data) {
  42152. return new jsonp_request(url, data);
  42153. },
  42154. createScriptRequest: function (src) {
  42155. return new script_request(src);
  42156. },
  42157. getLocalStorage: function () {
  42158. try {
  42159. return window.localStorage;
  42160. }
  42161. catch (e) {
  42162. return undefined;
  42163. }
  42164. },
  42165. createXHR: function () {
  42166. if (this.getXHRAPI()) {
  42167. return this.createXMLHttpRequest();
  42168. }
  42169. else {
  42170. return this.createMicrosoftXHR();
  42171. }
  42172. },
  42173. createXMLHttpRequest: function () {
  42174. var Constructor = this.getXHRAPI();
  42175. return new Constructor();
  42176. },
  42177. createMicrosoftXHR: function () {
  42178. return new ActiveXObject("Microsoft.XMLHTTP");
  42179. },
  42180. getNetwork: function () {
  42181. return net_info_Network;
  42182. },
  42183. createWebSocket: function (url) {
  42184. var Constructor = this.getWebSocketAPI();
  42185. return new Constructor(url);
  42186. },
  42187. createSocketRequest: function (method, url) {
  42188. if (this.isXHRSupported()) {
  42189. return this.HTTPFactory.createXHR(method, url);
  42190. }
  42191. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42192. return this.HTTPFactory.createXDR(method, url);
  42193. }
  42194. else {
  42195. throw "Cross-origin HTTP requests are not supported";
  42196. }
  42197. },
  42198. isXHRSupported: function () {
  42199. var Constructor = this.getXHRAPI();
  42200. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42201. },
  42202. isXDRSupported: function (useTLS) {
  42203. var protocol = useTLS ? "https:" : "http:";
  42204. var documentProtocol = this.getProtocol();
  42205. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42206. },
  42207. addUnloadListener: function (listener) {
  42208. if (window.addEventListener !== undefined) {
  42209. window.addEventListener("unload", listener, false);
  42210. }
  42211. else if (window.attachEvent !== undefined) {
  42212. window.attachEvent("onunload", listener);
  42213. }
  42214. },
  42215. removeUnloadListener: function (listener) {
  42216. if (window.addEventListener !== undefined) {
  42217. window.removeEventListener("unload", listener, false);
  42218. }
  42219. else if (window.detachEvent !== undefined) {
  42220. window.detachEvent("onunload", listener);
  42221. }
  42222. }
  42223. };
  42224. /* harmony default export */ var runtime = (Runtime);
  42225. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42226. var TimelineLevel;
  42227. (function (TimelineLevel) {
  42228. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42229. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42230. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42231. })(TimelineLevel || (TimelineLevel = {}));
  42232. /* harmony default export */ var timeline_level = (TimelineLevel);
  42233. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42234. var timeline_Timeline = (function () {
  42235. function Timeline(key, session, options) {
  42236. this.key = key;
  42237. this.session = session;
  42238. this.events = [];
  42239. this.options = options || {};
  42240. this.sent = 0;
  42241. this.uniqueID = 0;
  42242. }
  42243. Timeline.prototype.log = function (level, event) {
  42244. if (level <= this.options.level) {
  42245. this.events.push(extend({}, event, { timestamp: util.now() }));
  42246. if (this.options.limit && this.events.length > this.options.limit) {
  42247. this.events.shift();
  42248. }
  42249. }
  42250. };
  42251. Timeline.prototype.error = function (event) {
  42252. this.log(timeline_level.ERROR, event);
  42253. };
  42254. Timeline.prototype.info = function (event) {
  42255. this.log(timeline_level.INFO, event);
  42256. };
  42257. Timeline.prototype.debug = function (event) {
  42258. this.log(timeline_level.DEBUG, event);
  42259. };
  42260. Timeline.prototype.isEmpty = function () {
  42261. return this.events.length === 0;
  42262. };
  42263. Timeline.prototype.send = function (sendfn, callback) {
  42264. var _this = this;
  42265. var data = extend({
  42266. session: this.session,
  42267. bundle: this.sent + 1,
  42268. key: this.key,
  42269. lib: "js",
  42270. version: this.options.version,
  42271. cluster: this.options.cluster,
  42272. features: this.options.features,
  42273. timeline: this.events
  42274. }, this.options.params);
  42275. this.events = [];
  42276. sendfn(data, function (error, result) {
  42277. if (!error) {
  42278. _this.sent++;
  42279. }
  42280. if (callback) {
  42281. callback(error, result);
  42282. }
  42283. });
  42284. return true;
  42285. };
  42286. Timeline.prototype.generateUniqueID = function () {
  42287. this.uniqueID++;
  42288. return this.uniqueID;
  42289. };
  42290. return Timeline;
  42291. }());
  42292. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42293. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42294. var transport_strategy_TransportStrategy = (function () {
  42295. function TransportStrategy(name, priority, transport, options) {
  42296. this.name = name;
  42297. this.priority = priority;
  42298. this.transport = transport;
  42299. this.options = options || {};
  42300. }
  42301. TransportStrategy.prototype.isSupported = function () {
  42302. return this.transport.isSupported({
  42303. useTLS: this.options.useTLS
  42304. });
  42305. };
  42306. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42307. var _this = this;
  42308. if (!this.isSupported()) {
  42309. return failAttempt(new UnsupportedStrategy(), callback);
  42310. }
  42311. else if (this.priority < minPriority) {
  42312. return failAttempt(new TransportPriorityTooLow(), callback);
  42313. }
  42314. var connected = false;
  42315. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42316. var handshake = null;
  42317. var onInitialized = function () {
  42318. transport.unbind("initialized", onInitialized);
  42319. transport.connect();
  42320. };
  42321. var onOpen = function () {
  42322. handshake = factory.createHandshake(transport, function (result) {
  42323. connected = true;
  42324. unbindListeners();
  42325. callback(null, result);
  42326. });
  42327. };
  42328. var onError = function (error) {
  42329. unbindListeners();
  42330. callback(error);
  42331. };
  42332. var onClosed = function () {
  42333. unbindListeners();
  42334. var serializedTransport;
  42335. serializedTransport = safeJSONStringify(transport);
  42336. callback(new TransportClosed(serializedTransport));
  42337. };
  42338. var unbindListeners = function () {
  42339. transport.unbind("initialized", onInitialized);
  42340. transport.unbind("open", onOpen);
  42341. transport.unbind("error", onError);
  42342. transport.unbind("closed", onClosed);
  42343. };
  42344. transport.bind("initialized", onInitialized);
  42345. transport.bind("open", onOpen);
  42346. transport.bind("error", onError);
  42347. transport.bind("closed", onClosed);
  42348. transport.initialize();
  42349. return {
  42350. abort: function () {
  42351. if (connected) {
  42352. return;
  42353. }
  42354. unbindListeners();
  42355. if (handshake) {
  42356. handshake.close();
  42357. }
  42358. else {
  42359. transport.close();
  42360. }
  42361. },
  42362. forceMinPriority: function (p) {
  42363. if (connected) {
  42364. return;
  42365. }
  42366. if (_this.priority < p) {
  42367. if (handshake) {
  42368. handshake.close();
  42369. }
  42370. else {
  42371. transport.close();
  42372. }
  42373. }
  42374. }
  42375. };
  42376. };
  42377. return TransportStrategy;
  42378. }());
  42379. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42380. function failAttempt(error, callback) {
  42381. util.defer(function () {
  42382. callback(error);
  42383. });
  42384. return {
  42385. abort: function () { },
  42386. forceMinPriority: function () { }
  42387. };
  42388. }
  42389. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42390. var strategy_builder_Transports = runtime.Transports;
  42391. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42392. var transportClass = strategy_builder_Transports[type];
  42393. if (!transportClass) {
  42394. throw new UnsupportedTransport(type);
  42395. }
  42396. var enabled = (!config.enabledTransports ||
  42397. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42398. (!config.disabledTransports ||
  42399. arrayIndexOf(config.disabledTransports, name) === -1);
  42400. var transport;
  42401. if (enabled) {
  42402. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42403. key: config.key,
  42404. useTLS: config.useTLS,
  42405. timeline: config.timeline,
  42406. ignoreNullOrigin: config.ignoreNullOrigin
  42407. }, options));
  42408. }
  42409. else {
  42410. transport = strategy_builder_UnsupportedStrategy;
  42411. }
  42412. return transport;
  42413. };
  42414. var strategy_builder_UnsupportedStrategy = {
  42415. isSupported: function () {
  42416. return false;
  42417. },
  42418. connect: function (_, callback) {
  42419. var deferred = util.defer(function () {
  42420. callback(new UnsupportedStrategy());
  42421. });
  42422. return {
  42423. abort: function () {
  42424. deferred.ensureAborted();
  42425. },
  42426. forceMinPriority: function () { }
  42427. };
  42428. }
  42429. };
  42430. // CONCATENATED MODULE: ./src/core/config.ts
  42431. var getGlobalConfig = function () {
  42432. return {
  42433. wsHost: defaults.host,
  42434. wsPort: defaults.ws_port,
  42435. wssPort: defaults.wss_port,
  42436. wsPath: defaults.ws_path,
  42437. httpHost: defaults.sockjs_host,
  42438. httpPort: defaults.sockjs_http_port,
  42439. httpsPort: defaults.sockjs_https_port,
  42440. httpPath: defaults.sockjs_path,
  42441. statsHost: defaults.stats_host,
  42442. authEndpoint: defaults.channel_auth_endpoint,
  42443. authTransport: defaults.channel_auth_transport,
  42444. activity_timeout: defaults.activity_timeout,
  42445. pong_timeout: defaults.pong_timeout,
  42446. unavailable_timeout: defaults.unavailable_timeout
  42447. };
  42448. };
  42449. var getClusterConfig = function (clusterName) {
  42450. return {
  42451. wsHost: 'ws-' + clusterName + '.pusher.com',
  42452. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42453. };
  42454. };
  42455. // CONCATENATED MODULE: ./src/core/pusher.ts
  42456. var pusher_Pusher = (function () {
  42457. function Pusher(app_key, options) {
  42458. var _this = this;
  42459. checkAppKey(app_key);
  42460. options = options || {};
  42461. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42462. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42463. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42464. }
  42465. this.key = app_key;
  42466. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42467. this.channels = factory.createChannels();
  42468. this.global_emitter = new dispatcher();
  42469. this.sessionID = Math.floor(Math.random() * 1000000000);
  42470. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42471. cluster: this.config.cluster,
  42472. features: Pusher.getClientFeatures(),
  42473. params: this.config.timelineParams || {},
  42474. limit: 50,
  42475. level: timeline_level.INFO,
  42476. version: defaults.VERSION
  42477. });
  42478. if (!this.config.disableStats) {
  42479. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42480. host: this.config.statsHost,
  42481. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42482. });
  42483. }
  42484. var getStrategy = function (options) {
  42485. var config = extend({}, _this.config, options);
  42486. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42487. };
  42488. this.connection = factory.createConnectionManager(this.key, extend({
  42489. getStrategy: getStrategy,
  42490. timeline: this.timeline,
  42491. activityTimeout: this.config.activity_timeout,
  42492. pongTimeout: this.config.pong_timeout,
  42493. unavailableTimeout: this.config.unavailable_timeout
  42494. }, this.config, { useTLS: this.shouldUseTLS() }));
  42495. this.connection.bind('connected', function () {
  42496. _this.subscribeAll();
  42497. if (_this.timelineSender) {
  42498. _this.timelineSender.send(_this.connection.isUsingTLS());
  42499. }
  42500. });
  42501. this.connection.bind('message', function (event) {
  42502. var eventName = event.event;
  42503. var internal = eventName.indexOf('pusher_internal:') === 0;
  42504. if (event.channel) {
  42505. var channel = _this.channel(event.channel);
  42506. if (channel) {
  42507. channel.handleEvent(event);
  42508. }
  42509. }
  42510. if (!internal) {
  42511. _this.global_emitter.emit(event.event, event.data);
  42512. }
  42513. });
  42514. this.connection.bind('connecting', function () {
  42515. _this.channels.disconnect();
  42516. });
  42517. this.connection.bind('disconnected', function () {
  42518. _this.channels.disconnect();
  42519. });
  42520. this.connection.bind('error', function (err) {
  42521. logger.warn(err);
  42522. });
  42523. Pusher.instances.push(this);
  42524. this.timeline.info({ instances: Pusher.instances.length });
  42525. if (Pusher.isReady) {
  42526. this.connect();
  42527. }
  42528. }
  42529. Pusher.ready = function () {
  42530. Pusher.isReady = true;
  42531. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42532. Pusher.instances[i].connect();
  42533. }
  42534. };
  42535. Pusher.getClientFeatures = function () {
  42536. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42537. return t.isSupported({});
  42538. }));
  42539. };
  42540. Pusher.prototype.channel = function (name) {
  42541. return this.channels.find(name);
  42542. };
  42543. Pusher.prototype.allChannels = function () {
  42544. return this.channels.all();
  42545. };
  42546. Pusher.prototype.connect = function () {
  42547. this.connection.connect();
  42548. if (this.timelineSender) {
  42549. if (!this.timelineSenderTimer) {
  42550. var usingTLS = this.connection.isUsingTLS();
  42551. var timelineSender = this.timelineSender;
  42552. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42553. timelineSender.send(usingTLS);
  42554. });
  42555. }
  42556. }
  42557. };
  42558. Pusher.prototype.disconnect = function () {
  42559. this.connection.disconnect();
  42560. if (this.timelineSenderTimer) {
  42561. this.timelineSenderTimer.ensureAborted();
  42562. this.timelineSenderTimer = null;
  42563. }
  42564. };
  42565. Pusher.prototype.bind = function (event_name, callback, context) {
  42566. this.global_emitter.bind(event_name, callback, context);
  42567. return this;
  42568. };
  42569. Pusher.prototype.unbind = function (event_name, callback, context) {
  42570. this.global_emitter.unbind(event_name, callback, context);
  42571. return this;
  42572. };
  42573. Pusher.prototype.bind_global = function (callback) {
  42574. this.global_emitter.bind_global(callback);
  42575. return this;
  42576. };
  42577. Pusher.prototype.unbind_global = function (callback) {
  42578. this.global_emitter.unbind_global(callback);
  42579. return this;
  42580. };
  42581. Pusher.prototype.unbind_all = function (callback) {
  42582. this.global_emitter.unbind_all();
  42583. return this;
  42584. };
  42585. Pusher.prototype.subscribeAll = function () {
  42586. var channelName;
  42587. for (channelName in this.channels.channels) {
  42588. if (this.channels.channels.hasOwnProperty(channelName)) {
  42589. this.subscribe(channelName);
  42590. }
  42591. }
  42592. };
  42593. Pusher.prototype.subscribe = function (channel_name) {
  42594. var channel = this.channels.add(channel_name, this);
  42595. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42596. channel.reinstateSubscription();
  42597. }
  42598. else if (!channel.subscriptionPending &&
  42599. this.connection.state === 'connected') {
  42600. channel.subscribe();
  42601. }
  42602. return channel;
  42603. };
  42604. Pusher.prototype.unsubscribe = function (channel_name) {
  42605. var channel = this.channels.find(channel_name);
  42606. if (channel && channel.subscriptionPending) {
  42607. channel.cancelSubscription();
  42608. }
  42609. else {
  42610. channel = this.channels.remove(channel_name);
  42611. if (channel && this.connection.state === 'connected') {
  42612. channel.unsubscribe();
  42613. }
  42614. }
  42615. };
  42616. Pusher.prototype.send_event = function (event_name, data, channel) {
  42617. return this.connection.send_event(event_name, data, channel);
  42618. };
  42619. Pusher.prototype.shouldUseTLS = function () {
  42620. if (runtime.getProtocol() === 'https:') {
  42621. return true;
  42622. }
  42623. else if (this.config.forceTLS === true) {
  42624. return true;
  42625. }
  42626. else {
  42627. return Boolean(this.config.encrypted);
  42628. }
  42629. };
  42630. Pusher.instances = [];
  42631. Pusher.isReady = false;
  42632. Pusher.logToConsole = false;
  42633. Pusher.Runtime = runtime;
  42634. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42635. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42636. Pusher.auth_callbacks = runtime.auth_callbacks;
  42637. return Pusher;
  42638. }());
  42639. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42640. function checkAppKey(key) {
  42641. if (key === null || key === undefined) {
  42642. throw 'You must pass your app key when you instantiate Pusher.';
  42643. }
  42644. }
  42645. runtime.setup(pusher_Pusher);
  42646. /***/ })
  42647. /******/ ]);
  42648. });
  42649. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42650. /***/ }),
  42651. /***/ "./node_modules/setimmediate/setImmediate.js":
  42652. /*!***************************************************!*\
  42653. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42654. \***************************************************/
  42655. /*! no static exports found */
  42656. /***/ (function(module, exports, __webpack_require__) {
  42657. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42658. "use strict";
  42659. if (global.setImmediate) {
  42660. return;
  42661. }
  42662. var nextHandle = 1; // Spec says greater than zero
  42663. var tasksByHandle = {};
  42664. var currentlyRunningATask = false;
  42665. var doc = global.document;
  42666. var registerImmediate;
  42667. function setImmediate(callback) {
  42668. // Callback can either be a function or a string
  42669. if (typeof callback !== "function") {
  42670. callback = new Function("" + callback);
  42671. }
  42672. // Copy function arguments
  42673. var args = new Array(arguments.length - 1);
  42674. for (var i = 0; i < args.length; i++) {
  42675. args[i] = arguments[i + 1];
  42676. }
  42677. // Store and register the task
  42678. var task = { callback: callback, args: args };
  42679. tasksByHandle[nextHandle] = task;
  42680. registerImmediate(nextHandle);
  42681. return nextHandle++;
  42682. }
  42683. function clearImmediate(handle) {
  42684. delete tasksByHandle[handle];
  42685. }
  42686. function run(task) {
  42687. var callback = task.callback;
  42688. var args = task.args;
  42689. switch (args.length) {
  42690. case 0:
  42691. callback();
  42692. break;
  42693. case 1:
  42694. callback(args[0]);
  42695. break;
  42696. case 2:
  42697. callback(args[0], args[1]);
  42698. break;
  42699. case 3:
  42700. callback(args[0], args[1], args[2]);
  42701. break;
  42702. default:
  42703. callback.apply(undefined, args);
  42704. break;
  42705. }
  42706. }
  42707. function runIfPresent(handle) {
  42708. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42709. // So if we're currently running a task, we'll need to delay this invocation.
  42710. if (currentlyRunningATask) {
  42711. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42712. // "too much recursion" error.
  42713. setTimeout(runIfPresent, 0, handle);
  42714. } else {
  42715. var task = tasksByHandle[handle];
  42716. if (task) {
  42717. currentlyRunningATask = true;
  42718. try {
  42719. run(task);
  42720. } finally {
  42721. clearImmediate(handle);
  42722. currentlyRunningATask = false;
  42723. }
  42724. }
  42725. }
  42726. }
  42727. function installNextTickImplementation() {
  42728. registerImmediate = function(handle) {
  42729. process.nextTick(function () { runIfPresent(handle); });
  42730. };
  42731. }
  42732. function canUsePostMessage() {
  42733. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42734. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42735. if (global.postMessage && !global.importScripts) {
  42736. var postMessageIsAsynchronous = true;
  42737. var oldOnMessage = global.onmessage;
  42738. global.onmessage = function() {
  42739. postMessageIsAsynchronous = false;
  42740. };
  42741. global.postMessage("", "*");
  42742. global.onmessage = oldOnMessage;
  42743. return postMessageIsAsynchronous;
  42744. }
  42745. }
  42746. function installPostMessageImplementation() {
  42747. // Installs an event handler on `global` for the `message` event: see
  42748. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42749. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42750. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42751. var onGlobalMessage = function(event) {
  42752. if (event.source === global &&
  42753. typeof event.data === "string" &&
  42754. event.data.indexOf(messagePrefix) === 0) {
  42755. runIfPresent(+event.data.slice(messagePrefix.length));
  42756. }
  42757. };
  42758. if (global.addEventListener) {
  42759. global.addEventListener("message", onGlobalMessage, false);
  42760. } else {
  42761. global.attachEvent("onmessage", onGlobalMessage);
  42762. }
  42763. registerImmediate = function(handle) {
  42764. global.postMessage(messagePrefix + handle, "*");
  42765. };
  42766. }
  42767. function installMessageChannelImplementation() {
  42768. var channel = new MessageChannel();
  42769. channel.port1.onmessage = function(event) {
  42770. var handle = event.data;
  42771. runIfPresent(handle);
  42772. };
  42773. registerImmediate = function(handle) {
  42774. channel.port2.postMessage(handle);
  42775. };
  42776. }
  42777. function installReadyStateChangeImplementation() {
  42778. var html = doc.documentElement;
  42779. registerImmediate = function(handle) {
  42780. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42781. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42782. var script = doc.createElement("script");
  42783. script.onreadystatechange = function () {
  42784. runIfPresent(handle);
  42785. script.onreadystatechange = null;
  42786. html.removeChild(script);
  42787. script = null;
  42788. };
  42789. html.appendChild(script);
  42790. };
  42791. }
  42792. function installSetTimeoutImplementation() {
  42793. registerImmediate = function(handle) {
  42794. setTimeout(runIfPresent, 0, handle);
  42795. };
  42796. }
  42797. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42798. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42799. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42800. // Don't get fooled by e.g. browserify environments.
  42801. if ({}.toString.call(global.process) === "[object process]") {
  42802. // For Node.js before 0.9
  42803. installNextTickImplementation();
  42804. } else if (canUsePostMessage()) {
  42805. // For non-IE10 modern browsers
  42806. installPostMessageImplementation();
  42807. } else if (global.MessageChannel) {
  42808. // For web workers, where supported
  42809. installMessageChannelImplementation();
  42810. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42811. // For IE 6–8
  42812. installReadyStateChangeImplementation();
  42813. } else {
  42814. // For older browsers
  42815. installSetTimeoutImplementation();
  42816. }
  42817. attachTo.setImmediate = setImmediate;
  42818. attachTo.clearImmediate = clearImmediate;
  42819. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42820. /* 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")))
  42821. /***/ }),
  42822. /***/ "./node_modules/timers-browserify/main.js":
  42823. /*!************************************************!*\
  42824. !*** ./node_modules/timers-browserify/main.js ***!
  42825. \************************************************/
  42826. /*! no static exports found */
  42827. /***/ (function(module, exports, __webpack_require__) {
  42828. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42829. (typeof self !== "undefined" && self) ||
  42830. window;
  42831. var apply = Function.prototype.apply;
  42832. // DOM APIs, for completeness
  42833. exports.setTimeout = function() {
  42834. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42835. };
  42836. exports.setInterval = function() {
  42837. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42838. };
  42839. exports.clearTimeout =
  42840. exports.clearInterval = function(timeout) {
  42841. if (timeout) {
  42842. timeout.close();
  42843. }
  42844. };
  42845. function Timeout(id, clearFn) {
  42846. this._id = id;
  42847. this._clearFn = clearFn;
  42848. }
  42849. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42850. Timeout.prototype.close = function() {
  42851. this._clearFn.call(scope, this._id);
  42852. };
  42853. // Does not start the time, just sets up the members needed.
  42854. exports.enroll = function(item, msecs) {
  42855. clearTimeout(item._idleTimeoutId);
  42856. item._idleTimeout = msecs;
  42857. };
  42858. exports.unenroll = function(item) {
  42859. clearTimeout(item._idleTimeoutId);
  42860. item._idleTimeout = -1;
  42861. };
  42862. exports._unrefActive = exports.active = function(item) {
  42863. clearTimeout(item._idleTimeoutId);
  42864. var msecs = item._idleTimeout;
  42865. if (msecs >= 0) {
  42866. item._idleTimeoutId = setTimeout(function onTimeout() {
  42867. if (item._onTimeout)
  42868. item._onTimeout();
  42869. }, msecs);
  42870. }
  42871. };
  42872. // setimmediate attaches itself to the global object
  42873. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42874. // On some exotic environments, it's not clear which object `setimmediate` was
  42875. // able to install onto. Search each possibility in the same order as the
  42876. // `setimmediate` library.
  42877. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42878. (typeof global !== "undefined" && global.setImmediate) ||
  42879. (this && this.setImmediate);
  42880. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42881. (typeof global !== "undefined" && global.clearImmediate) ||
  42882. (this && this.clearImmediate);
  42883. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42884. /***/ }),
  42885. /***/ "./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&":
  42886. /*!*******************************************************************************************************************************************************************************************************************!*\
  42887. !*** ./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& ***!
  42888. \*******************************************************************************************************************************************************************************************************************/
  42889. /*! exports provided: render, staticRenderFns */
  42890. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42891. "use strict";
  42892. __webpack_require__.r(__webpack_exports__);
  42893. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42894. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42895. var render = function() {
  42896. var _vm = this
  42897. var _h = _vm.$createElement
  42898. var _c = _vm._self._c || _h
  42899. return _vm._m(0)
  42900. }
  42901. var staticRenderFns = [
  42902. function() {
  42903. var _vm = this
  42904. var _h = _vm.$createElement
  42905. var _c = _vm._self._c || _h
  42906. return _c("div", { staticClass: "container" }, [
  42907. _c("div", { staticClass: "row justify-content-center" }, [
  42908. _c("div", { staticClass: "col-md-8" }, [
  42909. _c("div", { staticClass: "card" }, [
  42910. _c("div", { staticClass: "card-header" }, [
  42911. _vm._v("Example Component")
  42912. ]),
  42913. _vm._v(" "),
  42914. _c("div", { staticClass: "card-body" }, [
  42915. _vm._v(
  42916. "\n I'm an example component.\n "
  42917. )
  42918. ])
  42919. ])
  42920. ])
  42921. ])
  42922. ])
  42923. }
  42924. ]
  42925. render._withStripped = true
  42926. /***/ }),
  42927. /***/ "./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&":
  42928. /*!************************************************************************************************************************************************************************************************************!*\
  42929. !*** ./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& ***!
  42930. \************************************************************************************************************************************************************************************************************/
  42931. /*! exports provided: render, staticRenderFns */
  42932. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42933. "use strict";
  42934. __webpack_require__.r(__webpack_exports__);
  42935. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42936. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42937. var render = function() {
  42938. var _vm = this
  42939. var _h = _vm.$createElement
  42940. var _c = _vm._self._c || _h
  42941. return _c(
  42942. "div",
  42943. [
  42944. _c(
  42945. "modal",
  42946. {
  42947. attrs: {
  42948. id: "asseteditModal",
  42949. tabindex: "-1",
  42950. role: "dialog",
  42951. "aria-labelledby": "asseteditModalLabel"
  42952. }
  42953. },
  42954. [
  42955. _c(
  42956. "h5",
  42957. {
  42958. staticClass: "modal-title",
  42959. attrs: { slot: "header", id: "asseteditModalLabel" },
  42960. slot: "header"
  42961. },
  42962. [_vm._v("\n Edit Work Order Information\n ")]
  42963. ),
  42964. _vm._v(" "),
  42965. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  42966. _c("div", { staticClass: "form-group" }, [
  42967. _c("label", { attrs: { for: "manufacturer" } }, [
  42968. _vm._v("Manufacturer")
  42969. ]),
  42970. _vm._v(" "),
  42971. _c("input", {
  42972. directives: [
  42973. {
  42974. name: "model",
  42975. rawName: "v-model.lazy",
  42976. value: _vm.data.pcmanu,
  42977. expression: "data.pcmanu",
  42978. modifiers: { lazy: true }
  42979. }
  42980. ],
  42981. staticClass: "form-control",
  42982. attrs: {
  42983. type: "text",
  42984. name: "manufacturer",
  42985. id: "manufacturer"
  42986. },
  42987. domProps: { value: _vm.data.pcmanu },
  42988. on: {
  42989. change: function($event) {
  42990. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  42991. }
  42992. }
  42993. })
  42994. ]),
  42995. _vm._v(" "),
  42996. _c("div", { staticClass: "form-group" }, [
  42997. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  42998. _vm._v(" "),
  42999. _c("input", {
  43000. directives: [
  43001. {
  43002. name: "model",
  43003. rawName: "v-model.lazy",
  43004. value: _vm.data.pcmake,
  43005. expression: "data.pcmake",
  43006. modifiers: { lazy: true }
  43007. }
  43008. ],
  43009. staticClass: "form-control",
  43010. attrs: { type: "text", name: "make", id: "make" },
  43011. domProps: { value: _vm.data.pcmake },
  43012. on: {
  43013. change: function($event) {
  43014. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43015. }
  43016. }
  43017. })
  43018. ]),
  43019. _vm._v(" "),
  43020. _c("div", { staticClass: "form-group" }, [
  43021. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43022. _vm._v(" "),
  43023. _c("input", {
  43024. directives: [
  43025. {
  43026. name: "model",
  43027. rawName: "v-model.lazy",
  43028. value: _vm.data.pcnickname,
  43029. expression: "data.pcnickname",
  43030. modifiers: { lazy: true }
  43031. }
  43032. ],
  43033. staticClass: "form-control",
  43034. attrs: { type: "text", name: "nickname", id: "nickname" },
  43035. domProps: { value: _vm.data.pcnickname },
  43036. on: {
  43037. change: function($event) {
  43038. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43039. }
  43040. }
  43041. })
  43042. ]),
  43043. _vm._v(" "),
  43044. _c("div", { staticClass: "form-group" }, [
  43045. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43046. _vm._v(" "),
  43047. _c("input", {
  43048. directives: [
  43049. {
  43050. name: "model",
  43051. rawName: "v-model.lazy",
  43052. value: _vm.pcextra[2],
  43053. expression: "pcextra[2]",
  43054. modifiers: { lazy: true }
  43055. }
  43056. ],
  43057. staticClass: "form-control",
  43058. attrs: { type: "text", name: "os", id: "os" },
  43059. domProps: { value: _vm.pcextra[2] },
  43060. on: {
  43061. change: function($event) {
  43062. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43063. }
  43064. }
  43065. })
  43066. ]),
  43067. _vm._v(" "),
  43068. _c("div", { staticClass: "form-group" }, [
  43069. _c("label", { attrs: { for: "serial" } }, [
  43070. _vm._v("Serial Number")
  43071. ]),
  43072. _vm._v(" "),
  43073. _c("input", {
  43074. directives: [
  43075. {
  43076. name: "model",
  43077. rawName: "v-model.lazy",
  43078. value: _vm.pcextra[104],
  43079. expression: "pcextra[104]",
  43080. modifiers: { lazy: true }
  43081. }
  43082. ],
  43083. staticClass: "form-control",
  43084. attrs: { type: "text", id: "serial", name: "serial" },
  43085. domProps: { value: _vm.pcextra[104] },
  43086. on: {
  43087. change: function($event) {
  43088. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43089. }
  43090. }
  43091. })
  43092. ]),
  43093. _vm._v(" "),
  43094. _c("div", { staticClass: "form-group" }, [
  43095. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43096. _vm._v(" "),
  43097. _c("input", {
  43098. directives: [
  43099. {
  43100. name: "model",
  43101. rawName: "v-model.lazy",
  43102. value: _vm.pcextra[101],
  43103. expression: "pcextra[101]",
  43104. modifiers: { lazy: true }
  43105. }
  43106. ],
  43107. staticClass: "form-control",
  43108. attrs: { type: "text", id: "cpu", name: "cpu" },
  43109. domProps: { value: _vm.pcextra[101] },
  43110. on: {
  43111. change: function($event) {
  43112. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43113. }
  43114. }
  43115. })
  43116. ]),
  43117. _vm._v(" "),
  43118. _c("div", { staticClass: "form-group" }, [
  43119. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43120. _vm._v(" "),
  43121. _c("input", {
  43122. directives: [
  43123. {
  43124. name: "model",
  43125. rawName: "v-model.lazy",
  43126. value: _vm.pcextra[100],
  43127. expression: "pcextra[100]",
  43128. modifiers: { lazy: true }
  43129. }
  43130. ],
  43131. staticClass: "form-control",
  43132. attrs: { type: "text", name: "ram", id: "ram" },
  43133. domProps: { value: _vm.pcextra[100] },
  43134. on: {
  43135. change: function($event) {
  43136. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43137. }
  43138. }
  43139. })
  43140. ]),
  43141. _vm._v(" "),
  43142. _c("div", { staticClass: "form-group" }, [
  43143. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43144. _vm._v(" "),
  43145. _c("input", {
  43146. directives: [
  43147. {
  43148. name: "model",
  43149. rawName: "v-model.lazy",
  43150. value: _vm.pcextra[4],
  43151. expression: "pcextra[4]",
  43152. modifiers: { lazy: true }
  43153. }
  43154. ],
  43155. staticClass: "form-control",
  43156. attrs: { type: "text", name: "graphics", id: "grapics" },
  43157. domProps: { value: _vm.pcextra[4] },
  43158. on: {
  43159. change: function($event) {
  43160. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43161. }
  43162. }
  43163. })
  43164. ])
  43165. ]),
  43166. _vm._v(" "),
  43167. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43168. _c(
  43169. "button",
  43170. {
  43171. staticClass: "btn btn-secondary",
  43172. attrs: { type: "button", "data-dismiss": "modal" }
  43173. },
  43174. [_vm._v("Close")]
  43175. ),
  43176. _vm._v(" "),
  43177. _c(
  43178. "button",
  43179. {
  43180. staticClass: "btn btn-primary",
  43181. attrs: { type: "button" },
  43182. on: {
  43183. click: function($event) {
  43184. return _vm.updateAsset()
  43185. }
  43186. }
  43187. },
  43188. [_vm._v("Save")]
  43189. )
  43190. ])
  43191. ]
  43192. ),
  43193. _vm._v(" "),
  43194. _c("h4", { staticClass: "text-center" }, [
  43195. _vm._v(
  43196. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43197. ),
  43198. _c("small", { staticClass: "text-muted" }, [
  43199. _vm._v(_vm._s(this.data.pcnickname))
  43200. ])
  43201. ]),
  43202. _vm._v(" "),
  43203. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43204. _vm._v(" "),
  43205. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43206. _vm._v(" "),
  43207. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43208. _vm._v(" "),
  43209. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43210. _vm._v(" "),
  43211. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43212. _vm._v(" "),
  43213. _c(
  43214. "button",
  43215. {
  43216. staticClass: "btn btn-primary",
  43217. attrs: {
  43218. type: "button",
  43219. "data-toggle": "modal",
  43220. "data-target": "#asseteditModal"
  43221. }
  43222. },
  43223. [_vm._v("Edit")]
  43224. )
  43225. ],
  43226. 1
  43227. )
  43228. }
  43229. var staticRenderFns = []
  43230. render._withStripped = true
  43231. /***/ }),
  43232. /***/ "./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&":
  43233. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43234. !*** ./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& ***!
  43235. \*******************************************************************************************************************************************************************************************************************************/
  43236. /*! exports provided: render, staticRenderFns */
  43237. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43238. "use strict";
  43239. __webpack_require__.r(__webpack_exports__);
  43240. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43241. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43242. var render = function() {
  43243. var _vm = this
  43244. var _h = _vm.$createElement
  43245. var _c = _vm._self._c || _h
  43246. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43247. _c("div", { staticClass: "input-group" }, [
  43248. _c("input", {
  43249. directives: [
  43250. {
  43251. name: "model",
  43252. rawName: "v-model",
  43253. value: _vm.searchText,
  43254. expression: "searchText"
  43255. }
  43256. ],
  43257. staticClass: "form-control",
  43258. attrs: { type: "text" },
  43259. domProps: { value: _vm.searchText },
  43260. on: {
  43261. input: [
  43262. function($event) {
  43263. if ($event.target.composing) {
  43264. return
  43265. }
  43266. _vm.searchText = $event.target.value
  43267. },
  43268. _vm.searchChanged
  43269. ]
  43270. }
  43271. }),
  43272. _vm._v(" "),
  43273. _c("div", { staticClass: "form-group-append" }, [
  43274. _c(
  43275. "a",
  43276. {
  43277. staticClass: "toggle input-group-text bg-primary text-light",
  43278. on: {
  43279. mousedown: function($event) {
  43280. $event.preventDefault()
  43281. },
  43282. click: function($event) {
  43283. return _vm.setOpen(!_vm.open)
  43284. }
  43285. }
  43286. },
  43287. [
  43288. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43289. _vm._v(" "),
  43290. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43291. ]
  43292. )
  43293. ])
  43294. ]),
  43295. _vm._v(" "),
  43296. _c(
  43297. "ul",
  43298. { staticClass: "suggestion-list list-unstyled" },
  43299. _vm._l(_vm.matches, function(suggestion, index) {
  43300. return _c(
  43301. "li",
  43302. {
  43303. key: index,
  43304. on: {
  43305. mousedown: function($event) {
  43306. $event.preventDefault()
  43307. },
  43308. click: function($event) {
  43309. return _vm.suggestionSelected(suggestion)
  43310. }
  43311. }
  43312. },
  43313. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43314. )
  43315. }),
  43316. 0
  43317. )
  43318. ])
  43319. }
  43320. var staticRenderFns = []
  43321. render._withStripped = true
  43322. /***/ }),
  43323. /***/ "./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&":
  43324. /*!************************************************************************************************************************************************************************************************************************!*\
  43325. !*** ./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& ***!
  43326. \************************************************************************************************************************************************************************************************************************/
  43327. /*! exports provided: render, staticRenderFns */
  43328. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43329. "use strict";
  43330. __webpack_require__.r(__webpack_exports__);
  43331. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43332. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43333. var render = function() {
  43334. var _vm = this
  43335. var _h = _vm.$createElement
  43336. var _c = _vm._self._c || _h
  43337. return _c(
  43338. "modal",
  43339. {
  43340. attrs: {
  43341. id: _vm.id,
  43342. tabindex: "-1",
  43343. role: "dialog",
  43344. "aria-labelledby": _vm.id + "Label"
  43345. }
  43346. },
  43347. [
  43348. _c(
  43349. "h5",
  43350. {
  43351. staticClass: "modal-title",
  43352. attrs: { slot: "header", id: _vm.id + "Label" },
  43353. slot: "header"
  43354. },
  43355. [_vm._v("\n Edit Credential\n ")]
  43356. ),
  43357. _vm._v(" "),
  43358. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43359. _c(
  43360. "div",
  43361. { staticClass: "form" },
  43362. [
  43363. _c("autocomplete-custom-dropdown", {
  43364. attrs: {
  43365. options: _vm.descriptions,
  43366. value: _vm.creddesc,
  43367. "allow-custom": true
  43368. },
  43369. model: {
  43370. value: _vm.creddesc,
  43371. callback: function($$v) {
  43372. _vm.creddesc = $$v
  43373. },
  43374. expression: "creddesc"
  43375. }
  43376. })
  43377. ],
  43378. 1
  43379. ),
  43380. _vm._v(" "),
  43381. _c("div", { staticClass: "form-group" }, [
  43382. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43383. _vm._v(" "),
  43384. _c("input", {
  43385. directives: [
  43386. {
  43387. name: "model",
  43388. rawName: "v-model",
  43389. value: _vm.data.creduser,
  43390. expression: "data.creduser"
  43391. }
  43392. ],
  43393. staticClass: "form-control credential",
  43394. attrs: {
  43395. type: "text",
  43396. name: "newusername" + _vm.data.credid,
  43397. id: "newusername" + _vm.data.credid
  43398. },
  43399. domProps: { value: _vm.data.creduser },
  43400. on: {
  43401. input: function($event) {
  43402. if ($event.target.composing) {
  43403. return
  43404. }
  43405. _vm.$set(_vm.data, "creduser", $event.target.value)
  43406. }
  43407. }
  43408. })
  43409. ]),
  43410. _vm._v(" "),
  43411. _c("div", { staticClass: "form-group" }, [
  43412. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43413. _vm._v(" "),
  43414. _c("input", {
  43415. directives: [
  43416. {
  43417. name: "model",
  43418. rawName: "v-model",
  43419. value: _vm.data.credpass,
  43420. expression: "data.credpass"
  43421. }
  43422. ],
  43423. staticClass: "form-control credential",
  43424. attrs: {
  43425. type: "text",
  43426. name: "newpassword" + _vm.data.credid,
  43427. id: "newpassword" + _vm.data.credid
  43428. },
  43429. domProps: { value: _vm.data.credpass },
  43430. on: {
  43431. input: function($event) {
  43432. if ($event.target.composing) {
  43433. return
  43434. }
  43435. _vm.$set(_vm.data, "credpass", $event.target.value)
  43436. }
  43437. }
  43438. }),
  43439. _vm._v(" "),
  43440. _c(
  43441. "button",
  43442. {
  43443. staticClass: "btn btn-secondary",
  43444. attrs: { type: "button" },
  43445. on: {
  43446. click: function($event) {
  43447. return _vm.getRandomPassword(_vm.data.credid)
  43448. }
  43449. }
  43450. },
  43451. [_vm._v("Generate Random")]
  43452. )
  43453. ]),
  43454. _vm._v(" "),
  43455. _c("div", { staticClass: "form-group" })
  43456. ]),
  43457. _vm._v(" "),
  43458. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43459. _c(
  43460. "button",
  43461. {
  43462. staticClass: "btn btn-secondary",
  43463. attrs: { type: "button", "data-dismiss": "modal" }
  43464. },
  43465. [_vm._v("Close")]
  43466. ),
  43467. _vm._v(" "),
  43468. _c(
  43469. "button",
  43470. {
  43471. staticClass: "btn btn-primary",
  43472. attrs: { type: "button" },
  43473. on: {
  43474. click: function($event) {
  43475. return _vm.updateCredential()
  43476. }
  43477. }
  43478. },
  43479. [_vm._v("Save")]
  43480. )
  43481. ])
  43482. ]
  43483. )
  43484. }
  43485. var staticRenderFns = []
  43486. render._withStripped = true
  43487. /***/ }),
  43488. /***/ "./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&":
  43489. /*!*************************************************************************************************************************************************************************************************************!*\
  43490. !*** ./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& ***!
  43491. \*************************************************************************************************************************************************************************************************************/
  43492. /*! exports provided: render, staticRenderFns */
  43493. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43494. "use strict";
  43495. __webpack_require__.r(__webpack_exports__);
  43496. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43497. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43498. var render = function() {
  43499. var _vm = this
  43500. var _h = _vm.$createElement
  43501. var _c = _vm._self._c || _h
  43502. return _c(
  43503. "div",
  43504. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43505. [
  43506. _c("credential-form-modal", {
  43507. attrs: {
  43508. descriptions: _vm.creddescList,
  43509. "modal-id": "credential" + this.data.credid + "editModal",
  43510. populateWith: this.data
  43511. }
  43512. }),
  43513. _vm._v(" "),
  43514. _c("div", { staticClass: "row no-gutters" }, [
  43515. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43516. _vm._v(_vm._s(this.data.creddesc))
  43517. ]),
  43518. _vm._v(" "),
  43519. _c("div", { staticClass: "col-9 text-right" }, [
  43520. _vm._v(_vm._s(this.data.creddate))
  43521. ])
  43522. ]),
  43523. _vm._v(" "),
  43524. _c("div", { staticClass: "row" }, [
  43525. _c("div", { staticClass: "col-lg-9" }, [
  43526. _c("div", [
  43527. _vm._m(0),
  43528. _vm._v(" "),
  43529. _c("input", {
  43530. staticClass: "border-0 credential",
  43531. attrs: {
  43532. type: "text",
  43533. id: "username" + this.data.credid,
  43534. readonly: ""
  43535. },
  43536. domProps: { value: this.data.creduser }
  43537. }),
  43538. _vm._v(" "),
  43539. _c(
  43540. "button",
  43541. {
  43542. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43543. attrs: {
  43544. id: "btn-username" + this.data.credid,
  43545. "data-clipboard-target": "#username" + this.data.credid
  43546. }
  43547. },
  43548. [_c("i", { staticClass: "far fa-clone" })]
  43549. )
  43550. ]),
  43551. _vm._v(" "),
  43552. _c("div", [
  43553. _vm._m(1),
  43554. _vm._v(" "),
  43555. _c("input", {
  43556. staticClass: "border-0 credential",
  43557. attrs: {
  43558. type: "text",
  43559. id: "password" + this.data.credid,
  43560. readonly: ""
  43561. },
  43562. domProps: { value: this.data.credpass }
  43563. }),
  43564. _vm._v(" "),
  43565. _c(
  43566. "button",
  43567. {
  43568. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43569. attrs: {
  43570. id: "btn-password" + this.data.credid,
  43571. "data-clipboard-target": "#password" + this.data.credid
  43572. }
  43573. },
  43574. [_c("i", { staticClass: "far fa-clone" })]
  43575. )
  43576. ])
  43577. ]),
  43578. _vm._v(" "),
  43579. _c(
  43580. "div",
  43581. {
  43582. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43583. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43584. },
  43585. [
  43586. _c(
  43587. "button",
  43588. {
  43589. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43590. attrs: {
  43591. type: "button",
  43592. "data-toggle": "modal",
  43593. "data-target": "#credential" + this.data.credid + "editModal"
  43594. }
  43595. },
  43596. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43597. ),
  43598. _vm._v(" "),
  43599. _vm._m(2)
  43600. ]
  43601. )
  43602. ])
  43603. ],
  43604. 1
  43605. )
  43606. }
  43607. var staticRenderFns = [
  43608. function() {
  43609. var _vm = this
  43610. var _h = _vm.$createElement
  43611. var _c = _vm._self._c || _h
  43612. return _c("label", { attrs: { for: "username" } }, [
  43613. _c("i", { staticClass: "fas fa-fw fa-user" })
  43614. ])
  43615. },
  43616. function() {
  43617. var _vm = this
  43618. var _h = _vm.$createElement
  43619. var _c = _vm._self._c || _h
  43620. return _c("label", { attrs: { for: "password" } }, [
  43621. _c("i", { staticClass: "fas fa-fw fa-key" })
  43622. ])
  43623. },
  43624. function() {
  43625. var _vm = this
  43626. var _h = _vm.$createElement
  43627. var _c = _vm._self._c || _h
  43628. return _c(
  43629. "button",
  43630. {
  43631. staticClass: "btn btn-sm btn-danger p-lg-1",
  43632. attrs: { type: "button" }
  43633. },
  43634. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43635. )
  43636. }
  43637. ]
  43638. render._withStripped = true
  43639. /***/ }),
  43640. /***/ "./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&":
  43641. /*!************************************************************************************************************************************************************************************************************!*\
  43642. !*** ./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& ***!
  43643. \************************************************************************************************************************************************************************************************************/
  43644. /*! exports provided: render, staticRenderFns */
  43645. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43646. "use strict";
  43647. __webpack_require__.r(__webpack_exports__);
  43648. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43649. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43650. var render = function() {
  43651. var _vm = this
  43652. var _h = _vm.$createElement
  43653. var _c = _vm._self._c || _h
  43654. return _c(
  43655. "ul",
  43656. { staticClass: "list-unstyled" },
  43657. _vm._l(_vm.errorList, function(error) {
  43658. return _c("li", { key: error, staticClass: "text-danger" }, [
  43659. _vm._v(" " + _vm._s(error) + " ")
  43660. ])
  43661. }),
  43662. 0
  43663. )
  43664. }
  43665. var staticRenderFns = []
  43666. render._withStripped = true
  43667. /***/ }),
  43668. /***/ "./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&":
  43669. /*!********************************************************************************************************************************************************************************************************!*\
  43670. !*** ./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& ***!
  43671. \********************************************************************************************************************************************************************************************************/
  43672. /*! exports provided: render, staticRenderFns */
  43673. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43674. "use strict";
  43675. __webpack_require__.r(__webpack_exports__);
  43676. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43677. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43678. var render = function() {
  43679. var _vm = this
  43680. var _h = _vm.$createElement
  43681. var _c = _vm._self._c || _h
  43682. return _c("div", { staticClass: "modal fade" }, [
  43683. _c(
  43684. "div",
  43685. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43686. [
  43687. _c("div", { staticClass: "modal-content" }, [
  43688. _c(
  43689. "div",
  43690. { staticClass: "modal-header" },
  43691. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43692. 2
  43693. ),
  43694. _vm._v(" "),
  43695. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43696. _vm._v(" "),
  43697. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43698. ])
  43699. ]
  43700. )
  43701. ])
  43702. }
  43703. var staticRenderFns = [
  43704. function() {
  43705. var _vm = this
  43706. var _h = _vm.$createElement
  43707. var _c = _vm._self._c || _h
  43708. return _c(
  43709. "button",
  43710. {
  43711. staticClass: "close",
  43712. attrs: {
  43713. type: "button",
  43714. "data-dismiss": "modal",
  43715. "aria-label": "Close"
  43716. }
  43717. },
  43718. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43719. )
  43720. }
  43721. ]
  43722. render._withStripped = true
  43723. /***/ }),
  43724. /***/ "./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&":
  43725. /*!********************************************************************************************************************************************************************************************************!*\
  43726. !*** ./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& ***!
  43727. \********************************************************************************************************************************************************************************************************/
  43728. /*! exports provided: render, staticRenderFns */
  43729. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43730. "use strict";
  43731. __webpack_require__.r(__webpack_exports__);
  43732. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43733. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43734. var render = function() {
  43735. var _vm = this
  43736. var _h = _vm.$createElement
  43737. var _c = _vm._self._c || _h
  43738. return _c(
  43739. "ul",
  43740. { staticClass: "list-unstyled" },
  43741. _vm._l(this.notes, function(note) {
  43742. return _c(
  43743. "li",
  43744. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43745. [
  43746. _c(
  43747. "modal",
  43748. {
  43749. attrs: {
  43750. id: "note" + note.noteid + "editModal",
  43751. tabindex: "-1",
  43752. role: "dialog",
  43753. "aria-labelledby": "note" + note.noteid + "editModalLabel"
  43754. }
  43755. },
  43756. [
  43757. _c(
  43758. "h5",
  43759. {
  43760. staticClass: "modal-title",
  43761. attrs: {
  43762. slot: "header",
  43763. id: "note" + note.noteid + "editModalLabel"
  43764. },
  43765. slot: "header"
  43766. },
  43767. [_vm._v("\n Edit Note\n ")]
  43768. ),
  43769. _vm._v(" "),
  43770. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43771. _c("div", { staticClass: "form-group" }, [
  43772. _c("label", { attrs: { for: "content" } }, [
  43773. _vm._v("Content")
  43774. ]),
  43775. _vm._v(" "),
  43776. _c("textarea", {
  43777. directives: [
  43778. {
  43779. name: "model",
  43780. rawName: "v-model",
  43781. value: note.thenote,
  43782. expression: "note.thenote"
  43783. }
  43784. ],
  43785. staticClass: "form-control",
  43786. attrs: {
  43787. name: "content" + note.noteid,
  43788. id: "content" + note.noteid
  43789. },
  43790. domProps: { value: note.thenote },
  43791. on: {
  43792. input: function($event) {
  43793. if ($event.target.composing) {
  43794. return
  43795. }
  43796. _vm.$set(note, "thenote", $event.target.value)
  43797. }
  43798. }
  43799. })
  43800. ])
  43801. ]),
  43802. _vm._v(" "),
  43803. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43804. _c(
  43805. "button",
  43806. {
  43807. staticClass: "btn btn-secondary",
  43808. attrs: { type: "button", "data-dismiss": "modal" }
  43809. },
  43810. [_vm._v("Close")]
  43811. ),
  43812. _vm._v(" "),
  43813. _c(
  43814. "button",
  43815. {
  43816. staticClass: "btn btn-primary",
  43817. attrs: { type: "button" },
  43818. on: {
  43819. click: function($event) {
  43820. return _vm.updateNote(note.noteid)
  43821. }
  43822. }
  43823. },
  43824. [_vm._v("Save")]
  43825. )
  43826. ])
  43827. ]
  43828. ),
  43829. _vm._v(" "),
  43830. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  43831. _c("div", { staticClass: "text-center p-0 m-0" }, [
  43832. _vm._v(_vm._s(note.noteuser))
  43833. ]),
  43834. _vm._v(" "),
  43835. _c(
  43836. "div",
  43837. { staticClass: "text-muted text-small text-center p-0 m-0" },
  43838. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  43839. ),
  43840. _vm._v(" "),
  43841. _c(
  43842. "div",
  43843. { staticClass: "btn-group justify-content-center p-0 m-0" },
  43844. [
  43845. _vm.authusername === note.noteuser ||
  43846. _vm.authusername === "admin"
  43847. ? [
  43848. _c(
  43849. "button",
  43850. {
  43851. staticClass: "btn btn-sm btn-primary m-1",
  43852. attrs: {
  43853. "data-toggle": "modal",
  43854. "data-target": "#note" + note.noteid + "editModal"
  43855. }
  43856. },
  43857. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43858. ),
  43859. _vm._v(" "),
  43860. _vm._m(0, true),
  43861. _vm._v(" "),
  43862. _vm._m(1, true)
  43863. ]
  43864. : _vm._e()
  43865. ],
  43866. 2
  43867. )
  43868. ]),
  43869. _vm._v(" "),
  43870. _c("div", { staticClass: "col-md-10" }, [
  43871. _c("div", { staticClass: "card m-2" }, [
  43872. _c("div", { staticClass: "card-body p-2" }, [
  43873. _vm._v(
  43874. "\n " +
  43875. _vm._s(note.thenote) +
  43876. "\n "
  43877. )
  43878. ])
  43879. ])
  43880. ])
  43881. ],
  43882. 1
  43883. )
  43884. }),
  43885. 0
  43886. )
  43887. }
  43888. var staticRenderFns = [
  43889. function() {
  43890. var _vm = this
  43891. var _h = _vm.$createElement
  43892. var _c = _vm._self._c || _h
  43893. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  43894. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  43895. ])
  43896. },
  43897. function() {
  43898. var _vm = this
  43899. var _h = _vm.$createElement
  43900. var _c = _vm._self._c || _h
  43901. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  43902. _c("i", { staticClass: "fa fa-fw fa-random" })
  43903. ])
  43904. }
  43905. ]
  43906. render._withStripped = true
  43907. /***/ }),
  43908. /***/ "./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&":
  43909. /*!********************************************************************************************************************************************************************************************************************!*\
  43910. !*** ./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& ***!
  43911. \********************************************************************************************************************************************************************************************************************/
  43912. /*! exports provided: render, staticRenderFns */
  43913. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43914. "use strict";
  43915. __webpack_require__.r(__webpack_exports__);
  43916. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43917. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43918. var render = function() {
  43919. var _vm = this
  43920. var _h = _vm.$createElement
  43921. var _c = _vm._self._c || _h
  43922. return _c(
  43923. "modal",
  43924. {
  43925. attrs: {
  43926. id: _vm.id,
  43927. tabindex: "-1",
  43928. role: "dialog",
  43929. "aria-labelledby": _vm.id + "Label"
  43930. }
  43931. },
  43932. [
  43933. _c(
  43934. "h5",
  43935. {
  43936. staticClass: "modal-title",
  43937. attrs: { slot: "header", id: _vm.id + "Label" },
  43938. slot: "header"
  43939. },
  43940. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  43941. ),
  43942. _vm._v(" "),
  43943. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43944. _c(
  43945. "div",
  43946. { staticClass: "form-group" },
  43947. [
  43948. _c("label", { attrs: { for: "probdesc" } }, [
  43949. _vm._v("Problem Description")
  43950. ]),
  43951. _vm._v(" "),
  43952. _c("textarea", {
  43953. directives: [
  43954. {
  43955. name: "model",
  43956. rawName: "v-model",
  43957. value: _vm.data.probdesc,
  43958. expression: "data.probdesc"
  43959. }
  43960. ],
  43961. class: {
  43962. "form-control": true,
  43963. "is-invalid": _vm.errors.probdesc
  43964. },
  43965. attrs: { id: "probdesc", name: "probdesc" },
  43966. domProps: { value: _vm.data.probdesc },
  43967. on: {
  43968. input: function($event) {
  43969. if ($event.target.composing) {
  43970. return
  43971. }
  43972. _vm.$set(_vm.data, "probdesc", $event.target.value)
  43973. }
  43974. }
  43975. }),
  43976. _vm._v(" "),
  43977. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  43978. ],
  43979. 1
  43980. ),
  43981. _vm._v(" "),
  43982. _c(
  43983. "div",
  43984. { staticClass: "form-group" },
  43985. [
  43986. _c("label", { attrs: { for: "suggested" } }, [
  43987. _vm._v("Suggested Solution")
  43988. ]),
  43989. _vm._v(" "),
  43990. _c("textarea", {
  43991. directives: [
  43992. {
  43993. name: "model",
  43994. rawName: "v-model",
  43995. value: _vm.data.suggested,
  43996. expression: "data.suggested"
  43997. }
  43998. ],
  43999. class: {
  44000. "form-control": true,
  44001. "is-invalid": _vm.errors.suggested
  44002. },
  44003. attrs: { id: "suggested", name: "suggested" },
  44004. domProps: { value: _vm.data.suggested },
  44005. on: {
  44006. input: function($event) {
  44007. if ($event.target.composing) {
  44008. return
  44009. }
  44010. _vm.$set(_vm.data, "suggested", $event.target.value)
  44011. }
  44012. }
  44013. }),
  44014. _vm._v(" "),
  44015. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44016. ],
  44017. 1
  44018. ),
  44019. _vm._v(" "),
  44020. _c(
  44021. "div",
  44022. { staticClass: "form-group" },
  44023. [
  44024. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44025. _vm._v(" "),
  44026. _c("autocomplete-custom-dropdown", {
  44027. attrs: { options: _vm.storeList, value: this.store },
  44028. model: {
  44029. value: _vm.store,
  44030. callback: function($$v) {
  44031. _vm.store = $$v
  44032. },
  44033. expression: "store"
  44034. }
  44035. })
  44036. ],
  44037. 1
  44038. )
  44039. ]),
  44040. _vm._v(" "),
  44041. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44042. _c(
  44043. "button",
  44044. {
  44045. staticClass: "btn btn-secondary",
  44046. attrs: { type: "button", "data-dismiss": "modal" }
  44047. },
  44048. [_vm._v("Close")]
  44049. ),
  44050. _vm._v(" "),
  44051. _c(
  44052. "button",
  44053. {
  44054. staticClass: "btn btn-primary",
  44055. attrs: { type: "button" },
  44056. on: {
  44057. click: function($event) {
  44058. return _vm.updateWorkOrder()
  44059. }
  44060. }
  44061. },
  44062. [_vm._v("Save")]
  44063. )
  44064. ])
  44065. ]
  44066. )
  44067. }
  44068. var staticRenderFns = []
  44069. render._withStripped = true
  44070. /***/ }),
  44071. /***/ "./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&":
  44072. /*!*********************************************************************************************************************************************************************************************************!*\
  44073. !*** ./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& ***!
  44074. \*********************************************************************************************************************************************************************************************************/
  44075. /*! exports provided: render, staticRenderFns */
  44076. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44077. "use strict";
  44078. __webpack_require__.r(__webpack_exports__);
  44079. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44080. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44081. var render = function() {
  44082. var _vm = this
  44083. var _h = _vm.$createElement
  44084. var _c = _vm._self._c || _h
  44085. return _c(
  44086. "div",
  44087. [
  44088. _c("woinfo-edit-modal", {
  44089. attrs: {
  44090. "modal-id": "workordereditModal",
  44091. "populate-with": this.data,
  44092. "store-list": this.storeList
  44093. }
  44094. }),
  44095. _vm._v(" "),
  44096. _c("p", [
  44097. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44098. _vm._v(" "),
  44099. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44100. ]),
  44101. _vm._v(" "),
  44102. _c("p", [
  44103. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44104. _vm._v(" "),
  44105. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44106. ]),
  44107. _vm._v(" "),
  44108. _c("p", [
  44109. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44110. _vm._v(" "),
  44111. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44112. ]),
  44113. _vm._v(" "),
  44114. _c("p", [
  44115. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44116. _vm._v(" "),
  44117. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44118. ]),
  44119. _vm._v(" "),
  44120. _c("p", [
  44121. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44122. _vm._v(" "),
  44123. _c(
  44124. "span",
  44125. {
  44126. staticClass: "dashed-underline",
  44127. attrs: {
  44128. "data-toggle": "tooltip",
  44129. "data-placement": "bottom",
  44130. title: this.getHRDate(this.data.dropdate)
  44131. }
  44132. },
  44133. [
  44134. _vm._v(
  44135. "\n " +
  44136. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44137. " days ago\n "
  44138. )
  44139. ]
  44140. )
  44141. ]),
  44142. _vm._v(" "),
  44143. _c("p", [
  44144. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44145. _vm._v(" "),
  44146. !this.isZero(this.data.pickupdate)
  44147. ? _c(
  44148. "span",
  44149. {
  44150. staticClass: "dashed-underline",
  44151. attrs: {
  44152. "data-toggle": "tooltip",
  44153. "data-placement": "bottom",
  44154. title: this.getHRDate(this.data.pickupdate)
  44155. }
  44156. },
  44157. [
  44158. _vm._v(
  44159. "\n " +
  44160. _vm._s(
  44161. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44162. ) +
  44163. " days ago\n "
  44164. )
  44165. ]
  44166. )
  44167. : _vm._e()
  44168. ]),
  44169. _vm._v(" "),
  44170. _c(
  44171. "button",
  44172. {
  44173. staticClass: "btn btn-primary",
  44174. attrs: {
  44175. type: "button",
  44176. "data-toggle": "modal",
  44177. "data-target": "#workordereditModal"
  44178. }
  44179. },
  44180. [_vm._v("Edit")]
  44181. )
  44182. ],
  44183. 1
  44184. )
  44185. }
  44186. var staticRenderFns = []
  44187. render._withStripped = true
  44188. /***/ }),
  44189. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44190. /*!********************************************************************!*\
  44191. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44192. \********************************************************************/
  44193. /*! exports provided: default */
  44194. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44195. "use strict";
  44196. __webpack_require__.r(__webpack_exports__);
  44197. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44198. /* globals __VUE_SSR_CONTEXT__ */
  44199. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44200. // This module is a runtime utility for cleaner component module output and will
  44201. // be included in the final webpack user bundle.
  44202. function normalizeComponent (
  44203. scriptExports,
  44204. render,
  44205. staticRenderFns,
  44206. functionalTemplate,
  44207. injectStyles,
  44208. scopeId,
  44209. moduleIdentifier, /* server only */
  44210. shadowMode /* vue-cli only */
  44211. ) {
  44212. // Vue.extend constructor export interop
  44213. var options = typeof scriptExports === 'function'
  44214. ? scriptExports.options
  44215. : scriptExports
  44216. // render functions
  44217. if (render) {
  44218. options.render = render
  44219. options.staticRenderFns = staticRenderFns
  44220. options._compiled = true
  44221. }
  44222. // functional template
  44223. if (functionalTemplate) {
  44224. options.functional = true
  44225. }
  44226. // scopedId
  44227. if (scopeId) {
  44228. options._scopeId = 'data-v-' + scopeId
  44229. }
  44230. var hook
  44231. if (moduleIdentifier) { // server build
  44232. hook = function (context) {
  44233. // 2.3 injection
  44234. context =
  44235. context || // cached call
  44236. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44237. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44238. // 2.2 with runInNewContext: true
  44239. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44240. context = __VUE_SSR_CONTEXT__
  44241. }
  44242. // inject component styles
  44243. if (injectStyles) {
  44244. injectStyles.call(this, context)
  44245. }
  44246. // register component module identifier for async chunk inferrence
  44247. if (context && context._registeredComponents) {
  44248. context._registeredComponents.add(moduleIdentifier)
  44249. }
  44250. }
  44251. // used by ssr in case component is cached and beforeCreate
  44252. // never gets called
  44253. options._ssrRegister = hook
  44254. } else if (injectStyles) {
  44255. hook = shadowMode
  44256. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44257. : injectStyles
  44258. }
  44259. if (hook) {
  44260. if (options.functional) {
  44261. // for template-only hot-reload because in that case the render fn doesn't
  44262. // go through the normalizer
  44263. options._injectStyles = hook
  44264. // register for functioal component in vue file
  44265. var originalRender = options.render
  44266. options.render = function renderWithStyleInjection (h, context) {
  44267. hook.call(context)
  44268. return originalRender(h, context)
  44269. }
  44270. } else {
  44271. // inject component registration as beforeCreate hook
  44272. var existing = options.beforeCreate
  44273. options.beforeCreate = existing
  44274. ? [].concat(existing, hook)
  44275. : [hook]
  44276. }
  44277. }
  44278. return {
  44279. exports: scriptExports,
  44280. options: options
  44281. }
  44282. }
  44283. /***/ }),
  44284. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44285. /*!*************************************************!*\
  44286. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44287. \*************************************************/
  44288. /*! no static exports found */
  44289. /***/ (function(module, exports, __webpack_require__) {
  44290. "use strict";
  44291. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44292. * Vue.js v2.6.11
  44293. * (c) 2014-2019 Evan You
  44294. * Released under the MIT License.
  44295. */
  44296. /* */
  44297. var emptyObject = Object.freeze({});
  44298. // These helpers produce better VM code in JS engines due to their
  44299. // explicitness and function inlining.
  44300. function isUndef (v) {
  44301. return v === undefined || v === null
  44302. }
  44303. function isDef (v) {
  44304. return v !== undefined && v !== null
  44305. }
  44306. function isTrue (v) {
  44307. return v === true
  44308. }
  44309. function isFalse (v) {
  44310. return v === false
  44311. }
  44312. /**
  44313. * Check if value is primitive.
  44314. */
  44315. function isPrimitive (value) {
  44316. return (
  44317. typeof value === 'string' ||
  44318. typeof value === 'number' ||
  44319. // $flow-disable-line
  44320. typeof value === 'symbol' ||
  44321. typeof value === 'boolean'
  44322. )
  44323. }
  44324. /**
  44325. * Quick object check - this is primarily used to tell
  44326. * Objects from primitive values when we know the value
  44327. * is a JSON-compliant type.
  44328. */
  44329. function isObject (obj) {
  44330. return obj !== null && typeof obj === 'object'
  44331. }
  44332. /**
  44333. * Get the raw type string of a value, e.g., [object Object].
  44334. */
  44335. var _toString = Object.prototype.toString;
  44336. function toRawType (value) {
  44337. return _toString.call(value).slice(8, -1)
  44338. }
  44339. /**
  44340. * Strict object type check. Only returns true
  44341. * for plain JavaScript objects.
  44342. */
  44343. function isPlainObject (obj) {
  44344. return _toString.call(obj) === '[object Object]'
  44345. }
  44346. function isRegExp (v) {
  44347. return _toString.call(v) === '[object RegExp]'
  44348. }
  44349. /**
  44350. * Check if val is a valid array index.
  44351. */
  44352. function isValidArrayIndex (val) {
  44353. var n = parseFloat(String(val));
  44354. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44355. }
  44356. function isPromise (val) {
  44357. return (
  44358. isDef(val) &&
  44359. typeof val.then === 'function' &&
  44360. typeof val.catch === 'function'
  44361. )
  44362. }
  44363. /**
  44364. * Convert a value to a string that is actually rendered.
  44365. */
  44366. function toString (val) {
  44367. return val == null
  44368. ? ''
  44369. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44370. ? JSON.stringify(val, null, 2)
  44371. : String(val)
  44372. }
  44373. /**
  44374. * Convert an input value to a number for persistence.
  44375. * If the conversion fails, return original string.
  44376. */
  44377. function toNumber (val) {
  44378. var n = parseFloat(val);
  44379. return isNaN(n) ? val : n
  44380. }
  44381. /**
  44382. * Make a map and return a function for checking if a key
  44383. * is in that map.
  44384. */
  44385. function makeMap (
  44386. str,
  44387. expectsLowerCase
  44388. ) {
  44389. var map = Object.create(null);
  44390. var list = str.split(',');
  44391. for (var i = 0; i < list.length; i++) {
  44392. map[list[i]] = true;
  44393. }
  44394. return expectsLowerCase
  44395. ? function (val) { return map[val.toLowerCase()]; }
  44396. : function (val) { return map[val]; }
  44397. }
  44398. /**
  44399. * Check if a tag is a built-in tag.
  44400. */
  44401. var isBuiltInTag = makeMap('slot,component', true);
  44402. /**
  44403. * Check if an attribute is a reserved attribute.
  44404. */
  44405. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44406. /**
  44407. * Remove an item from an array.
  44408. */
  44409. function remove (arr, item) {
  44410. if (arr.length) {
  44411. var index = arr.indexOf(item);
  44412. if (index > -1) {
  44413. return arr.splice(index, 1)
  44414. }
  44415. }
  44416. }
  44417. /**
  44418. * Check whether an object has the property.
  44419. */
  44420. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44421. function hasOwn (obj, key) {
  44422. return hasOwnProperty.call(obj, key)
  44423. }
  44424. /**
  44425. * Create a cached version of a pure function.
  44426. */
  44427. function cached (fn) {
  44428. var cache = Object.create(null);
  44429. return (function cachedFn (str) {
  44430. var hit = cache[str];
  44431. return hit || (cache[str] = fn(str))
  44432. })
  44433. }
  44434. /**
  44435. * Camelize a hyphen-delimited string.
  44436. */
  44437. var camelizeRE = /-(\w)/g;
  44438. var camelize = cached(function (str) {
  44439. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44440. });
  44441. /**
  44442. * Capitalize a string.
  44443. */
  44444. var capitalize = cached(function (str) {
  44445. return str.charAt(0).toUpperCase() + str.slice(1)
  44446. });
  44447. /**
  44448. * Hyphenate a camelCase string.
  44449. */
  44450. var hyphenateRE = /\B([A-Z])/g;
  44451. var hyphenate = cached(function (str) {
  44452. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44453. });
  44454. /**
  44455. * Simple bind polyfill for environments that do not support it,
  44456. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44457. * since native bind is now performant enough in most browsers.
  44458. * But removing it would mean breaking code that was able to run in
  44459. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44460. */
  44461. /* istanbul ignore next */
  44462. function polyfillBind (fn, ctx) {
  44463. function boundFn (a) {
  44464. var l = arguments.length;
  44465. return l
  44466. ? l > 1
  44467. ? fn.apply(ctx, arguments)
  44468. : fn.call(ctx, a)
  44469. : fn.call(ctx)
  44470. }
  44471. boundFn._length = fn.length;
  44472. return boundFn
  44473. }
  44474. function nativeBind (fn, ctx) {
  44475. return fn.bind(ctx)
  44476. }
  44477. var bind = Function.prototype.bind
  44478. ? nativeBind
  44479. : polyfillBind;
  44480. /**
  44481. * Convert an Array-like object to a real Array.
  44482. */
  44483. function toArray (list, start) {
  44484. start = start || 0;
  44485. var i = list.length - start;
  44486. var ret = new Array(i);
  44487. while (i--) {
  44488. ret[i] = list[i + start];
  44489. }
  44490. return ret
  44491. }
  44492. /**
  44493. * Mix properties into target object.
  44494. */
  44495. function extend (to, _from) {
  44496. for (var key in _from) {
  44497. to[key] = _from[key];
  44498. }
  44499. return to
  44500. }
  44501. /**
  44502. * Merge an Array of Objects into a single Object.
  44503. */
  44504. function toObject (arr) {
  44505. var res = {};
  44506. for (var i = 0; i < arr.length; i++) {
  44507. if (arr[i]) {
  44508. extend(res, arr[i]);
  44509. }
  44510. }
  44511. return res
  44512. }
  44513. /* eslint-disable no-unused-vars */
  44514. /**
  44515. * Perform no operation.
  44516. * Stubbing args to make Flow happy without leaving useless transpiled code
  44517. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44518. */
  44519. function noop (a, b, c) {}
  44520. /**
  44521. * Always return false.
  44522. */
  44523. var no = function (a, b, c) { return false; };
  44524. /* eslint-enable no-unused-vars */
  44525. /**
  44526. * Return the same value.
  44527. */
  44528. var identity = function (_) { return _; };
  44529. /**
  44530. * Generate a string containing static keys from compiler modules.
  44531. */
  44532. function genStaticKeys (modules) {
  44533. return modules.reduce(function (keys, m) {
  44534. return keys.concat(m.staticKeys || [])
  44535. }, []).join(',')
  44536. }
  44537. /**
  44538. * Check if two values are loosely equal - that is,
  44539. * if they are plain objects, do they have the same shape?
  44540. */
  44541. function looseEqual (a, b) {
  44542. if (a === b) { return true }
  44543. var isObjectA = isObject(a);
  44544. var isObjectB = isObject(b);
  44545. if (isObjectA && isObjectB) {
  44546. try {
  44547. var isArrayA = Array.isArray(a);
  44548. var isArrayB = Array.isArray(b);
  44549. if (isArrayA && isArrayB) {
  44550. return a.length === b.length && a.every(function (e, i) {
  44551. return looseEqual(e, b[i])
  44552. })
  44553. } else if (a instanceof Date && b instanceof Date) {
  44554. return a.getTime() === b.getTime()
  44555. } else if (!isArrayA && !isArrayB) {
  44556. var keysA = Object.keys(a);
  44557. var keysB = Object.keys(b);
  44558. return keysA.length === keysB.length && keysA.every(function (key) {
  44559. return looseEqual(a[key], b[key])
  44560. })
  44561. } else {
  44562. /* istanbul ignore next */
  44563. return false
  44564. }
  44565. } catch (e) {
  44566. /* istanbul ignore next */
  44567. return false
  44568. }
  44569. } else if (!isObjectA && !isObjectB) {
  44570. return String(a) === String(b)
  44571. } else {
  44572. return false
  44573. }
  44574. }
  44575. /**
  44576. * Return the first index at which a loosely equal value can be
  44577. * found in the array (if value is a plain object, the array must
  44578. * contain an object of the same shape), or -1 if it is not present.
  44579. */
  44580. function looseIndexOf (arr, val) {
  44581. for (var i = 0; i < arr.length; i++) {
  44582. if (looseEqual(arr[i], val)) { return i }
  44583. }
  44584. return -1
  44585. }
  44586. /**
  44587. * Ensure a function is called only once.
  44588. */
  44589. function once (fn) {
  44590. var called = false;
  44591. return function () {
  44592. if (!called) {
  44593. called = true;
  44594. fn.apply(this, arguments);
  44595. }
  44596. }
  44597. }
  44598. var SSR_ATTR = 'data-server-rendered';
  44599. var ASSET_TYPES = [
  44600. 'component',
  44601. 'directive',
  44602. 'filter'
  44603. ];
  44604. var LIFECYCLE_HOOKS = [
  44605. 'beforeCreate',
  44606. 'created',
  44607. 'beforeMount',
  44608. 'mounted',
  44609. 'beforeUpdate',
  44610. 'updated',
  44611. 'beforeDestroy',
  44612. 'destroyed',
  44613. 'activated',
  44614. 'deactivated',
  44615. 'errorCaptured',
  44616. 'serverPrefetch'
  44617. ];
  44618. /* */
  44619. var config = ({
  44620. /**
  44621. * Option merge strategies (used in core/util/options)
  44622. */
  44623. // $flow-disable-line
  44624. optionMergeStrategies: Object.create(null),
  44625. /**
  44626. * Whether to suppress warnings.
  44627. */
  44628. silent: false,
  44629. /**
  44630. * Show production mode tip message on boot?
  44631. */
  44632. productionTip: "development" !== 'production',
  44633. /**
  44634. * Whether to enable devtools
  44635. */
  44636. devtools: "development" !== 'production',
  44637. /**
  44638. * Whether to record perf
  44639. */
  44640. performance: false,
  44641. /**
  44642. * Error handler for watcher errors
  44643. */
  44644. errorHandler: null,
  44645. /**
  44646. * Warn handler for watcher warns
  44647. */
  44648. warnHandler: null,
  44649. /**
  44650. * Ignore certain custom elements
  44651. */
  44652. ignoredElements: [],
  44653. /**
  44654. * Custom user key aliases for v-on
  44655. */
  44656. // $flow-disable-line
  44657. keyCodes: Object.create(null),
  44658. /**
  44659. * Check if a tag is reserved so that it cannot be registered as a
  44660. * component. This is platform-dependent and may be overwritten.
  44661. */
  44662. isReservedTag: no,
  44663. /**
  44664. * Check if an attribute is reserved so that it cannot be used as a component
  44665. * prop. This is platform-dependent and may be overwritten.
  44666. */
  44667. isReservedAttr: no,
  44668. /**
  44669. * Check if a tag is an unknown element.
  44670. * Platform-dependent.
  44671. */
  44672. isUnknownElement: no,
  44673. /**
  44674. * Get the namespace of an element
  44675. */
  44676. getTagNamespace: noop,
  44677. /**
  44678. * Parse the real tag name for the specific platform.
  44679. */
  44680. parsePlatformTagName: identity,
  44681. /**
  44682. * Check if an attribute must be bound using property, e.g. value
  44683. * Platform-dependent.
  44684. */
  44685. mustUseProp: no,
  44686. /**
  44687. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44688. * This will significantly reduce performance if set to false.
  44689. */
  44690. async: true,
  44691. /**
  44692. * Exposed for legacy reasons
  44693. */
  44694. _lifecycleHooks: LIFECYCLE_HOOKS
  44695. });
  44696. /* */
  44697. /**
  44698. * unicode letters used for parsing html tags, component names and property paths.
  44699. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44700. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44701. */
  44702. 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/;
  44703. /**
  44704. * Check if a string starts with $ or _
  44705. */
  44706. function isReserved (str) {
  44707. var c = (str + '').charCodeAt(0);
  44708. return c === 0x24 || c === 0x5F
  44709. }
  44710. /**
  44711. * Define a property.
  44712. */
  44713. function def (obj, key, val, enumerable) {
  44714. Object.defineProperty(obj, key, {
  44715. value: val,
  44716. enumerable: !!enumerable,
  44717. writable: true,
  44718. configurable: true
  44719. });
  44720. }
  44721. /**
  44722. * Parse simple path.
  44723. */
  44724. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44725. function parsePath (path) {
  44726. if (bailRE.test(path)) {
  44727. return
  44728. }
  44729. var segments = path.split('.');
  44730. return function (obj) {
  44731. for (var i = 0; i < segments.length; i++) {
  44732. if (!obj) { return }
  44733. obj = obj[segments[i]];
  44734. }
  44735. return obj
  44736. }
  44737. }
  44738. /* */
  44739. // can we use __proto__?
  44740. var hasProto = '__proto__' in {};
  44741. // Browser environment sniffing
  44742. var inBrowser = typeof window !== 'undefined';
  44743. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44744. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44745. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44746. var isIE = UA && /msie|trident/.test(UA);
  44747. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44748. var isEdge = UA && UA.indexOf('edge/') > 0;
  44749. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44750. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44751. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44752. var isPhantomJS = UA && /phantomjs/.test(UA);
  44753. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44754. // Firefox has a "watch" function on Object.prototype...
  44755. var nativeWatch = ({}).watch;
  44756. var supportsPassive = false;
  44757. if (inBrowser) {
  44758. try {
  44759. var opts = {};
  44760. Object.defineProperty(opts, 'passive', ({
  44761. get: function get () {
  44762. /* istanbul ignore next */
  44763. supportsPassive = true;
  44764. }
  44765. })); // https://github.com/facebook/flow/issues/285
  44766. window.addEventListener('test-passive', null, opts);
  44767. } catch (e) {}
  44768. }
  44769. // this needs to be lazy-evaled because vue may be required before
  44770. // vue-server-renderer can set VUE_ENV
  44771. var _isServer;
  44772. var isServerRendering = function () {
  44773. if (_isServer === undefined) {
  44774. /* istanbul ignore if */
  44775. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  44776. // detect presence of vue-server-renderer and avoid
  44777. // Webpack shimming the process
  44778. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  44779. } else {
  44780. _isServer = false;
  44781. }
  44782. }
  44783. return _isServer
  44784. };
  44785. // detect devtools
  44786. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  44787. /* istanbul ignore next */
  44788. function isNative (Ctor) {
  44789. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  44790. }
  44791. var hasSymbol =
  44792. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  44793. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  44794. var _Set;
  44795. /* istanbul ignore if */ // $flow-disable-line
  44796. if (typeof Set !== 'undefined' && isNative(Set)) {
  44797. // use native Set when available.
  44798. _Set = Set;
  44799. } else {
  44800. // a non-standard Set polyfill that only works with primitive keys.
  44801. _Set = /*@__PURE__*/(function () {
  44802. function Set () {
  44803. this.set = Object.create(null);
  44804. }
  44805. Set.prototype.has = function has (key) {
  44806. return this.set[key] === true
  44807. };
  44808. Set.prototype.add = function add (key) {
  44809. this.set[key] = true;
  44810. };
  44811. Set.prototype.clear = function clear () {
  44812. this.set = Object.create(null);
  44813. };
  44814. return Set;
  44815. }());
  44816. }
  44817. /* */
  44818. var warn = noop;
  44819. var tip = noop;
  44820. var generateComponentTrace = (noop); // work around flow check
  44821. var formatComponentName = (noop);
  44822. {
  44823. var hasConsole = typeof console !== 'undefined';
  44824. var classifyRE = /(?:^|[-_])(\w)/g;
  44825. var classify = function (str) { return str
  44826. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  44827. .replace(/[-_]/g, ''); };
  44828. warn = function (msg, vm) {
  44829. var trace = vm ? generateComponentTrace(vm) : '';
  44830. if (config.warnHandler) {
  44831. config.warnHandler.call(null, msg, vm, trace);
  44832. } else if (hasConsole && (!config.silent)) {
  44833. console.error(("[Vue warn]: " + msg + trace));
  44834. }
  44835. };
  44836. tip = function (msg, vm) {
  44837. if (hasConsole && (!config.silent)) {
  44838. console.warn("[Vue tip]: " + msg + (
  44839. vm ? generateComponentTrace(vm) : ''
  44840. ));
  44841. }
  44842. };
  44843. formatComponentName = function (vm, includeFile) {
  44844. if (vm.$root === vm) {
  44845. return '<Root>'
  44846. }
  44847. var options = typeof vm === 'function' && vm.cid != null
  44848. ? vm.options
  44849. : vm._isVue
  44850. ? vm.$options || vm.constructor.options
  44851. : vm;
  44852. var name = options.name || options._componentTag;
  44853. var file = options.__file;
  44854. if (!name && file) {
  44855. var match = file.match(/([^/\\]+)\.vue$/);
  44856. name = match && match[1];
  44857. }
  44858. return (
  44859. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  44860. (file && includeFile !== false ? (" at " + file) : '')
  44861. )
  44862. };
  44863. var repeat = function (str, n) {
  44864. var res = '';
  44865. while (n) {
  44866. if (n % 2 === 1) { res += str; }
  44867. if (n > 1) { str += str; }
  44868. n >>= 1;
  44869. }
  44870. return res
  44871. };
  44872. generateComponentTrace = function (vm) {
  44873. if (vm._isVue && vm.$parent) {
  44874. var tree = [];
  44875. var currentRecursiveSequence = 0;
  44876. while (vm) {
  44877. if (tree.length > 0) {
  44878. var last = tree[tree.length - 1];
  44879. if (last.constructor === vm.constructor) {
  44880. currentRecursiveSequence++;
  44881. vm = vm.$parent;
  44882. continue
  44883. } else if (currentRecursiveSequence > 0) {
  44884. tree[tree.length - 1] = [last, currentRecursiveSequence];
  44885. currentRecursiveSequence = 0;
  44886. }
  44887. }
  44888. tree.push(vm);
  44889. vm = vm.$parent;
  44890. }
  44891. return '\n\nfound in\n\n' + tree
  44892. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  44893. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  44894. : formatComponentName(vm))); })
  44895. .join('\n')
  44896. } else {
  44897. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  44898. }
  44899. };
  44900. }
  44901. /* */
  44902. var uid = 0;
  44903. /**
  44904. * A dep is an observable that can have multiple
  44905. * directives subscribing to it.
  44906. */
  44907. var Dep = function Dep () {
  44908. this.id = uid++;
  44909. this.subs = [];
  44910. };
  44911. Dep.prototype.addSub = function addSub (sub) {
  44912. this.subs.push(sub);
  44913. };
  44914. Dep.prototype.removeSub = function removeSub (sub) {
  44915. remove(this.subs, sub);
  44916. };
  44917. Dep.prototype.depend = function depend () {
  44918. if (Dep.target) {
  44919. Dep.target.addDep(this);
  44920. }
  44921. };
  44922. Dep.prototype.notify = function notify () {
  44923. // stabilize the subscriber list first
  44924. var subs = this.subs.slice();
  44925. if (!config.async) {
  44926. // subs aren't sorted in scheduler if not running async
  44927. // we need to sort them now to make sure they fire in correct
  44928. // order
  44929. subs.sort(function (a, b) { return a.id - b.id; });
  44930. }
  44931. for (var i = 0, l = subs.length; i < l; i++) {
  44932. subs[i].update();
  44933. }
  44934. };
  44935. // The current target watcher being evaluated.
  44936. // This is globally unique because only one watcher
  44937. // can be evaluated at a time.
  44938. Dep.target = null;
  44939. var targetStack = [];
  44940. function pushTarget (target) {
  44941. targetStack.push(target);
  44942. Dep.target = target;
  44943. }
  44944. function popTarget () {
  44945. targetStack.pop();
  44946. Dep.target = targetStack[targetStack.length - 1];
  44947. }
  44948. /* */
  44949. var VNode = function VNode (
  44950. tag,
  44951. data,
  44952. children,
  44953. text,
  44954. elm,
  44955. context,
  44956. componentOptions,
  44957. asyncFactory
  44958. ) {
  44959. this.tag = tag;
  44960. this.data = data;
  44961. this.children = children;
  44962. this.text = text;
  44963. this.elm = elm;
  44964. this.ns = undefined;
  44965. this.context = context;
  44966. this.fnContext = undefined;
  44967. this.fnOptions = undefined;
  44968. this.fnScopeId = undefined;
  44969. this.key = data && data.key;
  44970. this.componentOptions = componentOptions;
  44971. this.componentInstance = undefined;
  44972. this.parent = undefined;
  44973. this.raw = false;
  44974. this.isStatic = false;
  44975. this.isRootInsert = true;
  44976. this.isComment = false;
  44977. this.isCloned = false;
  44978. this.isOnce = false;
  44979. this.asyncFactory = asyncFactory;
  44980. this.asyncMeta = undefined;
  44981. this.isAsyncPlaceholder = false;
  44982. };
  44983. var prototypeAccessors = { child: { configurable: true } };
  44984. // DEPRECATED: alias for componentInstance for backwards compat.
  44985. /* istanbul ignore next */
  44986. prototypeAccessors.child.get = function () {
  44987. return this.componentInstance
  44988. };
  44989. Object.defineProperties( VNode.prototype, prototypeAccessors );
  44990. var createEmptyVNode = function (text) {
  44991. if ( text === void 0 ) text = '';
  44992. var node = new VNode();
  44993. node.text = text;
  44994. node.isComment = true;
  44995. return node
  44996. };
  44997. function createTextVNode (val) {
  44998. return new VNode(undefined, undefined, undefined, String(val))
  44999. }
  45000. // optimized shallow clone
  45001. // used for static nodes and slot nodes because they may be reused across
  45002. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45003. // on their elm reference.
  45004. function cloneVNode (vnode) {
  45005. var cloned = new VNode(
  45006. vnode.tag,
  45007. vnode.data,
  45008. // #7975
  45009. // clone children array to avoid mutating original in case of cloning
  45010. // a child.
  45011. vnode.children && vnode.children.slice(),
  45012. vnode.text,
  45013. vnode.elm,
  45014. vnode.context,
  45015. vnode.componentOptions,
  45016. vnode.asyncFactory
  45017. );
  45018. cloned.ns = vnode.ns;
  45019. cloned.isStatic = vnode.isStatic;
  45020. cloned.key = vnode.key;
  45021. cloned.isComment = vnode.isComment;
  45022. cloned.fnContext = vnode.fnContext;
  45023. cloned.fnOptions = vnode.fnOptions;
  45024. cloned.fnScopeId = vnode.fnScopeId;
  45025. cloned.asyncMeta = vnode.asyncMeta;
  45026. cloned.isCloned = true;
  45027. return cloned
  45028. }
  45029. /*
  45030. * not type checking this file because flow doesn't play well with
  45031. * dynamically accessing methods on Array prototype
  45032. */
  45033. var arrayProto = Array.prototype;
  45034. var arrayMethods = Object.create(arrayProto);
  45035. var methodsToPatch = [
  45036. 'push',
  45037. 'pop',
  45038. 'shift',
  45039. 'unshift',
  45040. 'splice',
  45041. 'sort',
  45042. 'reverse'
  45043. ];
  45044. /**
  45045. * Intercept mutating methods and emit events
  45046. */
  45047. methodsToPatch.forEach(function (method) {
  45048. // cache original method
  45049. var original = arrayProto[method];
  45050. def(arrayMethods, method, function mutator () {
  45051. var args = [], len = arguments.length;
  45052. while ( len-- ) args[ len ] = arguments[ len ];
  45053. var result = original.apply(this, args);
  45054. var ob = this.__ob__;
  45055. var inserted;
  45056. switch (method) {
  45057. case 'push':
  45058. case 'unshift':
  45059. inserted = args;
  45060. break
  45061. case 'splice':
  45062. inserted = args.slice(2);
  45063. break
  45064. }
  45065. if (inserted) { ob.observeArray(inserted); }
  45066. // notify change
  45067. ob.dep.notify();
  45068. return result
  45069. });
  45070. });
  45071. /* */
  45072. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45073. /**
  45074. * In some cases we may want to disable observation inside a component's
  45075. * update computation.
  45076. */
  45077. var shouldObserve = true;
  45078. function toggleObserving (value) {
  45079. shouldObserve = value;
  45080. }
  45081. /**
  45082. * Observer class that is attached to each observed
  45083. * object. Once attached, the observer converts the target
  45084. * object's property keys into getter/setters that
  45085. * collect dependencies and dispatch updates.
  45086. */
  45087. var Observer = function Observer (value) {
  45088. this.value = value;
  45089. this.dep = new Dep();
  45090. this.vmCount = 0;
  45091. def(value, '__ob__', this);
  45092. if (Array.isArray(value)) {
  45093. if (hasProto) {
  45094. protoAugment(value, arrayMethods);
  45095. } else {
  45096. copyAugment(value, arrayMethods, arrayKeys);
  45097. }
  45098. this.observeArray(value);
  45099. } else {
  45100. this.walk(value);
  45101. }
  45102. };
  45103. /**
  45104. * Walk through all properties and convert them into
  45105. * getter/setters. This method should only be called when
  45106. * value type is Object.
  45107. */
  45108. Observer.prototype.walk = function walk (obj) {
  45109. var keys = Object.keys(obj);
  45110. for (var i = 0; i < keys.length; i++) {
  45111. defineReactive$$1(obj, keys[i]);
  45112. }
  45113. };
  45114. /**
  45115. * Observe a list of Array items.
  45116. */
  45117. Observer.prototype.observeArray = function observeArray (items) {
  45118. for (var i = 0, l = items.length; i < l; i++) {
  45119. observe(items[i]);
  45120. }
  45121. };
  45122. // helpers
  45123. /**
  45124. * Augment a target Object or Array by intercepting
  45125. * the prototype chain using __proto__
  45126. */
  45127. function protoAugment (target, src) {
  45128. /* eslint-disable no-proto */
  45129. target.__proto__ = src;
  45130. /* eslint-enable no-proto */
  45131. }
  45132. /**
  45133. * Augment a target Object or Array by defining
  45134. * hidden properties.
  45135. */
  45136. /* istanbul ignore next */
  45137. function copyAugment (target, src, keys) {
  45138. for (var i = 0, l = keys.length; i < l; i++) {
  45139. var key = keys[i];
  45140. def(target, key, src[key]);
  45141. }
  45142. }
  45143. /**
  45144. * Attempt to create an observer instance for a value,
  45145. * returns the new observer if successfully observed,
  45146. * or the existing observer if the value already has one.
  45147. */
  45148. function observe (value, asRootData) {
  45149. if (!isObject(value) || value instanceof VNode) {
  45150. return
  45151. }
  45152. var ob;
  45153. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45154. ob = value.__ob__;
  45155. } else if (
  45156. shouldObserve &&
  45157. !isServerRendering() &&
  45158. (Array.isArray(value) || isPlainObject(value)) &&
  45159. Object.isExtensible(value) &&
  45160. !value._isVue
  45161. ) {
  45162. ob = new Observer(value);
  45163. }
  45164. if (asRootData && ob) {
  45165. ob.vmCount++;
  45166. }
  45167. return ob
  45168. }
  45169. /**
  45170. * Define a reactive property on an Object.
  45171. */
  45172. function defineReactive$$1 (
  45173. obj,
  45174. key,
  45175. val,
  45176. customSetter,
  45177. shallow
  45178. ) {
  45179. var dep = new Dep();
  45180. var property = Object.getOwnPropertyDescriptor(obj, key);
  45181. if (property && property.configurable === false) {
  45182. return
  45183. }
  45184. // cater for pre-defined getter/setters
  45185. var getter = property && property.get;
  45186. var setter = property && property.set;
  45187. if ((!getter || setter) && arguments.length === 2) {
  45188. val = obj[key];
  45189. }
  45190. var childOb = !shallow && observe(val);
  45191. Object.defineProperty(obj, key, {
  45192. enumerable: true,
  45193. configurable: true,
  45194. get: function reactiveGetter () {
  45195. var value = getter ? getter.call(obj) : val;
  45196. if (Dep.target) {
  45197. dep.depend();
  45198. if (childOb) {
  45199. childOb.dep.depend();
  45200. if (Array.isArray(value)) {
  45201. dependArray(value);
  45202. }
  45203. }
  45204. }
  45205. return value
  45206. },
  45207. set: function reactiveSetter (newVal) {
  45208. var value = getter ? getter.call(obj) : val;
  45209. /* eslint-disable no-self-compare */
  45210. if (newVal === value || (newVal !== newVal && value !== value)) {
  45211. return
  45212. }
  45213. /* eslint-enable no-self-compare */
  45214. if (customSetter) {
  45215. customSetter();
  45216. }
  45217. // #7981: for accessor properties without setter
  45218. if (getter && !setter) { return }
  45219. if (setter) {
  45220. setter.call(obj, newVal);
  45221. } else {
  45222. val = newVal;
  45223. }
  45224. childOb = !shallow && observe(newVal);
  45225. dep.notify();
  45226. }
  45227. });
  45228. }
  45229. /**
  45230. * Set a property on an object. Adds the new property and
  45231. * triggers change notification if the property doesn't
  45232. * already exist.
  45233. */
  45234. function set (target, key, val) {
  45235. if (isUndef(target) || isPrimitive(target)
  45236. ) {
  45237. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45238. }
  45239. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45240. target.length = Math.max(target.length, key);
  45241. target.splice(key, 1, val);
  45242. return val
  45243. }
  45244. if (key in target && !(key in Object.prototype)) {
  45245. target[key] = val;
  45246. return val
  45247. }
  45248. var ob = (target).__ob__;
  45249. if (target._isVue || (ob && ob.vmCount)) {
  45250. warn(
  45251. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45252. 'at runtime - declare it upfront in the data option.'
  45253. );
  45254. return val
  45255. }
  45256. if (!ob) {
  45257. target[key] = val;
  45258. return val
  45259. }
  45260. defineReactive$$1(ob.value, key, val);
  45261. ob.dep.notify();
  45262. return val
  45263. }
  45264. /**
  45265. * Delete a property and trigger change if necessary.
  45266. */
  45267. function del (target, key) {
  45268. if (isUndef(target) || isPrimitive(target)
  45269. ) {
  45270. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45271. }
  45272. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45273. target.splice(key, 1);
  45274. return
  45275. }
  45276. var ob = (target).__ob__;
  45277. if (target._isVue || (ob && ob.vmCount)) {
  45278. warn(
  45279. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45280. '- just set it to null.'
  45281. );
  45282. return
  45283. }
  45284. if (!hasOwn(target, key)) {
  45285. return
  45286. }
  45287. delete target[key];
  45288. if (!ob) {
  45289. return
  45290. }
  45291. ob.dep.notify();
  45292. }
  45293. /**
  45294. * Collect dependencies on array elements when the array is touched, since
  45295. * we cannot intercept array element access like property getters.
  45296. */
  45297. function dependArray (value) {
  45298. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45299. e = value[i];
  45300. e && e.__ob__ && e.__ob__.dep.depend();
  45301. if (Array.isArray(e)) {
  45302. dependArray(e);
  45303. }
  45304. }
  45305. }
  45306. /* */
  45307. /**
  45308. * Option overwriting strategies are functions that handle
  45309. * how to merge a parent option value and a child option
  45310. * value into the final value.
  45311. */
  45312. var strats = config.optionMergeStrategies;
  45313. /**
  45314. * Options with restrictions
  45315. */
  45316. {
  45317. strats.el = strats.propsData = function (parent, child, vm, key) {
  45318. if (!vm) {
  45319. warn(
  45320. "option \"" + key + "\" can only be used during instance " +
  45321. 'creation with the `new` keyword.'
  45322. );
  45323. }
  45324. return defaultStrat(parent, child)
  45325. };
  45326. }
  45327. /**
  45328. * Helper that recursively merges two data objects together.
  45329. */
  45330. function mergeData (to, from) {
  45331. if (!from) { return to }
  45332. var key, toVal, fromVal;
  45333. var keys = hasSymbol
  45334. ? Reflect.ownKeys(from)
  45335. : Object.keys(from);
  45336. for (var i = 0; i < keys.length; i++) {
  45337. key = keys[i];
  45338. // in case the object is already observed...
  45339. if (key === '__ob__') { continue }
  45340. toVal = to[key];
  45341. fromVal = from[key];
  45342. if (!hasOwn(to, key)) {
  45343. set(to, key, fromVal);
  45344. } else if (
  45345. toVal !== fromVal &&
  45346. isPlainObject(toVal) &&
  45347. isPlainObject(fromVal)
  45348. ) {
  45349. mergeData(toVal, fromVal);
  45350. }
  45351. }
  45352. return to
  45353. }
  45354. /**
  45355. * Data
  45356. */
  45357. function mergeDataOrFn (
  45358. parentVal,
  45359. childVal,
  45360. vm
  45361. ) {
  45362. if (!vm) {
  45363. // in a Vue.extend merge, both should be functions
  45364. if (!childVal) {
  45365. return parentVal
  45366. }
  45367. if (!parentVal) {
  45368. return childVal
  45369. }
  45370. // when parentVal & childVal are both present,
  45371. // we need to return a function that returns the
  45372. // merged result of both functions... no need to
  45373. // check if parentVal is a function here because
  45374. // it has to be a function to pass previous merges.
  45375. return function mergedDataFn () {
  45376. return mergeData(
  45377. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45378. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45379. )
  45380. }
  45381. } else {
  45382. return function mergedInstanceDataFn () {
  45383. // instance merge
  45384. var instanceData = typeof childVal === 'function'
  45385. ? childVal.call(vm, vm)
  45386. : childVal;
  45387. var defaultData = typeof parentVal === 'function'
  45388. ? parentVal.call(vm, vm)
  45389. : parentVal;
  45390. if (instanceData) {
  45391. return mergeData(instanceData, defaultData)
  45392. } else {
  45393. return defaultData
  45394. }
  45395. }
  45396. }
  45397. }
  45398. strats.data = function (
  45399. parentVal,
  45400. childVal,
  45401. vm
  45402. ) {
  45403. if (!vm) {
  45404. if (childVal && typeof childVal !== 'function') {
  45405. warn(
  45406. 'The "data" option should be a function ' +
  45407. 'that returns a per-instance value in component ' +
  45408. 'definitions.',
  45409. vm
  45410. );
  45411. return parentVal
  45412. }
  45413. return mergeDataOrFn(parentVal, childVal)
  45414. }
  45415. return mergeDataOrFn(parentVal, childVal, vm)
  45416. };
  45417. /**
  45418. * Hooks and props are merged as arrays.
  45419. */
  45420. function mergeHook (
  45421. parentVal,
  45422. childVal
  45423. ) {
  45424. var res = childVal
  45425. ? parentVal
  45426. ? parentVal.concat(childVal)
  45427. : Array.isArray(childVal)
  45428. ? childVal
  45429. : [childVal]
  45430. : parentVal;
  45431. return res
  45432. ? dedupeHooks(res)
  45433. : res
  45434. }
  45435. function dedupeHooks (hooks) {
  45436. var res = [];
  45437. for (var i = 0; i < hooks.length; i++) {
  45438. if (res.indexOf(hooks[i]) === -1) {
  45439. res.push(hooks[i]);
  45440. }
  45441. }
  45442. return res
  45443. }
  45444. LIFECYCLE_HOOKS.forEach(function (hook) {
  45445. strats[hook] = mergeHook;
  45446. });
  45447. /**
  45448. * Assets
  45449. *
  45450. * When a vm is present (instance creation), we need to do
  45451. * a three-way merge between constructor options, instance
  45452. * options and parent options.
  45453. */
  45454. function mergeAssets (
  45455. parentVal,
  45456. childVal,
  45457. vm,
  45458. key
  45459. ) {
  45460. var res = Object.create(parentVal || null);
  45461. if (childVal) {
  45462. assertObjectType(key, childVal, vm);
  45463. return extend(res, childVal)
  45464. } else {
  45465. return res
  45466. }
  45467. }
  45468. ASSET_TYPES.forEach(function (type) {
  45469. strats[type + 's'] = mergeAssets;
  45470. });
  45471. /**
  45472. * Watchers.
  45473. *
  45474. * Watchers hashes should not overwrite one
  45475. * another, so we merge them as arrays.
  45476. */
  45477. strats.watch = function (
  45478. parentVal,
  45479. childVal,
  45480. vm,
  45481. key
  45482. ) {
  45483. // work around Firefox's Object.prototype.watch...
  45484. if (parentVal === nativeWatch) { parentVal = undefined; }
  45485. if (childVal === nativeWatch) { childVal = undefined; }
  45486. /* istanbul ignore if */
  45487. if (!childVal) { return Object.create(parentVal || null) }
  45488. {
  45489. assertObjectType(key, childVal, vm);
  45490. }
  45491. if (!parentVal) { return childVal }
  45492. var ret = {};
  45493. extend(ret, parentVal);
  45494. for (var key$1 in childVal) {
  45495. var parent = ret[key$1];
  45496. var child = childVal[key$1];
  45497. if (parent && !Array.isArray(parent)) {
  45498. parent = [parent];
  45499. }
  45500. ret[key$1] = parent
  45501. ? parent.concat(child)
  45502. : Array.isArray(child) ? child : [child];
  45503. }
  45504. return ret
  45505. };
  45506. /**
  45507. * Other object hashes.
  45508. */
  45509. strats.props =
  45510. strats.methods =
  45511. strats.inject =
  45512. strats.computed = function (
  45513. parentVal,
  45514. childVal,
  45515. vm,
  45516. key
  45517. ) {
  45518. if (childVal && "development" !== 'production') {
  45519. assertObjectType(key, childVal, vm);
  45520. }
  45521. if (!parentVal) { return childVal }
  45522. var ret = Object.create(null);
  45523. extend(ret, parentVal);
  45524. if (childVal) { extend(ret, childVal); }
  45525. return ret
  45526. };
  45527. strats.provide = mergeDataOrFn;
  45528. /**
  45529. * Default strategy.
  45530. */
  45531. var defaultStrat = function (parentVal, childVal) {
  45532. return childVal === undefined
  45533. ? parentVal
  45534. : childVal
  45535. };
  45536. /**
  45537. * Validate component names
  45538. */
  45539. function checkComponents (options) {
  45540. for (var key in options.components) {
  45541. validateComponentName(key);
  45542. }
  45543. }
  45544. function validateComponentName (name) {
  45545. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45546. warn(
  45547. 'Invalid component name: "' + name + '". Component names ' +
  45548. 'should conform to valid custom element name in html5 specification.'
  45549. );
  45550. }
  45551. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45552. warn(
  45553. 'Do not use built-in or reserved HTML elements as component ' +
  45554. 'id: ' + name
  45555. );
  45556. }
  45557. }
  45558. /**
  45559. * Ensure all props option syntax are normalized into the
  45560. * Object-based format.
  45561. */
  45562. function normalizeProps (options, vm) {
  45563. var props = options.props;
  45564. if (!props) { return }
  45565. var res = {};
  45566. var i, val, name;
  45567. if (Array.isArray(props)) {
  45568. i = props.length;
  45569. while (i--) {
  45570. val = props[i];
  45571. if (typeof val === 'string') {
  45572. name = camelize(val);
  45573. res[name] = { type: null };
  45574. } else {
  45575. warn('props must be strings when using array syntax.');
  45576. }
  45577. }
  45578. } else if (isPlainObject(props)) {
  45579. for (var key in props) {
  45580. val = props[key];
  45581. name = camelize(key);
  45582. res[name] = isPlainObject(val)
  45583. ? val
  45584. : { type: val };
  45585. }
  45586. } else {
  45587. warn(
  45588. "Invalid value for option \"props\": expected an Array or an Object, " +
  45589. "but got " + (toRawType(props)) + ".",
  45590. vm
  45591. );
  45592. }
  45593. options.props = res;
  45594. }
  45595. /**
  45596. * Normalize all injections into Object-based format
  45597. */
  45598. function normalizeInject (options, vm) {
  45599. var inject = options.inject;
  45600. if (!inject) { return }
  45601. var normalized = options.inject = {};
  45602. if (Array.isArray(inject)) {
  45603. for (var i = 0; i < inject.length; i++) {
  45604. normalized[inject[i]] = { from: inject[i] };
  45605. }
  45606. } else if (isPlainObject(inject)) {
  45607. for (var key in inject) {
  45608. var val = inject[key];
  45609. normalized[key] = isPlainObject(val)
  45610. ? extend({ from: key }, val)
  45611. : { from: val };
  45612. }
  45613. } else {
  45614. warn(
  45615. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45616. "but got " + (toRawType(inject)) + ".",
  45617. vm
  45618. );
  45619. }
  45620. }
  45621. /**
  45622. * Normalize raw function directives into object format.
  45623. */
  45624. function normalizeDirectives (options) {
  45625. var dirs = options.directives;
  45626. if (dirs) {
  45627. for (var key in dirs) {
  45628. var def$$1 = dirs[key];
  45629. if (typeof def$$1 === 'function') {
  45630. dirs[key] = { bind: def$$1, update: def$$1 };
  45631. }
  45632. }
  45633. }
  45634. }
  45635. function assertObjectType (name, value, vm) {
  45636. if (!isPlainObject(value)) {
  45637. warn(
  45638. "Invalid value for option \"" + name + "\": expected an Object, " +
  45639. "but got " + (toRawType(value)) + ".",
  45640. vm
  45641. );
  45642. }
  45643. }
  45644. /**
  45645. * Merge two option objects into a new one.
  45646. * Core utility used in both instantiation and inheritance.
  45647. */
  45648. function mergeOptions (
  45649. parent,
  45650. child,
  45651. vm
  45652. ) {
  45653. {
  45654. checkComponents(child);
  45655. }
  45656. if (typeof child === 'function') {
  45657. child = child.options;
  45658. }
  45659. normalizeProps(child, vm);
  45660. normalizeInject(child, vm);
  45661. normalizeDirectives(child);
  45662. // Apply extends and mixins on the child options,
  45663. // but only if it is a raw options object that isn't
  45664. // the result of another mergeOptions call.
  45665. // Only merged options has the _base property.
  45666. if (!child._base) {
  45667. if (child.extends) {
  45668. parent = mergeOptions(parent, child.extends, vm);
  45669. }
  45670. if (child.mixins) {
  45671. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45672. parent = mergeOptions(parent, child.mixins[i], vm);
  45673. }
  45674. }
  45675. }
  45676. var options = {};
  45677. var key;
  45678. for (key in parent) {
  45679. mergeField(key);
  45680. }
  45681. for (key in child) {
  45682. if (!hasOwn(parent, key)) {
  45683. mergeField(key);
  45684. }
  45685. }
  45686. function mergeField (key) {
  45687. var strat = strats[key] || defaultStrat;
  45688. options[key] = strat(parent[key], child[key], vm, key);
  45689. }
  45690. return options
  45691. }
  45692. /**
  45693. * Resolve an asset.
  45694. * This function is used because child instances need access
  45695. * to assets defined in its ancestor chain.
  45696. */
  45697. function resolveAsset (
  45698. options,
  45699. type,
  45700. id,
  45701. warnMissing
  45702. ) {
  45703. /* istanbul ignore if */
  45704. if (typeof id !== 'string') {
  45705. return
  45706. }
  45707. var assets = options[type];
  45708. // check local registration variations first
  45709. if (hasOwn(assets, id)) { return assets[id] }
  45710. var camelizedId = camelize(id);
  45711. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45712. var PascalCaseId = capitalize(camelizedId);
  45713. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45714. // fallback to prototype chain
  45715. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45716. if (warnMissing && !res) {
  45717. warn(
  45718. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45719. options
  45720. );
  45721. }
  45722. return res
  45723. }
  45724. /* */
  45725. function validateProp (
  45726. key,
  45727. propOptions,
  45728. propsData,
  45729. vm
  45730. ) {
  45731. var prop = propOptions[key];
  45732. var absent = !hasOwn(propsData, key);
  45733. var value = propsData[key];
  45734. // boolean casting
  45735. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45736. if (booleanIndex > -1) {
  45737. if (absent && !hasOwn(prop, 'default')) {
  45738. value = false;
  45739. } else if (value === '' || value === hyphenate(key)) {
  45740. // only cast empty string / same name to boolean if
  45741. // boolean has higher priority
  45742. var stringIndex = getTypeIndex(String, prop.type);
  45743. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45744. value = true;
  45745. }
  45746. }
  45747. }
  45748. // check default value
  45749. if (value === undefined) {
  45750. value = getPropDefaultValue(vm, prop, key);
  45751. // since the default value is a fresh copy,
  45752. // make sure to observe it.
  45753. var prevShouldObserve = shouldObserve;
  45754. toggleObserving(true);
  45755. observe(value);
  45756. toggleObserving(prevShouldObserve);
  45757. }
  45758. {
  45759. assertProp(prop, key, value, vm, absent);
  45760. }
  45761. return value
  45762. }
  45763. /**
  45764. * Get the default value of a prop.
  45765. */
  45766. function getPropDefaultValue (vm, prop, key) {
  45767. // no default, return undefined
  45768. if (!hasOwn(prop, 'default')) {
  45769. return undefined
  45770. }
  45771. var def = prop.default;
  45772. // warn against non-factory defaults for Object & Array
  45773. if (isObject(def)) {
  45774. warn(
  45775. 'Invalid default value for prop "' + key + '": ' +
  45776. 'Props with type Object/Array must use a factory function ' +
  45777. 'to return the default value.',
  45778. vm
  45779. );
  45780. }
  45781. // the raw prop value was also undefined from previous render,
  45782. // return previous default value to avoid unnecessary watcher trigger
  45783. if (vm && vm.$options.propsData &&
  45784. vm.$options.propsData[key] === undefined &&
  45785. vm._props[key] !== undefined
  45786. ) {
  45787. return vm._props[key]
  45788. }
  45789. // call factory function for non-Function types
  45790. // a value is Function if its prototype is function even across different execution context
  45791. return typeof def === 'function' && getType(prop.type) !== 'Function'
  45792. ? def.call(vm)
  45793. : def
  45794. }
  45795. /**
  45796. * Assert whether a prop is valid.
  45797. */
  45798. function assertProp (
  45799. prop,
  45800. name,
  45801. value,
  45802. vm,
  45803. absent
  45804. ) {
  45805. if (prop.required && absent) {
  45806. warn(
  45807. 'Missing required prop: "' + name + '"',
  45808. vm
  45809. );
  45810. return
  45811. }
  45812. if (value == null && !prop.required) {
  45813. return
  45814. }
  45815. var type = prop.type;
  45816. var valid = !type || type === true;
  45817. var expectedTypes = [];
  45818. if (type) {
  45819. if (!Array.isArray(type)) {
  45820. type = [type];
  45821. }
  45822. for (var i = 0; i < type.length && !valid; i++) {
  45823. var assertedType = assertType(value, type[i]);
  45824. expectedTypes.push(assertedType.expectedType || '');
  45825. valid = assertedType.valid;
  45826. }
  45827. }
  45828. if (!valid) {
  45829. warn(
  45830. getInvalidTypeMessage(name, value, expectedTypes),
  45831. vm
  45832. );
  45833. return
  45834. }
  45835. var validator = prop.validator;
  45836. if (validator) {
  45837. if (!validator(value)) {
  45838. warn(
  45839. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  45840. vm
  45841. );
  45842. }
  45843. }
  45844. }
  45845. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  45846. function assertType (value, type) {
  45847. var valid;
  45848. var expectedType = getType(type);
  45849. if (simpleCheckRE.test(expectedType)) {
  45850. var t = typeof value;
  45851. valid = t === expectedType.toLowerCase();
  45852. // for primitive wrapper objects
  45853. if (!valid && t === 'object') {
  45854. valid = value instanceof type;
  45855. }
  45856. } else if (expectedType === 'Object') {
  45857. valid = isPlainObject(value);
  45858. } else if (expectedType === 'Array') {
  45859. valid = Array.isArray(value);
  45860. } else {
  45861. valid = value instanceof type;
  45862. }
  45863. return {
  45864. valid: valid,
  45865. expectedType: expectedType
  45866. }
  45867. }
  45868. /**
  45869. * Use function string name to check built-in types,
  45870. * because a simple equality check will fail when running
  45871. * across different vms / iframes.
  45872. */
  45873. function getType (fn) {
  45874. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  45875. return match ? match[1] : ''
  45876. }
  45877. function isSameType (a, b) {
  45878. return getType(a) === getType(b)
  45879. }
  45880. function getTypeIndex (type, expectedTypes) {
  45881. if (!Array.isArray(expectedTypes)) {
  45882. return isSameType(expectedTypes, type) ? 0 : -1
  45883. }
  45884. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  45885. if (isSameType(expectedTypes[i], type)) {
  45886. return i
  45887. }
  45888. }
  45889. return -1
  45890. }
  45891. function getInvalidTypeMessage (name, value, expectedTypes) {
  45892. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  45893. " Expected " + (expectedTypes.map(capitalize).join(', '));
  45894. var expectedType = expectedTypes[0];
  45895. var receivedType = toRawType(value);
  45896. var expectedValue = styleValue(value, expectedType);
  45897. var receivedValue = styleValue(value, receivedType);
  45898. // check if we need to specify expected value
  45899. if (expectedTypes.length === 1 &&
  45900. isExplicable(expectedType) &&
  45901. !isBoolean(expectedType, receivedType)) {
  45902. message += " with value " + expectedValue;
  45903. }
  45904. message += ", got " + receivedType + " ";
  45905. // check if we need to specify received value
  45906. if (isExplicable(receivedType)) {
  45907. message += "with value " + receivedValue + ".";
  45908. }
  45909. return message
  45910. }
  45911. function styleValue (value, type) {
  45912. if (type === 'String') {
  45913. return ("\"" + value + "\"")
  45914. } else if (type === 'Number') {
  45915. return ("" + (Number(value)))
  45916. } else {
  45917. return ("" + value)
  45918. }
  45919. }
  45920. function isExplicable (value) {
  45921. var explicitTypes = ['string', 'number', 'boolean'];
  45922. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  45923. }
  45924. function isBoolean () {
  45925. var args = [], len = arguments.length;
  45926. while ( len-- ) args[ len ] = arguments[ len ];
  45927. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  45928. }
  45929. /* */
  45930. function handleError (err, vm, info) {
  45931. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  45932. // See: https://github.com/vuejs/vuex/issues/1505
  45933. pushTarget();
  45934. try {
  45935. if (vm) {
  45936. var cur = vm;
  45937. while ((cur = cur.$parent)) {
  45938. var hooks = cur.$options.errorCaptured;
  45939. if (hooks) {
  45940. for (var i = 0; i < hooks.length; i++) {
  45941. try {
  45942. var capture = hooks[i].call(cur, err, vm, info) === false;
  45943. if (capture) { return }
  45944. } catch (e) {
  45945. globalHandleError(e, cur, 'errorCaptured hook');
  45946. }
  45947. }
  45948. }
  45949. }
  45950. }
  45951. globalHandleError(err, vm, info);
  45952. } finally {
  45953. popTarget();
  45954. }
  45955. }
  45956. function invokeWithErrorHandling (
  45957. handler,
  45958. context,
  45959. args,
  45960. vm,
  45961. info
  45962. ) {
  45963. var res;
  45964. try {
  45965. res = args ? handler.apply(context, args) : handler.call(context);
  45966. if (res && !res._isVue && isPromise(res) && !res._handled) {
  45967. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  45968. // issue #9511
  45969. // avoid catch triggering multiple times when nested calls
  45970. res._handled = true;
  45971. }
  45972. } catch (e) {
  45973. handleError(e, vm, info);
  45974. }
  45975. return res
  45976. }
  45977. function globalHandleError (err, vm, info) {
  45978. if (config.errorHandler) {
  45979. try {
  45980. return config.errorHandler.call(null, err, vm, info)
  45981. } catch (e) {
  45982. // if the user intentionally throws the original error in the handler,
  45983. // do not log it twice
  45984. if (e !== err) {
  45985. logError(e, null, 'config.errorHandler');
  45986. }
  45987. }
  45988. }
  45989. logError(err, vm, info);
  45990. }
  45991. function logError (err, vm, info) {
  45992. {
  45993. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  45994. }
  45995. /* istanbul ignore else */
  45996. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  45997. console.error(err);
  45998. } else {
  45999. throw err
  46000. }
  46001. }
  46002. /* */
  46003. var isUsingMicroTask = false;
  46004. var callbacks = [];
  46005. var pending = false;
  46006. function flushCallbacks () {
  46007. pending = false;
  46008. var copies = callbacks.slice(0);
  46009. callbacks.length = 0;
  46010. for (var i = 0; i < copies.length; i++) {
  46011. copies[i]();
  46012. }
  46013. }
  46014. // Here we have async deferring wrappers using microtasks.
  46015. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46016. // However, it has subtle problems when state is changed right before repaint
  46017. // (e.g. #6813, out-in transitions).
  46018. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46019. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46020. // So we now use microtasks everywhere, again.
  46021. // A major drawback of this tradeoff is that there are some scenarios
  46022. // where microtasks have too high a priority and fire in between supposedly
  46023. // sequential events (e.g. #4521, #6690, which have workarounds)
  46024. // or even between bubbling of the same event (#6566).
  46025. var timerFunc;
  46026. // The nextTick behavior leverages the microtask queue, which can be accessed
  46027. // via either native Promise.then or MutationObserver.
  46028. // MutationObserver has wider support, however it is seriously bugged in
  46029. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46030. // completely stops working after triggering a few times... so, if native
  46031. // Promise is available, we will use it:
  46032. /* istanbul ignore next, $flow-disable-line */
  46033. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46034. var p = Promise.resolve();
  46035. timerFunc = function () {
  46036. p.then(flushCallbacks);
  46037. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46038. // it can get stuck in a weird state where callbacks are pushed into the
  46039. // microtask queue but the queue isn't being flushed, until the browser
  46040. // needs to do some other work, e.g. handle a timer. Therefore we can
  46041. // "force" the microtask queue to be flushed by adding an empty timer.
  46042. if (isIOS) { setTimeout(noop); }
  46043. };
  46044. isUsingMicroTask = true;
  46045. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46046. isNative(MutationObserver) ||
  46047. // PhantomJS and iOS 7.x
  46048. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46049. )) {
  46050. // Use MutationObserver where native Promise is not available,
  46051. // e.g. PhantomJS, iOS7, Android 4.4
  46052. // (#6466 MutationObserver is unreliable in IE11)
  46053. var counter = 1;
  46054. var observer = new MutationObserver(flushCallbacks);
  46055. var textNode = document.createTextNode(String(counter));
  46056. observer.observe(textNode, {
  46057. characterData: true
  46058. });
  46059. timerFunc = function () {
  46060. counter = (counter + 1) % 2;
  46061. textNode.data = String(counter);
  46062. };
  46063. isUsingMicroTask = true;
  46064. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46065. // Fallback to setImmediate.
  46066. // Technically it leverages the (macro) task queue,
  46067. // but it is still a better choice than setTimeout.
  46068. timerFunc = function () {
  46069. setImmediate(flushCallbacks);
  46070. };
  46071. } else {
  46072. // Fallback to setTimeout.
  46073. timerFunc = function () {
  46074. setTimeout(flushCallbacks, 0);
  46075. };
  46076. }
  46077. function nextTick (cb, ctx) {
  46078. var _resolve;
  46079. callbacks.push(function () {
  46080. if (cb) {
  46081. try {
  46082. cb.call(ctx);
  46083. } catch (e) {
  46084. handleError(e, ctx, 'nextTick');
  46085. }
  46086. } else if (_resolve) {
  46087. _resolve(ctx);
  46088. }
  46089. });
  46090. if (!pending) {
  46091. pending = true;
  46092. timerFunc();
  46093. }
  46094. // $flow-disable-line
  46095. if (!cb && typeof Promise !== 'undefined') {
  46096. return new Promise(function (resolve) {
  46097. _resolve = resolve;
  46098. })
  46099. }
  46100. }
  46101. /* */
  46102. var mark;
  46103. var measure;
  46104. {
  46105. var perf = inBrowser && window.performance;
  46106. /* istanbul ignore if */
  46107. if (
  46108. perf &&
  46109. perf.mark &&
  46110. perf.measure &&
  46111. perf.clearMarks &&
  46112. perf.clearMeasures
  46113. ) {
  46114. mark = function (tag) { return perf.mark(tag); };
  46115. measure = function (name, startTag, endTag) {
  46116. perf.measure(name, startTag, endTag);
  46117. perf.clearMarks(startTag);
  46118. perf.clearMarks(endTag);
  46119. // perf.clearMeasures(name)
  46120. };
  46121. }
  46122. }
  46123. /* not type checking this file because flow doesn't play well with Proxy */
  46124. var initProxy;
  46125. {
  46126. var allowedGlobals = makeMap(
  46127. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46128. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46129. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46130. 'require' // for Webpack/Browserify
  46131. );
  46132. var warnNonPresent = function (target, key) {
  46133. warn(
  46134. "Property or method \"" + key + "\" is not defined on the instance but " +
  46135. 'referenced during render. Make sure that this property is reactive, ' +
  46136. 'either in the data option, or for class-based components, by ' +
  46137. 'initializing the property. ' +
  46138. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46139. target
  46140. );
  46141. };
  46142. var warnReservedPrefix = function (target, key) {
  46143. warn(
  46144. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46145. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46146. 'prevent conflicts with Vue internals. ' +
  46147. 'See: https://vuejs.org/v2/api/#data',
  46148. target
  46149. );
  46150. };
  46151. var hasProxy =
  46152. typeof Proxy !== 'undefined' && isNative(Proxy);
  46153. if (hasProxy) {
  46154. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46155. config.keyCodes = new Proxy(config.keyCodes, {
  46156. set: function set (target, key, value) {
  46157. if (isBuiltInModifier(key)) {
  46158. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46159. return false
  46160. } else {
  46161. target[key] = value;
  46162. return true
  46163. }
  46164. }
  46165. });
  46166. }
  46167. var hasHandler = {
  46168. has: function has (target, key) {
  46169. var has = key in target;
  46170. var isAllowed = allowedGlobals(key) ||
  46171. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46172. if (!has && !isAllowed) {
  46173. if (key in target.$data) { warnReservedPrefix(target, key); }
  46174. else { warnNonPresent(target, key); }
  46175. }
  46176. return has || !isAllowed
  46177. }
  46178. };
  46179. var getHandler = {
  46180. get: function get (target, key) {
  46181. if (typeof key === 'string' && !(key in target)) {
  46182. if (key in target.$data) { warnReservedPrefix(target, key); }
  46183. else { warnNonPresent(target, key); }
  46184. }
  46185. return target[key]
  46186. }
  46187. };
  46188. initProxy = function initProxy (vm) {
  46189. if (hasProxy) {
  46190. // determine which proxy handler to use
  46191. var options = vm.$options;
  46192. var handlers = options.render && options.render._withStripped
  46193. ? getHandler
  46194. : hasHandler;
  46195. vm._renderProxy = new Proxy(vm, handlers);
  46196. } else {
  46197. vm._renderProxy = vm;
  46198. }
  46199. };
  46200. }
  46201. /* */
  46202. var seenObjects = new _Set();
  46203. /**
  46204. * Recursively traverse an object to evoke all converted
  46205. * getters, so that every nested property inside the object
  46206. * is collected as a "deep" dependency.
  46207. */
  46208. function traverse (val) {
  46209. _traverse(val, seenObjects);
  46210. seenObjects.clear();
  46211. }
  46212. function _traverse (val, seen) {
  46213. var i, keys;
  46214. var isA = Array.isArray(val);
  46215. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46216. return
  46217. }
  46218. if (val.__ob__) {
  46219. var depId = val.__ob__.dep.id;
  46220. if (seen.has(depId)) {
  46221. return
  46222. }
  46223. seen.add(depId);
  46224. }
  46225. if (isA) {
  46226. i = val.length;
  46227. while (i--) { _traverse(val[i], seen); }
  46228. } else {
  46229. keys = Object.keys(val);
  46230. i = keys.length;
  46231. while (i--) { _traverse(val[keys[i]], seen); }
  46232. }
  46233. }
  46234. /* */
  46235. var normalizeEvent = cached(function (name) {
  46236. var passive = name.charAt(0) === '&';
  46237. name = passive ? name.slice(1) : name;
  46238. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46239. name = once$$1 ? name.slice(1) : name;
  46240. var capture = name.charAt(0) === '!';
  46241. name = capture ? name.slice(1) : name;
  46242. return {
  46243. name: name,
  46244. once: once$$1,
  46245. capture: capture,
  46246. passive: passive
  46247. }
  46248. });
  46249. function createFnInvoker (fns, vm) {
  46250. function invoker () {
  46251. var arguments$1 = arguments;
  46252. var fns = invoker.fns;
  46253. if (Array.isArray(fns)) {
  46254. var cloned = fns.slice();
  46255. for (var i = 0; i < cloned.length; i++) {
  46256. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46257. }
  46258. } else {
  46259. // return handler return value for single handlers
  46260. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46261. }
  46262. }
  46263. invoker.fns = fns;
  46264. return invoker
  46265. }
  46266. function updateListeners (
  46267. on,
  46268. oldOn,
  46269. add,
  46270. remove$$1,
  46271. createOnceHandler,
  46272. vm
  46273. ) {
  46274. var name, def$$1, cur, old, event;
  46275. for (name in on) {
  46276. def$$1 = cur = on[name];
  46277. old = oldOn[name];
  46278. event = normalizeEvent(name);
  46279. if (isUndef(cur)) {
  46280. warn(
  46281. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46282. vm
  46283. );
  46284. } else if (isUndef(old)) {
  46285. if (isUndef(cur.fns)) {
  46286. cur = on[name] = createFnInvoker(cur, vm);
  46287. }
  46288. if (isTrue(event.once)) {
  46289. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46290. }
  46291. add(event.name, cur, event.capture, event.passive, event.params);
  46292. } else if (cur !== old) {
  46293. old.fns = cur;
  46294. on[name] = old;
  46295. }
  46296. }
  46297. for (name in oldOn) {
  46298. if (isUndef(on[name])) {
  46299. event = normalizeEvent(name);
  46300. remove$$1(event.name, oldOn[name], event.capture);
  46301. }
  46302. }
  46303. }
  46304. /* */
  46305. function mergeVNodeHook (def, hookKey, hook) {
  46306. if (def instanceof VNode) {
  46307. def = def.data.hook || (def.data.hook = {});
  46308. }
  46309. var invoker;
  46310. var oldHook = def[hookKey];
  46311. function wrappedHook () {
  46312. hook.apply(this, arguments);
  46313. // important: remove merged hook to ensure it's called only once
  46314. // and prevent memory leak
  46315. remove(invoker.fns, wrappedHook);
  46316. }
  46317. if (isUndef(oldHook)) {
  46318. // no existing hook
  46319. invoker = createFnInvoker([wrappedHook]);
  46320. } else {
  46321. /* istanbul ignore if */
  46322. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46323. // already a merged invoker
  46324. invoker = oldHook;
  46325. invoker.fns.push(wrappedHook);
  46326. } else {
  46327. // existing plain hook
  46328. invoker = createFnInvoker([oldHook, wrappedHook]);
  46329. }
  46330. }
  46331. invoker.merged = true;
  46332. def[hookKey] = invoker;
  46333. }
  46334. /* */
  46335. function extractPropsFromVNodeData (
  46336. data,
  46337. Ctor,
  46338. tag
  46339. ) {
  46340. // we are only extracting raw values here.
  46341. // validation and default values are handled in the child
  46342. // component itself.
  46343. var propOptions = Ctor.options.props;
  46344. if (isUndef(propOptions)) {
  46345. return
  46346. }
  46347. var res = {};
  46348. var attrs = data.attrs;
  46349. var props = data.props;
  46350. if (isDef(attrs) || isDef(props)) {
  46351. for (var key in propOptions) {
  46352. var altKey = hyphenate(key);
  46353. {
  46354. var keyInLowerCase = key.toLowerCase();
  46355. if (
  46356. key !== keyInLowerCase &&
  46357. attrs && hasOwn(attrs, keyInLowerCase)
  46358. ) {
  46359. tip(
  46360. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46361. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46362. " \"" + key + "\". " +
  46363. "Note that HTML attributes are case-insensitive and camelCased " +
  46364. "props need to use their kebab-case equivalents when using in-DOM " +
  46365. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46366. );
  46367. }
  46368. }
  46369. checkProp(res, props, key, altKey, true) ||
  46370. checkProp(res, attrs, key, altKey, false);
  46371. }
  46372. }
  46373. return res
  46374. }
  46375. function checkProp (
  46376. res,
  46377. hash,
  46378. key,
  46379. altKey,
  46380. preserve
  46381. ) {
  46382. if (isDef(hash)) {
  46383. if (hasOwn(hash, key)) {
  46384. res[key] = hash[key];
  46385. if (!preserve) {
  46386. delete hash[key];
  46387. }
  46388. return true
  46389. } else if (hasOwn(hash, altKey)) {
  46390. res[key] = hash[altKey];
  46391. if (!preserve) {
  46392. delete hash[altKey];
  46393. }
  46394. return true
  46395. }
  46396. }
  46397. return false
  46398. }
  46399. /* */
  46400. // The template compiler attempts to minimize the need for normalization by
  46401. // statically analyzing the template at compile time.
  46402. //
  46403. // For plain HTML markup, normalization can be completely skipped because the
  46404. // generated render function is guaranteed to return Array<VNode>. There are
  46405. // two cases where extra normalization is needed:
  46406. // 1. When the children contains components - because a functional component
  46407. // may return an Array instead of a single root. In this case, just a simple
  46408. // normalization is needed - if any child is an Array, we flatten the whole
  46409. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46410. // because functional components already normalize their own children.
  46411. function simpleNormalizeChildren (children) {
  46412. for (var i = 0; i < children.length; i++) {
  46413. if (Array.isArray(children[i])) {
  46414. return Array.prototype.concat.apply([], children)
  46415. }
  46416. }
  46417. return children
  46418. }
  46419. // 2. When the children contains constructs that always generated nested Arrays,
  46420. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46421. // with hand-written render functions / JSX. In such cases a full normalization
  46422. // is needed to cater to all possible types of children values.
  46423. function normalizeChildren (children) {
  46424. return isPrimitive(children)
  46425. ? [createTextVNode(children)]
  46426. : Array.isArray(children)
  46427. ? normalizeArrayChildren(children)
  46428. : undefined
  46429. }
  46430. function isTextNode (node) {
  46431. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46432. }
  46433. function normalizeArrayChildren (children, nestedIndex) {
  46434. var res = [];
  46435. var i, c, lastIndex, last;
  46436. for (i = 0; i < children.length; i++) {
  46437. c = children[i];
  46438. if (isUndef(c) || typeof c === 'boolean') { continue }
  46439. lastIndex = res.length - 1;
  46440. last = res[lastIndex];
  46441. // nested
  46442. if (Array.isArray(c)) {
  46443. if (c.length > 0) {
  46444. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46445. // merge adjacent text nodes
  46446. if (isTextNode(c[0]) && isTextNode(last)) {
  46447. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46448. c.shift();
  46449. }
  46450. res.push.apply(res, c);
  46451. }
  46452. } else if (isPrimitive(c)) {
  46453. if (isTextNode(last)) {
  46454. // merge adjacent text nodes
  46455. // this is necessary for SSR hydration because text nodes are
  46456. // essentially merged when rendered to HTML strings
  46457. res[lastIndex] = createTextVNode(last.text + c);
  46458. } else if (c !== '') {
  46459. // convert primitive to vnode
  46460. res.push(createTextVNode(c));
  46461. }
  46462. } else {
  46463. if (isTextNode(c) && isTextNode(last)) {
  46464. // merge adjacent text nodes
  46465. res[lastIndex] = createTextVNode(last.text + c.text);
  46466. } else {
  46467. // default key for nested array children (likely generated by v-for)
  46468. if (isTrue(children._isVList) &&
  46469. isDef(c.tag) &&
  46470. isUndef(c.key) &&
  46471. isDef(nestedIndex)) {
  46472. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46473. }
  46474. res.push(c);
  46475. }
  46476. }
  46477. }
  46478. return res
  46479. }
  46480. /* */
  46481. function initProvide (vm) {
  46482. var provide = vm.$options.provide;
  46483. if (provide) {
  46484. vm._provided = typeof provide === 'function'
  46485. ? provide.call(vm)
  46486. : provide;
  46487. }
  46488. }
  46489. function initInjections (vm) {
  46490. var result = resolveInject(vm.$options.inject, vm);
  46491. if (result) {
  46492. toggleObserving(false);
  46493. Object.keys(result).forEach(function (key) {
  46494. /* istanbul ignore else */
  46495. {
  46496. defineReactive$$1(vm, key, result[key], function () {
  46497. warn(
  46498. "Avoid mutating an injected value directly since the changes will be " +
  46499. "overwritten whenever the provided component re-renders. " +
  46500. "injection being mutated: \"" + key + "\"",
  46501. vm
  46502. );
  46503. });
  46504. }
  46505. });
  46506. toggleObserving(true);
  46507. }
  46508. }
  46509. function resolveInject (inject, vm) {
  46510. if (inject) {
  46511. // inject is :any because flow is not smart enough to figure out cached
  46512. var result = Object.create(null);
  46513. var keys = hasSymbol
  46514. ? Reflect.ownKeys(inject)
  46515. : Object.keys(inject);
  46516. for (var i = 0; i < keys.length; i++) {
  46517. var key = keys[i];
  46518. // #6574 in case the inject object is observed...
  46519. if (key === '__ob__') { continue }
  46520. var provideKey = inject[key].from;
  46521. var source = vm;
  46522. while (source) {
  46523. if (source._provided && hasOwn(source._provided, provideKey)) {
  46524. result[key] = source._provided[provideKey];
  46525. break
  46526. }
  46527. source = source.$parent;
  46528. }
  46529. if (!source) {
  46530. if ('default' in inject[key]) {
  46531. var provideDefault = inject[key].default;
  46532. result[key] = typeof provideDefault === 'function'
  46533. ? provideDefault.call(vm)
  46534. : provideDefault;
  46535. } else {
  46536. warn(("Injection \"" + key + "\" not found"), vm);
  46537. }
  46538. }
  46539. }
  46540. return result
  46541. }
  46542. }
  46543. /* */
  46544. /**
  46545. * Runtime helper for resolving raw children VNodes into a slot object.
  46546. */
  46547. function resolveSlots (
  46548. children,
  46549. context
  46550. ) {
  46551. if (!children || !children.length) {
  46552. return {}
  46553. }
  46554. var slots = {};
  46555. for (var i = 0, l = children.length; i < l; i++) {
  46556. var child = children[i];
  46557. var data = child.data;
  46558. // remove slot attribute if the node is resolved as a Vue slot node
  46559. if (data && data.attrs && data.attrs.slot) {
  46560. delete data.attrs.slot;
  46561. }
  46562. // named slots should only be respected if the vnode was rendered in the
  46563. // same context.
  46564. if ((child.context === context || child.fnContext === context) &&
  46565. data && data.slot != null
  46566. ) {
  46567. var name = data.slot;
  46568. var slot = (slots[name] || (slots[name] = []));
  46569. if (child.tag === 'template') {
  46570. slot.push.apply(slot, child.children || []);
  46571. } else {
  46572. slot.push(child);
  46573. }
  46574. } else {
  46575. (slots.default || (slots.default = [])).push(child);
  46576. }
  46577. }
  46578. // ignore slots that contains only whitespace
  46579. for (var name$1 in slots) {
  46580. if (slots[name$1].every(isWhitespace)) {
  46581. delete slots[name$1];
  46582. }
  46583. }
  46584. return slots
  46585. }
  46586. function isWhitespace (node) {
  46587. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46588. }
  46589. /* */
  46590. function normalizeScopedSlots (
  46591. slots,
  46592. normalSlots,
  46593. prevSlots
  46594. ) {
  46595. var res;
  46596. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46597. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46598. var key = slots && slots.$key;
  46599. if (!slots) {
  46600. res = {};
  46601. } else if (slots._normalized) {
  46602. // fast path 1: child component re-render only, parent did not change
  46603. return slots._normalized
  46604. } else if (
  46605. isStable &&
  46606. prevSlots &&
  46607. prevSlots !== emptyObject &&
  46608. key === prevSlots.$key &&
  46609. !hasNormalSlots &&
  46610. !prevSlots.$hasNormal
  46611. ) {
  46612. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46613. // only need to normalize once
  46614. return prevSlots
  46615. } else {
  46616. res = {};
  46617. for (var key$1 in slots) {
  46618. if (slots[key$1] && key$1[0] !== '$') {
  46619. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46620. }
  46621. }
  46622. }
  46623. // expose normal slots on scopedSlots
  46624. for (var key$2 in normalSlots) {
  46625. if (!(key$2 in res)) {
  46626. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46627. }
  46628. }
  46629. // avoriaz seems to mock a non-extensible $scopedSlots object
  46630. // and when that is passed down this would cause an error
  46631. if (slots && Object.isExtensible(slots)) {
  46632. (slots)._normalized = res;
  46633. }
  46634. def(res, '$stable', isStable);
  46635. def(res, '$key', key);
  46636. def(res, '$hasNormal', hasNormalSlots);
  46637. return res
  46638. }
  46639. function normalizeScopedSlot(normalSlots, key, fn) {
  46640. var normalized = function () {
  46641. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46642. res = res && typeof res === 'object' && !Array.isArray(res)
  46643. ? [res] // single vnode
  46644. : normalizeChildren(res);
  46645. return res && (
  46646. res.length === 0 ||
  46647. (res.length === 1 && res[0].isComment) // #9658
  46648. ) ? undefined
  46649. : res
  46650. };
  46651. // this is a slot using the new v-slot syntax without scope. although it is
  46652. // compiled as a scoped slot, render fn users would expect it to be present
  46653. // on this.$slots because the usage is semantically a normal slot.
  46654. if (fn.proxy) {
  46655. Object.defineProperty(normalSlots, key, {
  46656. get: normalized,
  46657. enumerable: true,
  46658. configurable: true
  46659. });
  46660. }
  46661. return normalized
  46662. }
  46663. function proxyNormalSlot(slots, key) {
  46664. return function () { return slots[key]; }
  46665. }
  46666. /* */
  46667. /**
  46668. * Runtime helper for rendering v-for lists.
  46669. */
  46670. function renderList (
  46671. val,
  46672. render
  46673. ) {
  46674. var ret, i, l, keys, key;
  46675. if (Array.isArray(val) || typeof val === 'string') {
  46676. ret = new Array(val.length);
  46677. for (i = 0, l = val.length; i < l; i++) {
  46678. ret[i] = render(val[i], i);
  46679. }
  46680. } else if (typeof val === 'number') {
  46681. ret = new Array(val);
  46682. for (i = 0; i < val; i++) {
  46683. ret[i] = render(i + 1, i);
  46684. }
  46685. } else if (isObject(val)) {
  46686. if (hasSymbol && val[Symbol.iterator]) {
  46687. ret = [];
  46688. var iterator = val[Symbol.iterator]();
  46689. var result = iterator.next();
  46690. while (!result.done) {
  46691. ret.push(render(result.value, ret.length));
  46692. result = iterator.next();
  46693. }
  46694. } else {
  46695. keys = Object.keys(val);
  46696. ret = new Array(keys.length);
  46697. for (i = 0, l = keys.length; i < l; i++) {
  46698. key = keys[i];
  46699. ret[i] = render(val[key], key, i);
  46700. }
  46701. }
  46702. }
  46703. if (!isDef(ret)) {
  46704. ret = [];
  46705. }
  46706. (ret)._isVList = true;
  46707. return ret
  46708. }
  46709. /* */
  46710. /**
  46711. * Runtime helper for rendering <slot>
  46712. */
  46713. function renderSlot (
  46714. name,
  46715. fallback,
  46716. props,
  46717. bindObject
  46718. ) {
  46719. var scopedSlotFn = this.$scopedSlots[name];
  46720. var nodes;
  46721. if (scopedSlotFn) { // scoped slot
  46722. props = props || {};
  46723. if (bindObject) {
  46724. if (!isObject(bindObject)) {
  46725. warn(
  46726. 'slot v-bind without argument expects an Object',
  46727. this
  46728. );
  46729. }
  46730. props = extend(extend({}, bindObject), props);
  46731. }
  46732. nodes = scopedSlotFn(props) || fallback;
  46733. } else {
  46734. nodes = this.$slots[name] || fallback;
  46735. }
  46736. var target = props && props.slot;
  46737. if (target) {
  46738. return this.$createElement('template', { slot: target }, nodes)
  46739. } else {
  46740. return nodes
  46741. }
  46742. }
  46743. /* */
  46744. /**
  46745. * Runtime helper for resolving filters
  46746. */
  46747. function resolveFilter (id) {
  46748. return resolveAsset(this.$options, 'filters', id, true) || identity
  46749. }
  46750. /* */
  46751. function isKeyNotMatch (expect, actual) {
  46752. if (Array.isArray(expect)) {
  46753. return expect.indexOf(actual) === -1
  46754. } else {
  46755. return expect !== actual
  46756. }
  46757. }
  46758. /**
  46759. * Runtime helper for checking keyCodes from config.
  46760. * exposed as Vue.prototype._k
  46761. * passing in eventKeyName as last argument separately for backwards compat
  46762. */
  46763. function checkKeyCodes (
  46764. eventKeyCode,
  46765. key,
  46766. builtInKeyCode,
  46767. eventKeyName,
  46768. builtInKeyName
  46769. ) {
  46770. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  46771. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  46772. return isKeyNotMatch(builtInKeyName, eventKeyName)
  46773. } else if (mappedKeyCode) {
  46774. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  46775. } else if (eventKeyName) {
  46776. return hyphenate(eventKeyName) !== key
  46777. }
  46778. }
  46779. /* */
  46780. /**
  46781. * Runtime helper for merging v-bind="object" into a VNode's data.
  46782. */
  46783. function bindObjectProps (
  46784. data,
  46785. tag,
  46786. value,
  46787. asProp,
  46788. isSync
  46789. ) {
  46790. if (value) {
  46791. if (!isObject(value)) {
  46792. warn(
  46793. 'v-bind without argument expects an Object or Array value',
  46794. this
  46795. );
  46796. } else {
  46797. if (Array.isArray(value)) {
  46798. value = toObject(value);
  46799. }
  46800. var hash;
  46801. var loop = function ( key ) {
  46802. if (
  46803. key === 'class' ||
  46804. key === 'style' ||
  46805. isReservedAttribute(key)
  46806. ) {
  46807. hash = data;
  46808. } else {
  46809. var type = data.attrs && data.attrs.type;
  46810. hash = asProp || config.mustUseProp(tag, type, key)
  46811. ? data.domProps || (data.domProps = {})
  46812. : data.attrs || (data.attrs = {});
  46813. }
  46814. var camelizedKey = camelize(key);
  46815. var hyphenatedKey = hyphenate(key);
  46816. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  46817. hash[key] = value[key];
  46818. if (isSync) {
  46819. var on = data.on || (data.on = {});
  46820. on[("update:" + key)] = function ($event) {
  46821. value[key] = $event;
  46822. };
  46823. }
  46824. }
  46825. };
  46826. for (var key in value) loop( key );
  46827. }
  46828. }
  46829. return data
  46830. }
  46831. /* */
  46832. /**
  46833. * Runtime helper for rendering static trees.
  46834. */
  46835. function renderStatic (
  46836. index,
  46837. isInFor
  46838. ) {
  46839. var cached = this._staticTrees || (this._staticTrees = []);
  46840. var tree = cached[index];
  46841. // if has already-rendered static tree and not inside v-for,
  46842. // we can reuse the same tree.
  46843. if (tree && !isInFor) {
  46844. return tree
  46845. }
  46846. // otherwise, render a fresh tree.
  46847. tree = cached[index] = this.$options.staticRenderFns[index].call(
  46848. this._renderProxy,
  46849. null,
  46850. this // for render fns generated for functional component templates
  46851. );
  46852. markStatic(tree, ("__static__" + index), false);
  46853. return tree
  46854. }
  46855. /**
  46856. * Runtime helper for v-once.
  46857. * Effectively it means marking the node as static with a unique key.
  46858. */
  46859. function markOnce (
  46860. tree,
  46861. index,
  46862. key
  46863. ) {
  46864. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  46865. return tree
  46866. }
  46867. function markStatic (
  46868. tree,
  46869. key,
  46870. isOnce
  46871. ) {
  46872. if (Array.isArray(tree)) {
  46873. for (var i = 0; i < tree.length; i++) {
  46874. if (tree[i] && typeof tree[i] !== 'string') {
  46875. markStaticNode(tree[i], (key + "_" + i), isOnce);
  46876. }
  46877. }
  46878. } else {
  46879. markStaticNode(tree, key, isOnce);
  46880. }
  46881. }
  46882. function markStaticNode (node, key, isOnce) {
  46883. node.isStatic = true;
  46884. node.key = key;
  46885. node.isOnce = isOnce;
  46886. }
  46887. /* */
  46888. function bindObjectListeners (data, value) {
  46889. if (value) {
  46890. if (!isPlainObject(value)) {
  46891. warn(
  46892. 'v-on without argument expects an Object value',
  46893. this
  46894. );
  46895. } else {
  46896. var on = data.on = data.on ? extend({}, data.on) : {};
  46897. for (var key in value) {
  46898. var existing = on[key];
  46899. var ours = value[key];
  46900. on[key] = existing ? [].concat(existing, ours) : ours;
  46901. }
  46902. }
  46903. }
  46904. return data
  46905. }
  46906. /* */
  46907. function resolveScopedSlots (
  46908. fns, // see flow/vnode
  46909. res,
  46910. // the following are added in 2.6
  46911. hasDynamicKeys,
  46912. contentHashKey
  46913. ) {
  46914. res = res || { $stable: !hasDynamicKeys };
  46915. for (var i = 0; i < fns.length; i++) {
  46916. var slot = fns[i];
  46917. if (Array.isArray(slot)) {
  46918. resolveScopedSlots(slot, res, hasDynamicKeys);
  46919. } else if (slot) {
  46920. // marker for reverse proxying v-slot without scope on this.$slots
  46921. if (slot.proxy) {
  46922. slot.fn.proxy = true;
  46923. }
  46924. res[slot.key] = slot.fn;
  46925. }
  46926. }
  46927. if (contentHashKey) {
  46928. (res).$key = contentHashKey;
  46929. }
  46930. return res
  46931. }
  46932. /* */
  46933. function bindDynamicKeys (baseObj, values) {
  46934. for (var i = 0; i < values.length; i += 2) {
  46935. var key = values[i];
  46936. if (typeof key === 'string' && key) {
  46937. baseObj[values[i]] = values[i + 1];
  46938. } else if (key !== '' && key !== null) {
  46939. // null is a special value for explicitly removing a binding
  46940. warn(
  46941. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  46942. this
  46943. );
  46944. }
  46945. }
  46946. return baseObj
  46947. }
  46948. // helper to dynamically append modifier runtime markers to event names.
  46949. // ensure only append when value is already string, otherwise it will be cast
  46950. // to string and cause the type check to miss.
  46951. function prependModifier (value, symbol) {
  46952. return typeof value === 'string' ? symbol + value : value
  46953. }
  46954. /* */
  46955. function installRenderHelpers (target) {
  46956. target._o = markOnce;
  46957. target._n = toNumber;
  46958. target._s = toString;
  46959. target._l = renderList;
  46960. target._t = renderSlot;
  46961. target._q = looseEqual;
  46962. target._i = looseIndexOf;
  46963. target._m = renderStatic;
  46964. target._f = resolveFilter;
  46965. target._k = checkKeyCodes;
  46966. target._b = bindObjectProps;
  46967. target._v = createTextVNode;
  46968. target._e = createEmptyVNode;
  46969. target._u = resolveScopedSlots;
  46970. target._g = bindObjectListeners;
  46971. target._d = bindDynamicKeys;
  46972. target._p = prependModifier;
  46973. }
  46974. /* */
  46975. function FunctionalRenderContext (
  46976. data,
  46977. props,
  46978. children,
  46979. parent,
  46980. Ctor
  46981. ) {
  46982. var this$1 = this;
  46983. var options = Ctor.options;
  46984. // ensure the createElement function in functional components
  46985. // gets a unique context - this is necessary for correct named slot check
  46986. var contextVm;
  46987. if (hasOwn(parent, '_uid')) {
  46988. contextVm = Object.create(parent);
  46989. // $flow-disable-line
  46990. contextVm._original = parent;
  46991. } else {
  46992. // the context vm passed in is a functional context as well.
  46993. // in this case we want to make sure we are able to get a hold to the
  46994. // real context instance.
  46995. contextVm = parent;
  46996. // $flow-disable-line
  46997. parent = parent._original;
  46998. }
  46999. var isCompiled = isTrue(options._compiled);
  47000. var needNormalization = !isCompiled;
  47001. this.data = data;
  47002. this.props = props;
  47003. this.children = children;
  47004. this.parent = parent;
  47005. this.listeners = data.on || emptyObject;
  47006. this.injections = resolveInject(options.inject, parent);
  47007. this.slots = function () {
  47008. if (!this$1.$slots) {
  47009. normalizeScopedSlots(
  47010. data.scopedSlots,
  47011. this$1.$slots = resolveSlots(children, parent)
  47012. );
  47013. }
  47014. return this$1.$slots
  47015. };
  47016. Object.defineProperty(this, 'scopedSlots', ({
  47017. enumerable: true,
  47018. get: function get () {
  47019. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47020. }
  47021. }));
  47022. // support for compiled functional template
  47023. if (isCompiled) {
  47024. // exposing $options for renderStatic()
  47025. this.$options = options;
  47026. // pre-resolve slots for renderSlot()
  47027. this.$slots = this.slots();
  47028. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47029. }
  47030. if (options._scopeId) {
  47031. this._c = function (a, b, c, d) {
  47032. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47033. if (vnode && !Array.isArray(vnode)) {
  47034. vnode.fnScopeId = options._scopeId;
  47035. vnode.fnContext = parent;
  47036. }
  47037. return vnode
  47038. };
  47039. } else {
  47040. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47041. }
  47042. }
  47043. installRenderHelpers(FunctionalRenderContext.prototype);
  47044. function createFunctionalComponent (
  47045. Ctor,
  47046. propsData,
  47047. data,
  47048. contextVm,
  47049. children
  47050. ) {
  47051. var options = Ctor.options;
  47052. var props = {};
  47053. var propOptions = options.props;
  47054. if (isDef(propOptions)) {
  47055. for (var key in propOptions) {
  47056. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47057. }
  47058. } else {
  47059. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47060. if (isDef(data.props)) { mergeProps(props, data.props); }
  47061. }
  47062. var renderContext = new FunctionalRenderContext(
  47063. data,
  47064. props,
  47065. children,
  47066. contextVm,
  47067. Ctor
  47068. );
  47069. var vnode = options.render.call(null, renderContext._c, renderContext);
  47070. if (vnode instanceof VNode) {
  47071. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47072. } else if (Array.isArray(vnode)) {
  47073. var vnodes = normalizeChildren(vnode) || [];
  47074. var res = new Array(vnodes.length);
  47075. for (var i = 0; i < vnodes.length; i++) {
  47076. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47077. }
  47078. return res
  47079. }
  47080. }
  47081. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47082. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47083. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47084. // that should not be matched to match.
  47085. var clone = cloneVNode(vnode);
  47086. clone.fnContext = contextVm;
  47087. clone.fnOptions = options;
  47088. {
  47089. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47090. }
  47091. if (data.slot) {
  47092. (clone.data || (clone.data = {})).slot = data.slot;
  47093. }
  47094. return clone
  47095. }
  47096. function mergeProps (to, from) {
  47097. for (var key in from) {
  47098. to[camelize(key)] = from[key];
  47099. }
  47100. }
  47101. /* */
  47102. /* */
  47103. /* */
  47104. /* */
  47105. // inline hooks to be invoked on component VNodes during patch
  47106. var componentVNodeHooks = {
  47107. init: function init (vnode, hydrating) {
  47108. if (
  47109. vnode.componentInstance &&
  47110. !vnode.componentInstance._isDestroyed &&
  47111. vnode.data.keepAlive
  47112. ) {
  47113. // kept-alive components, treat as a patch
  47114. var mountedNode = vnode; // work around flow
  47115. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47116. } else {
  47117. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47118. vnode,
  47119. activeInstance
  47120. );
  47121. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47122. }
  47123. },
  47124. prepatch: function prepatch (oldVnode, vnode) {
  47125. var options = vnode.componentOptions;
  47126. var child = vnode.componentInstance = oldVnode.componentInstance;
  47127. updateChildComponent(
  47128. child,
  47129. options.propsData, // updated props
  47130. options.listeners, // updated listeners
  47131. vnode, // new parent vnode
  47132. options.children // new children
  47133. );
  47134. },
  47135. insert: function insert (vnode) {
  47136. var context = vnode.context;
  47137. var componentInstance = vnode.componentInstance;
  47138. if (!componentInstance._isMounted) {
  47139. componentInstance._isMounted = true;
  47140. callHook(componentInstance, 'mounted');
  47141. }
  47142. if (vnode.data.keepAlive) {
  47143. if (context._isMounted) {
  47144. // vue-router#1212
  47145. // During updates, a kept-alive component's child components may
  47146. // change, so directly walking the tree here may call activated hooks
  47147. // on incorrect children. Instead we push them into a queue which will
  47148. // be processed after the whole patch process ended.
  47149. queueActivatedComponent(componentInstance);
  47150. } else {
  47151. activateChildComponent(componentInstance, true /* direct */);
  47152. }
  47153. }
  47154. },
  47155. destroy: function destroy (vnode) {
  47156. var componentInstance = vnode.componentInstance;
  47157. if (!componentInstance._isDestroyed) {
  47158. if (!vnode.data.keepAlive) {
  47159. componentInstance.$destroy();
  47160. } else {
  47161. deactivateChildComponent(componentInstance, true /* direct */);
  47162. }
  47163. }
  47164. }
  47165. };
  47166. var hooksToMerge = Object.keys(componentVNodeHooks);
  47167. function createComponent (
  47168. Ctor,
  47169. data,
  47170. context,
  47171. children,
  47172. tag
  47173. ) {
  47174. if (isUndef(Ctor)) {
  47175. return
  47176. }
  47177. var baseCtor = context.$options._base;
  47178. // plain options object: turn it into a constructor
  47179. if (isObject(Ctor)) {
  47180. Ctor = baseCtor.extend(Ctor);
  47181. }
  47182. // if at this stage it's not a constructor or an async component factory,
  47183. // reject.
  47184. if (typeof Ctor !== 'function') {
  47185. {
  47186. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47187. }
  47188. return
  47189. }
  47190. // async component
  47191. var asyncFactory;
  47192. if (isUndef(Ctor.cid)) {
  47193. asyncFactory = Ctor;
  47194. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47195. if (Ctor === undefined) {
  47196. // return a placeholder node for async component, which is rendered
  47197. // as a comment node but preserves all the raw information for the node.
  47198. // the information will be used for async server-rendering and hydration.
  47199. return createAsyncPlaceholder(
  47200. asyncFactory,
  47201. data,
  47202. context,
  47203. children,
  47204. tag
  47205. )
  47206. }
  47207. }
  47208. data = data || {};
  47209. // resolve constructor options in case global mixins are applied after
  47210. // component constructor creation
  47211. resolveConstructorOptions(Ctor);
  47212. // transform component v-model data into props & events
  47213. if (isDef(data.model)) {
  47214. transformModel(Ctor.options, data);
  47215. }
  47216. // extract props
  47217. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47218. // functional component
  47219. if (isTrue(Ctor.options.functional)) {
  47220. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47221. }
  47222. // extract listeners, since these needs to be treated as
  47223. // child component listeners instead of DOM listeners
  47224. var listeners = data.on;
  47225. // replace with listeners with .native modifier
  47226. // so it gets processed during parent component patch.
  47227. data.on = data.nativeOn;
  47228. if (isTrue(Ctor.options.abstract)) {
  47229. // abstract components do not keep anything
  47230. // other than props & listeners & slot
  47231. // work around flow
  47232. var slot = data.slot;
  47233. data = {};
  47234. if (slot) {
  47235. data.slot = slot;
  47236. }
  47237. }
  47238. // install component management hooks onto the placeholder node
  47239. installComponentHooks(data);
  47240. // return a placeholder vnode
  47241. var name = Ctor.options.name || tag;
  47242. var vnode = new VNode(
  47243. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47244. data, undefined, undefined, undefined, context,
  47245. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47246. asyncFactory
  47247. );
  47248. return vnode
  47249. }
  47250. function createComponentInstanceForVnode (
  47251. vnode, // we know it's MountedComponentVNode but flow doesn't
  47252. parent // activeInstance in lifecycle state
  47253. ) {
  47254. var options = {
  47255. _isComponent: true,
  47256. _parentVnode: vnode,
  47257. parent: parent
  47258. };
  47259. // check inline-template render functions
  47260. var inlineTemplate = vnode.data.inlineTemplate;
  47261. if (isDef(inlineTemplate)) {
  47262. options.render = inlineTemplate.render;
  47263. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47264. }
  47265. return new vnode.componentOptions.Ctor(options)
  47266. }
  47267. function installComponentHooks (data) {
  47268. var hooks = data.hook || (data.hook = {});
  47269. for (var i = 0; i < hooksToMerge.length; i++) {
  47270. var key = hooksToMerge[i];
  47271. var existing = hooks[key];
  47272. var toMerge = componentVNodeHooks[key];
  47273. if (existing !== toMerge && !(existing && existing._merged)) {
  47274. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47275. }
  47276. }
  47277. }
  47278. function mergeHook$1 (f1, f2) {
  47279. var merged = function (a, b) {
  47280. // flow complains about extra args which is why we use any
  47281. f1(a, b);
  47282. f2(a, b);
  47283. };
  47284. merged._merged = true;
  47285. return merged
  47286. }
  47287. // transform component v-model info (value and callback) into
  47288. // prop and event handler respectively.
  47289. function transformModel (options, data) {
  47290. var prop = (options.model && options.model.prop) || 'value';
  47291. var event = (options.model && options.model.event) || 'input'
  47292. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47293. var on = data.on || (data.on = {});
  47294. var existing = on[event];
  47295. var callback = data.model.callback;
  47296. if (isDef(existing)) {
  47297. if (
  47298. Array.isArray(existing)
  47299. ? existing.indexOf(callback) === -1
  47300. : existing !== callback
  47301. ) {
  47302. on[event] = [callback].concat(existing);
  47303. }
  47304. } else {
  47305. on[event] = callback;
  47306. }
  47307. }
  47308. /* */
  47309. var SIMPLE_NORMALIZE = 1;
  47310. var ALWAYS_NORMALIZE = 2;
  47311. // wrapper function for providing a more flexible interface
  47312. // without getting yelled at by flow
  47313. function createElement (
  47314. context,
  47315. tag,
  47316. data,
  47317. children,
  47318. normalizationType,
  47319. alwaysNormalize
  47320. ) {
  47321. if (Array.isArray(data) || isPrimitive(data)) {
  47322. normalizationType = children;
  47323. children = data;
  47324. data = undefined;
  47325. }
  47326. if (isTrue(alwaysNormalize)) {
  47327. normalizationType = ALWAYS_NORMALIZE;
  47328. }
  47329. return _createElement(context, tag, data, children, normalizationType)
  47330. }
  47331. function _createElement (
  47332. context,
  47333. tag,
  47334. data,
  47335. children,
  47336. normalizationType
  47337. ) {
  47338. if (isDef(data) && isDef((data).__ob__)) {
  47339. warn(
  47340. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47341. 'Always create fresh vnode data objects in each render!',
  47342. context
  47343. );
  47344. return createEmptyVNode()
  47345. }
  47346. // object syntax in v-bind
  47347. if (isDef(data) && isDef(data.is)) {
  47348. tag = data.is;
  47349. }
  47350. if (!tag) {
  47351. // in case of component :is set to falsy value
  47352. return createEmptyVNode()
  47353. }
  47354. // warn against non-primitive key
  47355. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47356. ) {
  47357. {
  47358. warn(
  47359. 'Avoid using non-primitive value as key, ' +
  47360. 'use string/number value instead.',
  47361. context
  47362. );
  47363. }
  47364. }
  47365. // support single function children as default scoped slot
  47366. if (Array.isArray(children) &&
  47367. typeof children[0] === 'function'
  47368. ) {
  47369. data = data || {};
  47370. data.scopedSlots = { default: children[0] };
  47371. children.length = 0;
  47372. }
  47373. if (normalizationType === ALWAYS_NORMALIZE) {
  47374. children = normalizeChildren(children);
  47375. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47376. children = simpleNormalizeChildren(children);
  47377. }
  47378. var vnode, ns;
  47379. if (typeof tag === 'string') {
  47380. var Ctor;
  47381. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47382. if (config.isReservedTag(tag)) {
  47383. // platform built-in elements
  47384. if (isDef(data) && isDef(data.nativeOn)) {
  47385. warn(
  47386. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47387. context
  47388. );
  47389. }
  47390. vnode = new VNode(
  47391. config.parsePlatformTagName(tag), data, children,
  47392. undefined, undefined, context
  47393. );
  47394. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47395. // component
  47396. vnode = createComponent(Ctor, data, context, children, tag);
  47397. } else {
  47398. // unknown or unlisted namespaced elements
  47399. // check at runtime because it may get assigned a namespace when its
  47400. // parent normalizes children
  47401. vnode = new VNode(
  47402. tag, data, children,
  47403. undefined, undefined, context
  47404. );
  47405. }
  47406. } else {
  47407. // direct component options / constructor
  47408. vnode = createComponent(tag, data, context, children);
  47409. }
  47410. if (Array.isArray(vnode)) {
  47411. return vnode
  47412. } else if (isDef(vnode)) {
  47413. if (isDef(ns)) { applyNS(vnode, ns); }
  47414. if (isDef(data)) { registerDeepBindings(data); }
  47415. return vnode
  47416. } else {
  47417. return createEmptyVNode()
  47418. }
  47419. }
  47420. function applyNS (vnode, ns, force) {
  47421. vnode.ns = ns;
  47422. if (vnode.tag === 'foreignObject') {
  47423. // use default namespace inside foreignObject
  47424. ns = undefined;
  47425. force = true;
  47426. }
  47427. if (isDef(vnode.children)) {
  47428. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47429. var child = vnode.children[i];
  47430. if (isDef(child.tag) && (
  47431. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47432. applyNS(child, ns, force);
  47433. }
  47434. }
  47435. }
  47436. }
  47437. // ref #5318
  47438. // necessary to ensure parent re-render when deep bindings like :style and
  47439. // :class are used on slot nodes
  47440. function registerDeepBindings (data) {
  47441. if (isObject(data.style)) {
  47442. traverse(data.style);
  47443. }
  47444. if (isObject(data.class)) {
  47445. traverse(data.class);
  47446. }
  47447. }
  47448. /* */
  47449. function initRender (vm) {
  47450. vm._vnode = null; // the root of the child tree
  47451. vm._staticTrees = null; // v-once cached trees
  47452. var options = vm.$options;
  47453. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47454. var renderContext = parentVnode && parentVnode.context;
  47455. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47456. vm.$scopedSlots = emptyObject;
  47457. // bind the createElement fn to this instance
  47458. // so that we get proper render context inside it.
  47459. // args order: tag, data, children, normalizationType, alwaysNormalize
  47460. // internal version is used by render functions compiled from templates
  47461. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47462. // normalization is always applied for the public version, used in
  47463. // user-written render functions.
  47464. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47465. // $attrs & $listeners are exposed for easier HOC creation.
  47466. // they need to be reactive so that HOCs using them are always updated
  47467. var parentData = parentVnode && parentVnode.data;
  47468. /* istanbul ignore else */
  47469. {
  47470. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47471. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47472. }, true);
  47473. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47474. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47475. }, true);
  47476. }
  47477. }
  47478. var currentRenderingInstance = null;
  47479. function renderMixin (Vue) {
  47480. // install runtime convenience helpers
  47481. installRenderHelpers(Vue.prototype);
  47482. Vue.prototype.$nextTick = function (fn) {
  47483. return nextTick(fn, this)
  47484. };
  47485. Vue.prototype._render = function () {
  47486. var vm = this;
  47487. var ref = vm.$options;
  47488. var render = ref.render;
  47489. var _parentVnode = ref._parentVnode;
  47490. if (_parentVnode) {
  47491. vm.$scopedSlots = normalizeScopedSlots(
  47492. _parentVnode.data.scopedSlots,
  47493. vm.$slots,
  47494. vm.$scopedSlots
  47495. );
  47496. }
  47497. // set parent vnode. this allows render functions to have access
  47498. // to the data on the placeholder node.
  47499. vm.$vnode = _parentVnode;
  47500. // render self
  47501. var vnode;
  47502. try {
  47503. // There's no need to maintain a stack because all render fns are called
  47504. // separately from one another. Nested component's render fns are called
  47505. // when parent component is patched.
  47506. currentRenderingInstance = vm;
  47507. vnode = render.call(vm._renderProxy, vm.$createElement);
  47508. } catch (e) {
  47509. handleError(e, vm, "render");
  47510. // return error render result,
  47511. // or previous vnode to prevent render error causing blank component
  47512. /* istanbul ignore else */
  47513. if (vm.$options.renderError) {
  47514. try {
  47515. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47516. } catch (e) {
  47517. handleError(e, vm, "renderError");
  47518. vnode = vm._vnode;
  47519. }
  47520. } else {
  47521. vnode = vm._vnode;
  47522. }
  47523. } finally {
  47524. currentRenderingInstance = null;
  47525. }
  47526. // if the returned array contains only a single node, allow it
  47527. if (Array.isArray(vnode) && vnode.length === 1) {
  47528. vnode = vnode[0];
  47529. }
  47530. // return empty vnode in case the render function errored out
  47531. if (!(vnode instanceof VNode)) {
  47532. if (Array.isArray(vnode)) {
  47533. warn(
  47534. 'Multiple root nodes returned from render function. Render function ' +
  47535. 'should return a single root node.',
  47536. vm
  47537. );
  47538. }
  47539. vnode = createEmptyVNode();
  47540. }
  47541. // set parent
  47542. vnode.parent = _parentVnode;
  47543. return vnode
  47544. };
  47545. }
  47546. /* */
  47547. function ensureCtor (comp, base) {
  47548. if (
  47549. comp.__esModule ||
  47550. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47551. ) {
  47552. comp = comp.default;
  47553. }
  47554. return isObject(comp)
  47555. ? base.extend(comp)
  47556. : comp
  47557. }
  47558. function createAsyncPlaceholder (
  47559. factory,
  47560. data,
  47561. context,
  47562. children,
  47563. tag
  47564. ) {
  47565. var node = createEmptyVNode();
  47566. node.asyncFactory = factory;
  47567. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47568. return node
  47569. }
  47570. function resolveAsyncComponent (
  47571. factory,
  47572. baseCtor
  47573. ) {
  47574. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47575. return factory.errorComp
  47576. }
  47577. if (isDef(factory.resolved)) {
  47578. return factory.resolved
  47579. }
  47580. var owner = currentRenderingInstance;
  47581. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47582. // already pending
  47583. factory.owners.push(owner);
  47584. }
  47585. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47586. return factory.loadingComp
  47587. }
  47588. if (owner && !isDef(factory.owners)) {
  47589. var owners = factory.owners = [owner];
  47590. var sync = true;
  47591. var timerLoading = null;
  47592. var timerTimeout = null
  47593. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47594. var forceRender = function (renderCompleted) {
  47595. for (var i = 0, l = owners.length; i < l; i++) {
  47596. (owners[i]).$forceUpdate();
  47597. }
  47598. if (renderCompleted) {
  47599. owners.length = 0;
  47600. if (timerLoading !== null) {
  47601. clearTimeout(timerLoading);
  47602. timerLoading = null;
  47603. }
  47604. if (timerTimeout !== null) {
  47605. clearTimeout(timerTimeout);
  47606. timerTimeout = null;
  47607. }
  47608. }
  47609. };
  47610. var resolve = once(function (res) {
  47611. // cache resolved
  47612. factory.resolved = ensureCtor(res, baseCtor);
  47613. // invoke callbacks only if this is not a synchronous resolve
  47614. // (async resolves are shimmed as synchronous during SSR)
  47615. if (!sync) {
  47616. forceRender(true);
  47617. } else {
  47618. owners.length = 0;
  47619. }
  47620. });
  47621. var reject = once(function (reason) {
  47622. warn(
  47623. "Failed to resolve async component: " + (String(factory)) +
  47624. (reason ? ("\nReason: " + reason) : '')
  47625. );
  47626. if (isDef(factory.errorComp)) {
  47627. factory.error = true;
  47628. forceRender(true);
  47629. }
  47630. });
  47631. var res = factory(resolve, reject);
  47632. if (isObject(res)) {
  47633. if (isPromise(res)) {
  47634. // () => Promise
  47635. if (isUndef(factory.resolved)) {
  47636. res.then(resolve, reject);
  47637. }
  47638. } else if (isPromise(res.component)) {
  47639. res.component.then(resolve, reject);
  47640. if (isDef(res.error)) {
  47641. factory.errorComp = ensureCtor(res.error, baseCtor);
  47642. }
  47643. if (isDef(res.loading)) {
  47644. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47645. if (res.delay === 0) {
  47646. factory.loading = true;
  47647. } else {
  47648. timerLoading = setTimeout(function () {
  47649. timerLoading = null;
  47650. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47651. factory.loading = true;
  47652. forceRender(false);
  47653. }
  47654. }, res.delay || 200);
  47655. }
  47656. }
  47657. if (isDef(res.timeout)) {
  47658. timerTimeout = setTimeout(function () {
  47659. timerTimeout = null;
  47660. if (isUndef(factory.resolved)) {
  47661. reject(
  47662. "timeout (" + (res.timeout) + "ms)"
  47663. );
  47664. }
  47665. }, res.timeout);
  47666. }
  47667. }
  47668. }
  47669. sync = false;
  47670. // return in case resolved synchronously
  47671. return factory.loading
  47672. ? factory.loadingComp
  47673. : factory.resolved
  47674. }
  47675. }
  47676. /* */
  47677. function isAsyncPlaceholder (node) {
  47678. return node.isComment && node.asyncFactory
  47679. }
  47680. /* */
  47681. function getFirstComponentChild (children) {
  47682. if (Array.isArray(children)) {
  47683. for (var i = 0; i < children.length; i++) {
  47684. var c = children[i];
  47685. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47686. return c
  47687. }
  47688. }
  47689. }
  47690. }
  47691. /* */
  47692. /* */
  47693. function initEvents (vm) {
  47694. vm._events = Object.create(null);
  47695. vm._hasHookEvent = false;
  47696. // init parent attached events
  47697. var listeners = vm.$options._parentListeners;
  47698. if (listeners) {
  47699. updateComponentListeners(vm, listeners);
  47700. }
  47701. }
  47702. var target;
  47703. function add (event, fn) {
  47704. target.$on(event, fn);
  47705. }
  47706. function remove$1 (event, fn) {
  47707. target.$off(event, fn);
  47708. }
  47709. function createOnceHandler (event, fn) {
  47710. var _target = target;
  47711. return function onceHandler () {
  47712. var res = fn.apply(null, arguments);
  47713. if (res !== null) {
  47714. _target.$off(event, onceHandler);
  47715. }
  47716. }
  47717. }
  47718. function updateComponentListeners (
  47719. vm,
  47720. listeners,
  47721. oldListeners
  47722. ) {
  47723. target = vm;
  47724. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47725. target = undefined;
  47726. }
  47727. function eventsMixin (Vue) {
  47728. var hookRE = /^hook:/;
  47729. Vue.prototype.$on = function (event, fn) {
  47730. var vm = this;
  47731. if (Array.isArray(event)) {
  47732. for (var i = 0, l = event.length; i < l; i++) {
  47733. vm.$on(event[i], fn);
  47734. }
  47735. } else {
  47736. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47737. // optimize hook:event cost by using a boolean flag marked at registration
  47738. // instead of a hash lookup
  47739. if (hookRE.test(event)) {
  47740. vm._hasHookEvent = true;
  47741. }
  47742. }
  47743. return vm
  47744. };
  47745. Vue.prototype.$once = function (event, fn) {
  47746. var vm = this;
  47747. function on () {
  47748. vm.$off(event, on);
  47749. fn.apply(vm, arguments);
  47750. }
  47751. on.fn = fn;
  47752. vm.$on(event, on);
  47753. return vm
  47754. };
  47755. Vue.prototype.$off = function (event, fn) {
  47756. var vm = this;
  47757. // all
  47758. if (!arguments.length) {
  47759. vm._events = Object.create(null);
  47760. return vm
  47761. }
  47762. // array of events
  47763. if (Array.isArray(event)) {
  47764. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47765. vm.$off(event[i$1], fn);
  47766. }
  47767. return vm
  47768. }
  47769. // specific event
  47770. var cbs = vm._events[event];
  47771. if (!cbs) {
  47772. return vm
  47773. }
  47774. if (!fn) {
  47775. vm._events[event] = null;
  47776. return vm
  47777. }
  47778. // specific handler
  47779. var cb;
  47780. var i = cbs.length;
  47781. while (i--) {
  47782. cb = cbs[i];
  47783. if (cb === fn || cb.fn === fn) {
  47784. cbs.splice(i, 1);
  47785. break
  47786. }
  47787. }
  47788. return vm
  47789. };
  47790. Vue.prototype.$emit = function (event) {
  47791. var vm = this;
  47792. {
  47793. var lowerCaseEvent = event.toLowerCase();
  47794. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  47795. tip(
  47796. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  47797. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  47798. "Note that HTML attributes are case-insensitive and you cannot use " +
  47799. "v-on to listen to camelCase events when using in-DOM templates. " +
  47800. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  47801. );
  47802. }
  47803. }
  47804. var cbs = vm._events[event];
  47805. if (cbs) {
  47806. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  47807. var args = toArray(arguments, 1);
  47808. var info = "event handler for \"" + event + "\"";
  47809. for (var i = 0, l = cbs.length; i < l; i++) {
  47810. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  47811. }
  47812. }
  47813. return vm
  47814. };
  47815. }
  47816. /* */
  47817. var activeInstance = null;
  47818. var isUpdatingChildComponent = false;
  47819. function setActiveInstance(vm) {
  47820. var prevActiveInstance = activeInstance;
  47821. activeInstance = vm;
  47822. return function () {
  47823. activeInstance = prevActiveInstance;
  47824. }
  47825. }
  47826. function initLifecycle (vm) {
  47827. var options = vm.$options;
  47828. // locate first non-abstract parent
  47829. var parent = options.parent;
  47830. if (parent && !options.abstract) {
  47831. while (parent.$options.abstract && parent.$parent) {
  47832. parent = parent.$parent;
  47833. }
  47834. parent.$children.push(vm);
  47835. }
  47836. vm.$parent = parent;
  47837. vm.$root = parent ? parent.$root : vm;
  47838. vm.$children = [];
  47839. vm.$refs = {};
  47840. vm._watcher = null;
  47841. vm._inactive = null;
  47842. vm._directInactive = false;
  47843. vm._isMounted = false;
  47844. vm._isDestroyed = false;
  47845. vm._isBeingDestroyed = false;
  47846. }
  47847. function lifecycleMixin (Vue) {
  47848. Vue.prototype._update = function (vnode, hydrating) {
  47849. var vm = this;
  47850. var prevEl = vm.$el;
  47851. var prevVnode = vm._vnode;
  47852. var restoreActiveInstance = setActiveInstance(vm);
  47853. vm._vnode = vnode;
  47854. // Vue.prototype.__patch__ is injected in entry points
  47855. // based on the rendering backend used.
  47856. if (!prevVnode) {
  47857. // initial render
  47858. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  47859. } else {
  47860. // updates
  47861. vm.$el = vm.__patch__(prevVnode, vnode);
  47862. }
  47863. restoreActiveInstance();
  47864. // update __vue__ reference
  47865. if (prevEl) {
  47866. prevEl.__vue__ = null;
  47867. }
  47868. if (vm.$el) {
  47869. vm.$el.__vue__ = vm;
  47870. }
  47871. // if parent is an HOC, update its $el as well
  47872. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  47873. vm.$parent.$el = vm.$el;
  47874. }
  47875. // updated hook is called by the scheduler to ensure that children are
  47876. // updated in a parent's updated hook.
  47877. };
  47878. Vue.prototype.$forceUpdate = function () {
  47879. var vm = this;
  47880. if (vm._watcher) {
  47881. vm._watcher.update();
  47882. }
  47883. };
  47884. Vue.prototype.$destroy = function () {
  47885. var vm = this;
  47886. if (vm._isBeingDestroyed) {
  47887. return
  47888. }
  47889. callHook(vm, 'beforeDestroy');
  47890. vm._isBeingDestroyed = true;
  47891. // remove self from parent
  47892. var parent = vm.$parent;
  47893. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  47894. remove(parent.$children, vm);
  47895. }
  47896. // teardown watchers
  47897. if (vm._watcher) {
  47898. vm._watcher.teardown();
  47899. }
  47900. var i = vm._watchers.length;
  47901. while (i--) {
  47902. vm._watchers[i].teardown();
  47903. }
  47904. // remove reference from data ob
  47905. // frozen object may not have observer.
  47906. if (vm._data.__ob__) {
  47907. vm._data.__ob__.vmCount--;
  47908. }
  47909. // call the last hook...
  47910. vm._isDestroyed = true;
  47911. // invoke destroy hooks on current rendered tree
  47912. vm.__patch__(vm._vnode, null);
  47913. // fire destroyed hook
  47914. callHook(vm, 'destroyed');
  47915. // turn off all instance listeners.
  47916. vm.$off();
  47917. // remove __vue__ reference
  47918. if (vm.$el) {
  47919. vm.$el.__vue__ = null;
  47920. }
  47921. // release circular reference (#6759)
  47922. if (vm.$vnode) {
  47923. vm.$vnode.parent = null;
  47924. }
  47925. };
  47926. }
  47927. function mountComponent (
  47928. vm,
  47929. el,
  47930. hydrating
  47931. ) {
  47932. vm.$el = el;
  47933. if (!vm.$options.render) {
  47934. vm.$options.render = createEmptyVNode;
  47935. {
  47936. /* istanbul ignore if */
  47937. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  47938. vm.$options.el || el) {
  47939. warn(
  47940. 'You are using the runtime-only build of Vue where the template ' +
  47941. 'compiler is not available. Either pre-compile the templates into ' +
  47942. 'render functions, or use the compiler-included build.',
  47943. vm
  47944. );
  47945. } else {
  47946. warn(
  47947. 'Failed to mount component: template or render function not defined.',
  47948. vm
  47949. );
  47950. }
  47951. }
  47952. }
  47953. callHook(vm, 'beforeMount');
  47954. var updateComponent;
  47955. /* istanbul ignore if */
  47956. if (config.performance && mark) {
  47957. updateComponent = function () {
  47958. var name = vm._name;
  47959. var id = vm._uid;
  47960. var startTag = "vue-perf-start:" + id;
  47961. var endTag = "vue-perf-end:" + id;
  47962. mark(startTag);
  47963. var vnode = vm._render();
  47964. mark(endTag);
  47965. measure(("vue " + name + " render"), startTag, endTag);
  47966. mark(startTag);
  47967. vm._update(vnode, hydrating);
  47968. mark(endTag);
  47969. measure(("vue " + name + " patch"), startTag, endTag);
  47970. };
  47971. } else {
  47972. updateComponent = function () {
  47973. vm._update(vm._render(), hydrating);
  47974. };
  47975. }
  47976. // we set this to vm._watcher inside the watcher's constructor
  47977. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  47978. // component's mounted hook), which relies on vm._watcher being already defined
  47979. new Watcher(vm, updateComponent, noop, {
  47980. before: function before () {
  47981. if (vm._isMounted && !vm._isDestroyed) {
  47982. callHook(vm, 'beforeUpdate');
  47983. }
  47984. }
  47985. }, true /* isRenderWatcher */);
  47986. hydrating = false;
  47987. // manually mounted instance, call mounted on self
  47988. // mounted is called for render-created child components in its inserted hook
  47989. if (vm.$vnode == null) {
  47990. vm._isMounted = true;
  47991. callHook(vm, 'mounted');
  47992. }
  47993. return vm
  47994. }
  47995. function updateChildComponent (
  47996. vm,
  47997. propsData,
  47998. listeners,
  47999. parentVnode,
  48000. renderChildren
  48001. ) {
  48002. {
  48003. isUpdatingChildComponent = true;
  48004. }
  48005. // determine whether component has slot children
  48006. // we need to do this before overwriting $options._renderChildren.
  48007. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48008. // dynamic slot names). Static scoped slots compiled from template has the
  48009. // "$stable" marker.
  48010. var newScopedSlots = parentVnode.data.scopedSlots;
  48011. var oldScopedSlots = vm.$scopedSlots;
  48012. var hasDynamicScopedSlot = !!(
  48013. (newScopedSlots && !newScopedSlots.$stable) ||
  48014. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48015. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48016. );
  48017. // Any static slot children from the parent may have changed during parent's
  48018. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48019. // update is necessary to ensure correctness.
  48020. var needsForceUpdate = !!(
  48021. renderChildren || // has new static slots
  48022. vm.$options._renderChildren || // has old static slots
  48023. hasDynamicScopedSlot
  48024. );
  48025. vm.$options._parentVnode = parentVnode;
  48026. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48027. if (vm._vnode) { // update child tree's parent
  48028. vm._vnode.parent = parentVnode;
  48029. }
  48030. vm.$options._renderChildren = renderChildren;
  48031. // update $attrs and $listeners hash
  48032. // these are also reactive so they may trigger child update if the child
  48033. // used them during render
  48034. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48035. vm.$listeners = listeners || emptyObject;
  48036. // update props
  48037. if (propsData && vm.$options.props) {
  48038. toggleObserving(false);
  48039. var props = vm._props;
  48040. var propKeys = vm.$options._propKeys || [];
  48041. for (var i = 0; i < propKeys.length; i++) {
  48042. var key = propKeys[i];
  48043. var propOptions = vm.$options.props; // wtf flow?
  48044. props[key] = validateProp(key, propOptions, propsData, vm);
  48045. }
  48046. toggleObserving(true);
  48047. // keep a copy of raw propsData
  48048. vm.$options.propsData = propsData;
  48049. }
  48050. // update listeners
  48051. listeners = listeners || emptyObject;
  48052. var oldListeners = vm.$options._parentListeners;
  48053. vm.$options._parentListeners = listeners;
  48054. updateComponentListeners(vm, listeners, oldListeners);
  48055. // resolve slots + force update if has children
  48056. if (needsForceUpdate) {
  48057. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48058. vm.$forceUpdate();
  48059. }
  48060. {
  48061. isUpdatingChildComponent = false;
  48062. }
  48063. }
  48064. function isInInactiveTree (vm) {
  48065. while (vm && (vm = vm.$parent)) {
  48066. if (vm._inactive) { return true }
  48067. }
  48068. return false
  48069. }
  48070. function activateChildComponent (vm, direct) {
  48071. if (direct) {
  48072. vm._directInactive = false;
  48073. if (isInInactiveTree(vm)) {
  48074. return
  48075. }
  48076. } else if (vm._directInactive) {
  48077. return
  48078. }
  48079. if (vm._inactive || vm._inactive === null) {
  48080. vm._inactive = false;
  48081. for (var i = 0; i < vm.$children.length; i++) {
  48082. activateChildComponent(vm.$children[i]);
  48083. }
  48084. callHook(vm, 'activated');
  48085. }
  48086. }
  48087. function deactivateChildComponent (vm, direct) {
  48088. if (direct) {
  48089. vm._directInactive = true;
  48090. if (isInInactiveTree(vm)) {
  48091. return
  48092. }
  48093. }
  48094. if (!vm._inactive) {
  48095. vm._inactive = true;
  48096. for (var i = 0; i < vm.$children.length; i++) {
  48097. deactivateChildComponent(vm.$children[i]);
  48098. }
  48099. callHook(vm, 'deactivated');
  48100. }
  48101. }
  48102. function callHook (vm, hook) {
  48103. // #7573 disable dep collection when invoking lifecycle hooks
  48104. pushTarget();
  48105. var handlers = vm.$options[hook];
  48106. var info = hook + " hook";
  48107. if (handlers) {
  48108. for (var i = 0, j = handlers.length; i < j; i++) {
  48109. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48110. }
  48111. }
  48112. if (vm._hasHookEvent) {
  48113. vm.$emit('hook:' + hook);
  48114. }
  48115. popTarget();
  48116. }
  48117. /* */
  48118. var MAX_UPDATE_COUNT = 100;
  48119. var queue = [];
  48120. var activatedChildren = [];
  48121. var has = {};
  48122. var circular = {};
  48123. var waiting = false;
  48124. var flushing = false;
  48125. var index = 0;
  48126. /**
  48127. * Reset the scheduler's state.
  48128. */
  48129. function resetSchedulerState () {
  48130. index = queue.length = activatedChildren.length = 0;
  48131. has = {};
  48132. {
  48133. circular = {};
  48134. }
  48135. waiting = flushing = false;
  48136. }
  48137. // Async edge case #6566 requires saving the timestamp when event listeners are
  48138. // attached. However, calling performance.now() has a perf overhead especially
  48139. // if the page has thousands of event listeners. Instead, we take a timestamp
  48140. // every time the scheduler flushes and use that for all event listeners
  48141. // attached during that flush.
  48142. var currentFlushTimestamp = 0;
  48143. // Async edge case fix requires storing an event listener's attach timestamp.
  48144. var getNow = Date.now;
  48145. // Determine what event timestamp the browser is using. Annoyingly, the
  48146. // timestamp can either be hi-res (relative to page load) or low-res
  48147. // (relative to UNIX epoch), so in order to compare time we have to use the
  48148. // same timestamp type when saving the flush timestamp.
  48149. // All IE versions use low-res event timestamps, and have problematic clock
  48150. // implementations (#9632)
  48151. if (inBrowser && !isIE) {
  48152. var performance = window.performance;
  48153. if (
  48154. performance &&
  48155. typeof performance.now === 'function' &&
  48156. getNow() > document.createEvent('Event').timeStamp
  48157. ) {
  48158. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48159. // smaller than it, it means the event is using a hi-res timestamp,
  48160. // and we need to use the hi-res version for event listener timestamps as
  48161. // well.
  48162. getNow = function () { return performance.now(); };
  48163. }
  48164. }
  48165. /**
  48166. * Flush both queues and run the watchers.
  48167. */
  48168. function flushSchedulerQueue () {
  48169. currentFlushTimestamp = getNow();
  48170. flushing = true;
  48171. var watcher, id;
  48172. // Sort queue before flush.
  48173. // This ensures that:
  48174. // 1. Components are updated from parent to child. (because parent is always
  48175. // created before the child)
  48176. // 2. A component's user watchers are run before its render watcher (because
  48177. // user watchers are created before the render watcher)
  48178. // 3. If a component is destroyed during a parent component's watcher run,
  48179. // its watchers can be skipped.
  48180. queue.sort(function (a, b) { return a.id - b.id; });
  48181. // do not cache length because more watchers might be pushed
  48182. // as we run existing watchers
  48183. for (index = 0; index < queue.length; index++) {
  48184. watcher = queue[index];
  48185. if (watcher.before) {
  48186. watcher.before();
  48187. }
  48188. id = watcher.id;
  48189. has[id] = null;
  48190. watcher.run();
  48191. // in dev build, check and stop circular updates.
  48192. if (has[id] != null) {
  48193. circular[id] = (circular[id] || 0) + 1;
  48194. if (circular[id] > MAX_UPDATE_COUNT) {
  48195. warn(
  48196. 'You may have an infinite update loop ' + (
  48197. watcher.user
  48198. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48199. : "in a component render function."
  48200. ),
  48201. watcher.vm
  48202. );
  48203. break
  48204. }
  48205. }
  48206. }
  48207. // keep copies of post queues before resetting state
  48208. var activatedQueue = activatedChildren.slice();
  48209. var updatedQueue = queue.slice();
  48210. resetSchedulerState();
  48211. // call component updated and activated hooks
  48212. callActivatedHooks(activatedQueue);
  48213. callUpdatedHooks(updatedQueue);
  48214. // devtool hook
  48215. /* istanbul ignore if */
  48216. if (devtools && config.devtools) {
  48217. devtools.emit('flush');
  48218. }
  48219. }
  48220. function callUpdatedHooks (queue) {
  48221. var i = queue.length;
  48222. while (i--) {
  48223. var watcher = queue[i];
  48224. var vm = watcher.vm;
  48225. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48226. callHook(vm, 'updated');
  48227. }
  48228. }
  48229. }
  48230. /**
  48231. * Queue a kept-alive component that was activated during patch.
  48232. * The queue will be processed after the entire tree has been patched.
  48233. */
  48234. function queueActivatedComponent (vm) {
  48235. // setting _inactive to false here so that a render function can
  48236. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48237. vm._inactive = false;
  48238. activatedChildren.push(vm);
  48239. }
  48240. function callActivatedHooks (queue) {
  48241. for (var i = 0; i < queue.length; i++) {
  48242. queue[i]._inactive = true;
  48243. activateChildComponent(queue[i], true /* true */);
  48244. }
  48245. }
  48246. /**
  48247. * Push a watcher into the watcher queue.
  48248. * Jobs with duplicate IDs will be skipped unless it's
  48249. * pushed when the queue is being flushed.
  48250. */
  48251. function queueWatcher (watcher) {
  48252. var id = watcher.id;
  48253. if (has[id] == null) {
  48254. has[id] = true;
  48255. if (!flushing) {
  48256. queue.push(watcher);
  48257. } else {
  48258. // if already flushing, splice the watcher based on its id
  48259. // if already past its id, it will be run next immediately.
  48260. var i = queue.length - 1;
  48261. while (i > index && queue[i].id > watcher.id) {
  48262. i--;
  48263. }
  48264. queue.splice(i + 1, 0, watcher);
  48265. }
  48266. // queue the flush
  48267. if (!waiting) {
  48268. waiting = true;
  48269. if (!config.async) {
  48270. flushSchedulerQueue();
  48271. return
  48272. }
  48273. nextTick(flushSchedulerQueue);
  48274. }
  48275. }
  48276. }
  48277. /* */
  48278. var uid$2 = 0;
  48279. /**
  48280. * A watcher parses an expression, collects dependencies,
  48281. * and fires callback when the expression value changes.
  48282. * This is used for both the $watch() api and directives.
  48283. */
  48284. var Watcher = function Watcher (
  48285. vm,
  48286. expOrFn,
  48287. cb,
  48288. options,
  48289. isRenderWatcher
  48290. ) {
  48291. this.vm = vm;
  48292. if (isRenderWatcher) {
  48293. vm._watcher = this;
  48294. }
  48295. vm._watchers.push(this);
  48296. // options
  48297. if (options) {
  48298. this.deep = !!options.deep;
  48299. this.user = !!options.user;
  48300. this.lazy = !!options.lazy;
  48301. this.sync = !!options.sync;
  48302. this.before = options.before;
  48303. } else {
  48304. this.deep = this.user = this.lazy = this.sync = false;
  48305. }
  48306. this.cb = cb;
  48307. this.id = ++uid$2; // uid for batching
  48308. this.active = true;
  48309. this.dirty = this.lazy; // for lazy watchers
  48310. this.deps = [];
  48311. this.newDeps = [];
  48312. this.depIds = new _Set();
  48313. this.newDepIds = new _Set();
  48314. this.expression = expOrFn.toString();
  48315. // parse expression for getter
  48316. if (typeof expOrFn === 'function') {
  48317. this.getter = expOrFn;
  48318. } else {
  48319. this.getter = parsePath(expOrFn);
  48320. if (!this.getter) {
  48321. this.getter = noop;
  48322. warn(
  48323. "Failed watching path: \"" + expOrFn + "\" " +
  48324. 'Watcher only accepts simple dot-delimited paths. ' +
  48325. 'For full control, use a function instead.',
  48326. vm
  48327. );
  48328. }
  48329. }
  48330. this.value = this.lazy
  48331. ? undefined
  48332. : this.get();
  48333. };
  48334. /**
  48335. * Evaluate the getter, and re-collect dependencies.
  48336. */
  48337. Watcher.prototype.get = function get () {
  48338. pushTarget(this);
  48339. var value;
  48340. var vm = this.vm;
  48341. try {
  48342. value = this.getter.call(vm, vm);
  48343. } catch (e) {
  48344. if (this.user) {
  48345. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48346. } else {
  48347. throw e
  48348. }
  48349. } finally {
  48350. // "touch" every property so they are all tracked as
  48351. // dependencies for deep watching
  48352. if (this.deep) {
  48353. traverse(value);
  48354. }
  48355. popTarget();
  48356. this.cleanupDeps();
  48357. }
  48358. return value
  48359. };
  48360. /**
  48361. * Add a dependency to this directive.
  48362. */
  48363. Watcher.prototype.addDep = function addDep (dep) {
  48364. var id = dep.id;
  48365. if (!this.newDepIds.has(id)) {
  48366. this.newDepIds.add(id);
  48367. this.newDeps.push(dep);
  48368. if (!this.depIds.has(id)) {
  48369. dep.addSub(this);
  48370. }
  48371. }
  48372. };
  48373. /**
  48374. * Clean up for dependency collection.
  48375. */
  48376. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48377. var i = this.deps.length;
  48378. while (i--) {
  48379. var dep = this.deps[i];
  48380. if (!this.newDepIds.has(dep.id)) {
  48381. dep.removeSub(this);
  48382. }
  48383. }
  48384. var tmp = this.depIds;
  48385. this.depIds = this.newDepIds;
  48386. this.newDepIds = tmp;
  48387. this.newDepIds.clear();
  48388. tmp = this.deps;
  48389. this.deps = this.newDeps;
  48390. this.newDeps = tmp;
  48391. this.newDeps.length = 0;
  48392. };
  48393. /**
  48394. * Subscriber interface.
  48395. * Will be called when a dependency changes.
  48396. */
  48397. Watcher.prototype.update = function update () {
  48398. /* istanbul ignore else */
  48399. if (this.lazy) {
  48400. this.dirty = true;
  48401. } else if (this.sync) {
  48402. this.run();
  48403. } else {
  48404. queueWatcher(this);
  48405. }
  48406. };
  48407. /**
  48408. * Scheduler job interface.
  48409. * Will be called by the scheduler.
  48410. */
  48411. Watcher.prototype.run = function run () {
  48412. if (this.active) {
  48413. var value = this.get();
  48414. if (
  48415. value !== this.value ||
  48416. // Deep watchers and watchers on Object/Arrays should fire even
  48417. // when the value is the same, because the value may
  48418. // have mutated.
  48419. isObject(value) ||
  48420. this.deep
  48421. ) {
  48422. // set new value
  48423. var oldValue = this.value;
  48424. this.value = value;
  48425. if (this.user) {
  48426. try {
  48427. this.cb.call(this.vm, value, oldValue);
  48428. } catch (e) {
  48429. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48430. }
  48431. } else {
  48432. this.cb.call(this.vm, value, oldValue);
  48433. }
  48434. }
  48435. }
  48436. };
  48437. /**
  48438. * Evaluate the value of the watcher.
  48439. * This only gets called for lazy watchers.
  48440. */
  48441. Watcher.prototype.evaluate = function evaluate () {
  48442. this.value = this.get();
  48443. this.dirty = false;
  48444. };
  48445. /**
  48446. * Depend on all deps collected by this watcher.
  48447. */
  48448. Watcher.prototype.depend = function depend () {
  48449. var i = this.deps.length;
  48450. while (i--) {
  48451. this.deps[i].depend();
  48452. }
  48453. };
  48454. /**
  48455. * Remove self from all dependencies' subscriber list.
  48456. */
  48457. Watcher.prototype.teardown = function teardown () {
  48458. if (this.active) {
  48459. // remove self from vm's watcher list
  48460. // this is a somewhat expensive operation so we skip it
  48461. // if the vm is being destroyed.
  48462. if (!this.vm._isBeingDestroyed) {
  48463. remove(this.vm._watchers, this);
  48464. }
  48465. var i = this.deps.length;
  48466. while (i--) {
  48467. this.deps[i].removeSub(this);
  48468. }
  48469. this.active = false;
  48470. }
  48471. };
  48472. /* */
  48473. var sharedPropertyDefinition = {
  48474. enumerable: true,
  48475. configurable: true,
  48476. get: noop,
  48477. set: noop
  48478. };
  48479. function proxy (target, sourceKey, key) {
  48480. sharedPropertyDefinition.get = function proxyGetter () {
  48481. return this[sourceKey][key]
  48482. };
  48483. sharedPropertyDefinition.set = function proxySetter (val) {
  48484. this[sourceKey][key] = val;
  48485. };
  48486. Object.defineProperty(target, key, sharedPropertyDefinition);
  48487. }
  48488. function initState (vm) {
  48489. vm._watchers = [];
  48490. var opts = vm.$options;
  48491. if (opts.props) { initProps(vm, opts.props); }
  48492. if (opts.methods) { initMethods(vm, opts.methods); }
  48493. if (opts.data) {
  48494. initData(vm);
  48495. } else {
  48496. observe(vm._data = {}, true /* asRootData */);
  48497. }
  48498. if (opts.computed) { initComputed(vm, opts.computed); }
  48499. if (opts.watch && opts.watch !== nativeWatch) {
  48500. initWatch(vm, opts.watch);
  48501. }
  48502. }
  48503. function initProps (vm, propsOptions) {
  48504. var propsData = vm.$options.propsData || {};
  48505. var props = vm._props = {};
  48506. // cache prop keys so that future props updates can iterate using Array
  48507. // instead of dynamic object key enumeration.
  48508. var keys = vm.$options._propKeys = [];
  48509. var isRoot = !vm.$parent;
  48510. // root instance props should be converted
  48511. if (!isRoot) {
  48512. toggleObserving(false);
  48513. }
  48514. var loop = function ( key ) {
  48515. keys.push(key);
  48516. var value = validateProp(key, propsOptions, propsData, vm);
  48517. /* istanbul ignore else */
  48518. {
  48519. var hyphenatedKey = hyphenate(key);
  48520. if (isReservedAttribute(hyphenatedKey) ||
  48521. config.isReservedAttr(hyphenatedKey)) {
  48522. warn(
  48523. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48524. vm
  48525. );
  48526. }
  48527. defineReactive$$1(props, key, value, function () {
  48528. if (!isRoot && !isUpdatingChildComponent) {
  48529. warn(
  48530. "Avoid mutating a prop directly since the value will be " +
  48531. "overwritten whenever the parent component re-renders. " +
  48532. "Instead, use a data or computed property based on the prop's " +
  48533. "value. Prop being mutated: \"" + key + "\"",
  48534. vm
  48535. );
  48536. }
  48537. });
  48538. }
  48539. // static props are already proxied on the component's prototype
  48540. // during Vue.extend(). We only need to proxy props defined at
  48541. // instantiation here.
  48542. if (!(key in vm)) {
  48543. proxy(vm, "_props", key);
  48544. }
  48545. };
  48546. for (var key in propsOptions) loop( key );
  48547. toggleObserving(true);
  48548. }
  48549. function initData (vm) {
  48550. var data = vm.$options.data;
  48551. data = vm._data = typeof data === 'function'
  48552. ? getData(data, vm)
  48553. : data || {};
  48554. if (!isPlainObject(data)) {
  48555. data = {};
  48556. warn(
  48557. 'data functions should return an object:\n' +
  48558. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48559. vm
  48560. );
  48561. }
  48562. // proxy data on instance
  48563. var keys = Object.keys(data);
  48564. var props = vm.$options.props;
  48565. var methods = vm.$options.methods;
  48566. var i = keys.length;
  48567. while (i--) {
  48568. var key = keys[i];
  48569. {
  48570. if (methods && hasOwn(methods, key)) {
  48571. warn(
  48572. ("Method \"" + key + "\" has already been defined as a data property."),
  48573. vm
  48574. );
  48575. }
  48576. }
  48577. if (props && hasOwn(props, key)) {
  48578. warn(
  48579. "The data property \"" + key + "\" is already declared as a prop. " +
  48580. "Use prop default value instead.",
  48581. vm
  48582. );
  48583. } else if (!isReserved(key)) {
  48584. proxy(vm, "_data", key);
  48585. }
  48586. }
  48587. // observe data
  48588. observe(data, true /* asRootData */);
  48589. }
  48590. function getData (data, vm) {
  48591. // #7573 disable dep collection when invoking data getters
  48592. pushTarget();
  48593. try {
  48594. return data.call(vm, vm)
  48595. } catch (e) {
  48596. handleError(e, vm, "data()");
  48597. return {}
  48598. } finally {
  48599. popTarget();
  48600. }
  48601. }
  48602. var computedWatcherOptions = { lazy: true };
  48603. function initComputed (vm, computed) {
  48604. // $flow-disable-line
  48605. var watchers = vm._computedWatchers = Object.create(null);
  48606. // computed properties are just getters during SSR
  48607. var isSSR = isServerRendering();
  48608. for (var key in computed) {
  48609. var userDef = computed[key];
  48610. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48611. if (getter == null) {
  48612. warn(
  48613. ("Getter is missing for computed property \"" + key + "\"."),
  48614. vm
  48615. );
  48616. }
  48617. if (!isSSR) {
  48618. // create internal watcher for the computed property.
  48619. watchers[key] = new Watcher(
  48620. vm,
  48621. getter || noop,
  48622. noop,
  48623. computedWatcherOptions
  48624. );
  48625. }
  48626. // component-defined computed properties are already defined on the
  48627. // component prototype. We only need to define computed properties defined
  48628. // at instantiation here.
  48629. if (!(key in vm)) {
  48630. defineComputed(vm, key, userDef);
  48631. } else {
  48632. if (key in vm.$data) {
  48633. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48634. } else if (vm.$options.props && key in vm.$options.props) {
  48635. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48636. }
  48637. }
  48638. }
  48639. }
  48640. function defineComputed (
  48641. target,
  48642. key,
  48643. userDef
  48644. ) {
  48645. var shouldCache = !isServerRendering();
  48646. if (typeof userDef === 'function') {
  48647. sharedPropertyDefinition.get = shouldCache
  48648. ? createComputedGetter(key)
  48649. : createGetterInvoker(userDef);
  48650. sharedPropertyDefinition.set = noop;
  48651. } else {
  48652. sharedPropertyDefinition.get = userDef.get
  48653. ? shouldCache && userDef.cache !== false
  48654. ? createComputedGetter(key)
  48655. : createGetterInvoker(userDef.get)
  48656. : noop;
  48657. sharedPropertyDefinition.set = userDef.set || noop;
  48658. }
  48659. if (sharedPropertyDefinition.set === noop) {
  48660. sharedPropertyDefinition.set = function () {
  48661. warn(
  48662. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48663. this
  48664. );
  48665. };
  48666. }
  48667. Object.defineProperty(target, key, sharedPropertyDefinition);
  48668. }
  48669. function createComputedGetter (key) {
  48670. return function computedGetter () {
  48671. var watcher = this._computedWatchers && this._computedWatchers[key];
  48672. if (watcher) {
  48673. if (watcher.dirty) {
  48674. watcher.evaluate();
  48675. }
  48676. if (Dep.target) {
  48677. watcher.depend();
  48678. }
  48679. return watcher.value
  48680. }
  48681. }
  48682. }
  48683. function createGetterInvoker(fn) {
  48684. return function computedGetter () {
  48685. return fn.call(this, this)
  48686. }
  48687. }
  48688. function initMethods (vm, methods) {
  48689. var props = vm.$options.props;
  48690. for (var key in methods) {
  48691. {
  48692. if (typeof methods[key] !== 'function') {
  48693. warn(
  48694. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48695. "Did you reference the function correctly?",
  48696. vm
  48697. );
  48698. }
  48699. if (props && hasOwn(props, key)) {
  48700. warn(
  48701. ("Method \"" + key + "\" has already been defined as a prop."),
  48702. vm
  48703. );
  48704. }
  48705. if ((key in vm) && isReserved(key)) {
  48706. warn(
  48707. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48708. "Avoid defining component methods that start with _ or $."
  48709. );
  48710. }
  48711. }
  48712. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48713. }
  48714. }
  48715. function initWatch (vm, watch) {
  48716. for (var key in watch) {
  48717. var handler = watch[key];
  48718. if (Array.isArray(handler)) {
  48719. for (var i = 0; i < handler.length; i++) {
  48720. createWatcher(vm, key, handler[i]);
  48721. }
  48722. } else {
  48723. createWatcher(vm, key, handler);
  48724. }
  48725. }
  48726. }
  48727. function createWatcher (
  48728. vm,
  48729. expOrFn,
  48730. handler,
  48731. options
  48732. ) {
  48733. if (isPlainObject(handler)) {
  48734. options = handler;
  48735. handler = handler.handler;
  48736. }
  48737. if (typeof handler === 'string') {
  48738. handler = vm[handler];
  48739. }
  48740. return vm.$watch(expOrFn, handler, options)
  48741. }
  48742. function stateMixin (Vue) {
  48743. // flow somehow has problems with directly declared definition object
  48744. // when using Object.defineProperty, so we have to procedurally build up
  48745. // the object here.
  48746. var dataDef = {};
  48747. dataDef.get = function () { return this._data };
  48748. var propsDef = {};
  48749. propsDef.get = function () { return this._props };
  48750. {
  48751. dataDef.set = function () {
  48752. warn(
  48753. 'Avoid replacing instance root $data. ' +
  48754. 'Use nested data properties instead.',
  48755. this
  48756. );
  48757. };
  48758. propsDef.set = function () {
  48759. warn("$props is readonly.", this);
  48760. };
  48761. }
  48762. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48763. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48764. Vue.prototype.$set = set;
  48765. Vue.prototype.$delete = del;
  48766. Vue.prototype.$watch = function (
  48767. expOrFn,
  48768. cb,
  48769. options
  48770. ) {
  48771. var vm = this;
  48772. if (isPlainObject(cb)) {
  48773. return createWatcher(vm, expOrFn, cb, options)
  48774. }
  48775. options = options || {};
  48776. options.user = true;
  48777. var watcher = new Watcher(vm, expOrFn, cb, options);
  48778. if (options.immediate) {
  48779. try {
  48780. cb.call(vm, watcher.value);
  48781. } catch (error) {
  48782. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  48783. }
  48784. }
  48785. return function unwatchFn () {
  48786. watcher.teardown();
  48787. }
  48788. };
  48789. }
  48790. /* */
  48791. var uid$3 = 0;
  48792. function initMixin (Vue) {
  48793. Vue.prototype._init = function (options) {
  48794. var vm = this;
  48795. // a uid
  48796. vm._uid = uid$3++;
  48797. var startTag, endTag;
  48798. /* istanbul ignore if */
  48799. if (config.performance && mark) {
  48800. startTag = "vue-perf-start:" + (vm._uid);
  48801. endTag = "vue-perf-end:" + (vm._uid);
  48802. mark(startTag);
  48803. }
  48804. // a flag to avoid this being observed
  48805. vm._isVue = true;
  48806. // merge options
  48807. if (options && options._isComponent) {
  48808. // optimize internal component instantiation
  48809. // since dynamic options merging is pretty slow, and none of the
  48810. // internal component options needs special treatment.
  48811. initInternalComponent(vm, options);
  48812. } else {
  48813. vm.$options = mergeOptions(
  48814. resolveConstructorOptions(vm.constructor),
  48815. options || {},
  48816. vm
  48817. );
  48818. }
  48819. /* istanbul ignore else */
  48820. {
  48821. initProxy(vm);
  48822. }
  48823. // expose real self
  48824. vm._self = vm;
  48825. initLifecycle(vm);
  48826. initEvents(vm);
  48827. initRender(vm);
  48828. callHook(vm, 'beforeCreate');
  48829. initInjections(vm); // resolve injections before data/props
  48830. initState(vm);
  48831. initProvide(vm); // resolve provide after data/props
  48832. callHook(vm, 'created');
  48833. /* istanbul ignore if */
  48834. if (config.performance && mark) {
  48835. vm._name = formatComponentName(vm, false);
  48836. mark(endTag);
  48837. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  48838. }
  48839. if (vm.$options.el) {
  48840. vm.$mount(vm.$options.el);
  48841. }
  48842. };
  48843. }
  48844. function initInternalComponent (vm, options) {
  48845. var opts = vm.$options = Object.create(vm.constructor.options);
  48846. // doing this because it's faster than dynamic enumeration.
  48847. var parentVnode = options._parentVnode;
  48848. opts.parent = options.parent;
  48849. opts._parentVnode = parentVnode;
  48850. var vnodeComponentOptions = parentVnode.componentOptions;
  48851. opts.propsData = vnodeComponentOptions.propsData;
  48852. opts._parentListeners = vnodeComponentOptions.listeners;
  48853. opts._renderChildren = vnodeComponentOptions.children;
  48854. opts._componentTag = vnodeComponentOptions.tag;
  48855. if (options.render) {
  48856. opts.render = options.render;
  48857. opts.staticRenderFns = options.staticRenderFns;
  48858. }
  48859. }
  48860. function resolveConstructorOptions (Ctor) {
  48861. var options = Ctor.options;
  48862. if (Ctor.super) {
  48863. var superOptions = resolveConstructorOptions(Ctor.super);
  48864. var cachedSuperOptions = Ctor.superOptions;
  48865. if (superOptions !== cachedSuperOptions) {
  48866. // super option changed,
  48867. // need to resolve new options.
  48868. Ctor.superOptions = superOptions;
  48869. // check if there are any late-modified/attached options (#4976)
  48870. var modifiedOptions = resolveModifiedOptions(Ctor);
  48871. // update base extend options
  48872. if (modifiedOptions) {
  48873. extend(Ctor.extendOptions, modifiedOptions);
  48874. }
  48875. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  48876. if (options.name) {
  48877. options.components[options.name] = Ctor;
  48878. }
  48879. }
  48880. }
  48881. return options
  48882. }
  48883. function resolveModifiedOptions (Ctor) {
  48884. var modified;
  48885. var latest = Ctor.options;
  48886. var sealed = Ctor.sealedOptions;
  48887. for (var key in latest) {
  48888. if (latest[key] !== sealed[key]) {
  48889. if (!modified) { modified = {}; }
  48890. modified[key] = latest[key];
  48891. }
  48892. }
  48893. return modified
  48894. }
  48895. function Vue (options) {
  48896. if (!(this instanceof Vue)
  48897. ) {
  48898. warn('Vue is a constructor and should be called with the `new` keyword');
  48899. }
  48900. this._init(options);
  48901. }
  48902. initMixin(Vue);
  48903. stateMixin(Vue);
  48904. eventsMixin(Vue);
  48905. lifecycleMixin(Vue);
  48906. renderMixin(Vue);
  48907. /* */
  48908. function initUse (Vue) {
  48909. Vue.use = function (plugin) {
  48910. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  48911. if (installedPlugins.indexOf(plugin) > -1) {
  48912. return this
  48913. }
  48914. // additional parameters
  48915. var args = toArray(arguments, 1);
  48916. args.unshift(this);
  48917. if (typeof plugin.install === 'function') {
  48918. plugin.install.apply(plugin, args);
  48919. } else if (typeof plugin === 'function') {
  48920. plugin.apply(null, args);
  48921. }
  48922. installedPlugins.push(plugin);
  48923. return this
  48924. };
  48925. }
  48926. /* */
  48927. function initMixin$1 (Vue) {
  48928. Vue.mixin = function (mixin) {
  48929. this.options = mergeOptions(this.options, mixin);
  48930. return this
  48931. };
  48932. }
  48933. /* */
  48934. function initExtend (Vue) {
  48935. /**
  48936. * Each instance constructor, including Vue, has a unique
  48937. * cid. This enables us to create wrapped "child
  48938. * constructors" for prototypal inheritance and cache them.
  48939. */
  48940. Vue.cid = 0;
  48941. var cid = 1;
  48942. /**
  48943. * Class inheritance
  48944. */
  48945. Vue.extend = function (extendOptions) {
  48946. extendOptions = extendOptions || {};
  48947. var Super = this;
  48948. var SuperId = Super.cid;
  48949. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  48950. if (cachedCtors[SuperId]) {
  48951. return cachedCtors[SuperId]
  48952. }
  48953. var name = extendOptions.name || Super.options.name;
  48954. if (name) {
  48955. validateComponentName(name);
  48956. }
  48957. var Sub = function VueComponent (options) {
  48958. this._init(options);
  48959. };
  48960. Sub.prototype = Object.create(Super.prototype);
  48961. Sub.prototype.constructor = Sub;
  48962. Sub.cid = cid++;
  48963. Sub.options = mergeOptions(
  48964. Super.options,
  48965. extendOptions
  48966. );
  48967. Sub['super'] = Super;
  48968. // For props and computed properties, we define the proxy getters on
  48969. // the Vue instances at extension time, on the extended prototype. This
  48970. // avoids Object.defineProperty calls for each instance created.
  48971. if (Sub.options.props) {
  48972. initProps$1(Sub);
  48973. }
  48974. if (Sub.options.computed) {
  48975. initComputed$1(Sub);
  48976. }
  48977. // allow further extension/mixin/plugin usage
  48978. Sub.extend = Super.extend;
  48979. Sub.mixin = Super.mixin;
  48980. Sub.use = Super.use;
  48981. // create asset registers, so extended classes
  48982. // can have their private assets too.
  48983. ASSET_TYPES.forEach(function (type) {
  48984. Sub[type] = Super[type];
  48985. });
  48986. // enable recursive self-lookup
  48987. if (name) {
  48988. Sub.options.components[name] = Sub;
  48989. }
  48990. // keep a reference to the super options at extension time.
  48991. // later at instantiation we can check if Super's options have
  48992. // been updated.
  48993. Sub.superOptions = Super.options;
  48994. Sub.extendOptions = extendOptions;
  48995. Sub.sealedOptions = extend({}, Sub.options);
  48996. // cache constructor
  48997. cachedCtors[SuperId] = Sub;
  48998. return Sub
  48999. };
  49000. }
  49001. function initProps$1 (Comp) {
  49002. var props = Comp.options.props;
  49003. for (var key in props) {
  49004. proxy(Comp.prototype, "_props", key);
  49005. }
  49006. }
  49007. function initComputed$1 (Comp) {
  49008. var computed = Comp.options.computed;
  49009. for (var key in computed) {
  49010. defineComputed(Comp.prototype, key, computed[key]);
  49011. }
  49012. }
  49013. /* */
  49014. function initAssetRegisters (Vue) {
  49015. /**
  49016. * Create asset registration methods.
  49017. */
  49018. ASSET_TYPES.forEach(function (type) {
  49019. Vue[type] = function (
  49020. id,
  49021. definition
  49022. ) {
  49023. if (!definition) {
  49024. return this.options[type + 's'][id]
  49025. } else {
  49026. /* istanbul ignore if */
  49027. if (type === 'component') {
  49028. validateComponentName(id);
  49029. }
  49030. if (type === 'component' && isPlainObject(definition)) {
  49031. definition.name = definition.name || id;
  49032. definition = this.options._base.extend(definition);
  49033. }
  49034. if (type === 'directive' && typeof definition === 'function') {
  49035. definition = { bind: definition, update: definition };
  49036. }
  49037. this.options[type + 's'][id] = definition;
  49038. return definition
  49039. }
  49040. };
  49041. });
  49042. }
  49043. /* */
  49044. function getComponentName (opts) {
  49045. return opts && (opts.Ctor.options.name || opts.tag)
  49046. }
  49047. function matches (pattern, name) {
  49048. if (Array.isArray(pattern)) {
  49049. return pattern.indexOf(name) > -1
  49050. } else if (typeof pattern === 'string') {
  49051. return pattern.split(',').indexOf(name) > -1
  49052. } else if (isRegExp(pattern)) {
  49053. return pattern.test(name)
  49054. }
  49055. /* istanbul ignore next */
  49056. return false
  49057. }
  49058. function pruneCache (keepAliveInstance, filter) {
  49059. var cache = keepAliveInstance.cache;
  49060. var keys = keepAliveInstance.keys;
  49061. var _vnode = keepAliveInstance._vnode;
  49062. for (var key in cache) {
  49063. var cachedNode = cache[key];
  49064. if (cachedNode) {
  49065. var name = getComponentName(cachedNode.componentOptions);
  49066. if (name && !filter(name)) {
  49067. pruneCacheEntry(cache, key, keys, _vnode);
  49068. }
  49069. }
  49070. }
  49071. }
  49072. function pruneCacheEntry (
  49073. cache,
  49074. key,
  49075. keys,
  49076. current
  49077. ) {
  49078. var cached$$1 = cache[key];
  49079. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49080. cached$$1.componentInstance.$destroy();
  49081. }
  49082. cache[key] = null;
  49083. remove(keys, key);
  49084. }
  49085. var patternTypes = [String, RegExp, Array];
  49086. var KeepAlive = {
  49087. name: 'keep-alive',
  49088. abstract: true,
  49089. props: {
  49090. include: patternTypes,
  49091. exclude: patternTypes,
  49092. max: [String, Number]
  49093. },
  49094. created: function created () {
  49095. this.cache = Object.create(null);
  49096. this.keys = [];
  49097. },
  49098. destroyed: function destroyed () {
  49099. for (var key in this.cache) {
  49100. pruneCacheEntry(this.cache, key, this.keys);
  49101. }
  49102. },
  49103. mounted: function mounted () {
  49104. var this$1 = this;
  49105. this.$watch('include', function (val) {
  49106. pruneCache(this$1, function (name) { return matches(val, name); });
  49107. });
  49108. this.$watch('exclude', function (val) {
  49109. pruneCache(this$1, function (name) { return !matches(val, name); });
  49110. });
  49111. },
  49112. render: function render () {
  49113. var slot = this.$slots.default;
  49114. var vnode = getFirstComponentChild(slot);
  49115. var componentOptions = vnode && vnode.componentOptions;
  49116. if (componentOptions) {
  49117. // check pattern
  49118. var name = getComponentName(componentOptions);
  49119. var ref = this;
  49120. var include = ref.include;
  49121. var exclude = ref.exclude;
  49122. if (
  49123. // not included
  49124. (include && (!name || !matches(include, name))) ||
  49125. // excluded
  49126. (exclude && name && matches(exclude, name))
  49127. ) {
  49128. return vnode
  49129. }
  49130. var ref$1 = this;
  49131. var cache = ref$1.cache;
  49132. var keys = ref$1.keys;
  49133. var key = vnode.key == null
  49134. // same constructor may get registered as different local components
  49135. // so cid alone is not enough (#3269)
  49136. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49137. : vnode.key;
  49138. if (cache[key]) {
  49139. vnode.componentInstance = cache[key].componentInstance;
  49140. // make current key freshest
  49141. remove(keys, key);
  49142. keys.push(key);
  49143. } else {
  49144. cache[key] = vnode;
  49145. keys.push(key);
  49146. // prune oldest entry
  49147. if (this.max && keys.length > parseInt(this.max)) {
  49148. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49149. }
  49150. }
  49151. vnode.data.keepAlive = true;
  49152. }
  49153. return vnode || (slot && slot[0])
  49154. }
  49155. };
  49156. var builtInComponents = {
  49157. KeepAlive: KeepAlive
  49158. };
  49159. /* */
  49160. function initGlobalAPI (Vue) {
  49161. // config
  49162. var configDef = {};
  49163. configDef.get = function () { return config; };
  49164. {
  49165. configDef.set = function () {
  49166. warn(
  49167. 'Do not replace the Vue.config object, set individual fields instead.'
  49168. );
  49169. };
  49170. }
  49171. Object.defineProperty(Vue, 'config', configDef);
  49172. // exposed util methods.
  49173. // NOTE: these are not considered part of the public API - avoid relying on
  49174. // them unless you are aware of the risk.
  49175. Vue.util = {
  49176. warn: warn,
  49177. extend: extend,
  49178. mergeOptions: mergeOptions,
  49179. defineReactive: defineReactive$$1
  49180. };
  49181. Vue.set = set;
  49182. Vue.delete = del;
  49183. Vue.nextTick = nextTick;
  49184. // 2.6 explicit observable API
  49185. Vue.observable = function (obj) {
  49186. observe(obj);
  49187. return obj
  49188. };
  49189. Vue.options = Object.create(null);
  49190. ASSET_TYPES.forEach(function (type) {
  49191. Vue.options[type + 's'] = Object.create(null);
  49192. });
  49193. // this is used to identify the "base" constructor to extend all plain-object
  49194. // components with in Weex's multi-instance scenarios.
  49195. Vue.options._base = Vue;
  49196. extend(Vue.options.components, builtInComponents);
  49197. initUse(Vue);
  49198. initMixin$1(Vue);
  49199. initExtend(Vue);
  49200. initAssetRegisters(Vue);
  49201. }
  49202. initGlobalAPI(Vue);
  49203. Object.defineProperty(Vue.prototype, '$isServer', {
  49204. get: isServerRendering
  49205. });
  49206. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49207. get: function get () {
  49208. /* istanbul ignore next */
  49209. return this.$vnode && this.$vnode.ssrContext
  49210. }
  49211. });
  49212. // expose FunctionalRenderContext for ssr runtime helper installation
  49213. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49214. value: FunctionalRenderContext
  49215. });
  49216. Vue.version = '2.6.11';
  49217. /* */
  49218. // these are reserved for web because they are directly compiled away
  49219. // during template compilation
  49220. var isReservedAttr = makeMap('style,class');
  49221. // attributes that should be using props for binding
  49222. var acceptValue = makeMap('input,textarea,option,select,progress');
  49223. var mustUseProp = function (tag, type, attr) {
  49224. return (
  49225. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49226. (attr === 'selected' && tag === 'option') ||
  49227. (attr === 'checked' && tag === 'input') ||
  49228. (attr === 'muted' && tag === 'video')
  49229. )
  49230. };
  49231. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49232. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49233. var convertEnumeratedValue = function (key, value) {
  49234. return isFalsyAttrValue(value) || value === 'false'
  49235. ? 'false'
  49236. // allow arbitrary string value for contenteditable
  49237. : key === 'contenteditable' && isValidContentEditableValue(value)
  49238. ? value
  49239. : 'true'
  49240. };
  49241. var isBooleanAttr = makeMap(
  49242. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49243. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49244. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49245. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49246. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49247. 'truespeed,typemustmatch,visible'
  49248. );
  49249. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49250. var isXlink = function (name) {
  49251. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49252. };
  49253. var getXlinkProp = function (name) {
  49254. return isXlink(name) ? name.slice(6, name.length) : ''
  49255. };
  49256. var isFalsyAttrValue = function (val) {
  49257. return val == null || val === false
  49258. };
  49259. /* */
  49260. function genClassForVnode (vnode) {
  49261. var data = vnode.data;
  49262. var parentNode = vnode;
  49263. var childNode = vnode;
  49264. while (isDef(childNode.componentInstance)) {
  49265. childNode = childNode.componentInstance._vnode;
  49266. if (childNode && childNode.data) {
  49267. data = mergeClassData(childNode.data, data);
  49268. }
  49269. }
  49270. while (isDef(parentNode = parentNode.parent)) {
  49271. if (parentNode && parentNode.data) {
  49272. data = mergeClassData(data, parentNode.data);
  49273. }
  49274. }
  49275. return renderClass(data.staticClass, data.class)
  49276. }
  49277. function mergeClassData (child, parent) {
  49278. return {
  49279. staticClass: concat(child.staticClass, parent.staticClass),
  49280. class: isDef(child.class)
  49281. ? [child.class, parent.class]
  49282. : parent.class
  49283. }
  49284. }
  49285. function renderClass (
  49286. staticClass,
  49287. dynamicClass
  49288. ) {
  49289. if (isDef(staticClass) || isDef(dynamicClass)) {
  49290. return concat(staticClass, stringifyClass(dynamicClass))
  49291. }
  49292. /* istanbul ignore next */
  49293. return ''
  49294. }
  49295. function concat (a, b) {
  49296. return a ? b ? (a + ' ' + b) : a : (b || '')
  49297. }
  49298. function stringifyClass (value) {
  49299. if (Array.isArray(value)) {
  49300. return stringifyArray(value)
  49301. }
  49302. if (isObject(value)) {
  49303. return stringifyObject(value)
  49304. }
  49305. if (typeof value === 'string') {
  49306. return value
  49307. }
  49308. /* istanbul ignore next */
  49309. return ''
  49310. }
  49311. function stringifyArray (value) {
  49312. var res = '';
  49313. var stringified;
  49314. for (var i = 0, l = value.length; i < l; i++) {
  49315. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49316. if (res) { res += ' '; }
  49317. res += stringified;
  49318. }
  49319. }
  49320. return res
  49321. }
  49322. function stringifyObject (value) {
  49323. var res = '';
  49324. for (var key in value) {
  49325. if (value[key]) {
  49326. if (res) { res += ' '; }
  49327. res += key;
  49328. }
  49329. }
  49330. return res
  49331. }
  49332. /* */
  49333. var namespaceMap = {
  49334. svg: 'http://www.w3.org/2000/svg',
  49335. math: 'http://www.w3.org/1998/Math/MathML'
  49336. };
  49337. var isHTMLTag = makeMap(
  49338. 'html,body,base,head,link,meta,style,title,' +
  49339. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49340. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49341. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49342. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49343. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49344. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49345. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49346. 'output,progress,select,textarea,' +
  49347. 'details,dialog,menu,menuitem,summary,' +
  49348. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49349. );
  49350. // this map is intentionally selective, only covering SVG elements that may
  49351. // contain child elements.
  49352. var isSVG = makeMap(
  49353. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49354. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49355. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49356. true
  49357. );
  49358. var isPreTag = function (tag) { return tag === 'pre'; };
  49359. var isReservedTag = function (tag) {
  49360. return isHTMLTag(tag) || isSVG(tag)
  49361. };
  49362. function getTagNamespace (tag) {
  49363. if (isSVG(tag)) {
  49364. return 'svg'
  49365. }
  49366. // basic support for MathML
  49367. // note it doesn't support other MathML elements being component roots
  49368. if (tag === 'math') {
  49369. return 'math'
  49370. }
  49371. }
  49372. var unknownElementCache = Object.create(null);
  49373. function isUnknownElement (tag) {
  49374. /* istanbul ignore if */
  49375. if (!inBrowser) {
  49376. return true
  49377. }
  49378. if (isReservedTag(tag)) {
  49379. return false
  49380. }
  49381. tag = tag.toLowerCase();
  49382. /* istanbul ignore if */
  49383. if (unknownElementCache[tag] != null) {
  49384. return unknownElementCache[tag]
  49385. }
  49386. var el = document.createElement(tag);
  49387. if (tag.indexOf('-') > -1) {
  49388. // http://stackoverflow.com/a/28210364/1070244
  49389. return (unknownElementCache[tag] = (
  49390. el.constructor === window.HTMLUnknownElement ||
  49391. el.constructor === window.HTMLElement
  49392. ))
  49393. } else {
  49394. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49395. }
  49396. }
  49397. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49398. /* */
  49399. /**
  49400. * Query an element selector if it's not an element already.
  49401. */
  49402. function query (el) {
  49403. if (typeof el === 'string') {
  49404. var selected = document.querySelector(el);
  49405. if (!selected) {
  49406. warn(
  49407. 'Cannot find element: ' + el
  49408. );
  49409. return document.createElement('div')
  49410. }
  49411. return selected
  49412. } else {
  49413. return el
  49414. }
  49415. }
  49416. /* */
  49417. function createElement$1 (tagName, vnode) {
  49418. var elm = document.createElement(tagName);
  49419. if (tagName !== 'select') {
  49420. return elm
  49421. }
  49422. // false or null will remove the attribute but undefined will not
  49423. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49424. elm.setAttribute('multiple', 'multiple');
  49425. }
  49426. return elm
  49427. }
  49428. function createElementNS (namespace, tagName) {
  49429. return document.createElementNS(namespaceMap[namespace], tagName)
  49430. }
  49431. function createTextNode (text) {
  49432. return document.createTextNode(text)
  49433. }
  49434. function createComment (text) {
  49435. return document.createComment(text)
  49436. }
  49437. function insertBefore (parentNode, newNode, referenceNode) {
  49438. parentNode.insertBefore(newNode, referenceNode);
  49439. }
  49440. function removeChild (node, child) {
  49441. node.removeChild(child);
  49442. }
  49443. function appendChild (node, child) {
  49444. node.appendChild(child);
  49445. }
  49446. function parentNode (node) {
  49447. return node.parentNode
  49448. }
  49449. function nextSibling (node) {
  49450. return node.nextSibling
  49451. }
  49452. function tagName (node) {
  49453. return node.tagName
  49454. }
  49455. function setTextContent (node, text) {
  49456. node.textContent = text;
  49457. }
  49458. function setStyleScope (node, scopeId) {
  49459. node.setAttribute(scopeId, '');
  49460. }
  49461. var nodeOps = /*#__PURE__*/Object.freeze({
  49462. createElement: createElement$1,
  49463. createElementNS: createElementNS,
  49464. createTextNode: createTextNode,
  49465. createComment: createComment,
  49466. insertBefore: insertBefore,
  49467. removeChild: removeChild,
  49468. appendChild: appendChild,
  49469. parentNode: parentNode,
  49470. nextSibling: nextSibling,
  49471. tagName: tagName,
  49472. setTextContent: setTextContent,
  49473. setStyleScope: setStyleScope
  49474. });
  49475. /* */
  49476. var ref = {
  49477. create: function create (_, vnode) {
  49478. registerRef(vnode);
  49479. },
  49480. update: function update (oldVnode, vnode) {
  49481. if (oldVnode.data.ref !== vnode.data.ref) {
  49482. registerRef(oldVnode, true);
  49483. registerRef(vnode);
  49484. }
  49485. },
  49486. destroy: function destroy (vnode) {
  49487. registerRef(vnode, true);
  49488. }
  49489. };
  49490. function registerRef (vnode, isRemoval) {
  49491. var key = vnode.data.ref;
  49492. if (!isDef(key)) { return }
  49493. var vm = vnode.context;
  49494. var ref = vnode.componentInstance || vnode.elm;
  49495. var refs = vm.$refs;
  49496. if (isRemoval) {
  49497. if (Array.isArray(refs[key])) {
  49498. remove(refs[key], ref);
  49499. } else if (refs[key] === ref) {
  49500. refs[key] = undefined;
  49501. }
  49502. } else {
  49503. if (vnode.data.refInFor) {
  49504. if (!Array.isArray(refs[key])) {
  49505. refs[key] = [ref];
  49506. } else if (refs[key].indexOf(ref) < 0) {
  49507. // $flow-disable-line
  49508. refs[key].push(ref);
  49509. }
  49510. } else {
  49511. refs[key] = ref;
  49512. }
  49513. }
  49514. }
  49515. /**
  49516. * Virtual DOM patching algorithm based on Snabbdom by
  49517. * Simon Friis Vindum (@paldepind)
  49518. * Licensed under the MIT License
  49519. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49520. *
  49521. * modified by Evan You (@yyx990803)
  49522. *
  49523. * Not type-checking this because this file is perf-critical and the cost
  49524. * of making flow understand it is not worth it.
  49525. */
  49526. var emptyNode = new VNode('', {}, []);
  49527. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49528. function sameVnode (a, b) {
  49529. return (
  49530. a.key === b.key && (
  49531. (
  49532. a.tag === b.tag &&
  49533. a.isComment === b.isComment &&
  49534. isDef(a.data) === isDef(b.data) &&
  49535. sameInputType(a, b)
  49536. ) || (
  49537. isTrue(a.isAsyncPlaceholder) &&
  49538. a.asyncFactory === b.asyncFactory &&
  49539. isUndef(b.asyncFactory.error)
  49540. )
  49541. )
  49542. )
  49543. }
  49544. function sameInputType (a, b) {
  49545. if (a.tag !== 'input') { return true }
  49546. var i;
  49547. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49548. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49549. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49550. }
  49551. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49552. var i, key;
  49553. var map = {};
  49554. for (i = beginIdx; i <= endIdx; ++i) {
  49555. key = children[i].key;
  49556. if (isDef(key)) { map[key] = i; }
  49557. }
  49558. return map
  49559. }
  49560. function createPatchFunction (backend) {
  49561. var i, j;
  49562. var cbs = {};
  49563. var modules = backend.modules;
  49564. var nodeOps = backend.nodeOps;
  49565. for (i = 0; i < hooks.length; ++i) {
  49566. cbs[hooks[i]] = [];
  49567. for (j = 0; j < modules.length; ++j) {
  49568. if (isDef(modules[j][hooks[i]])) {
  49569. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49570. }
  49571. }
  49572. }
  49573. function emptyNodeAt (elm) {
  49574. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49575. }
  49576. function createRmCb (childElm, listeners) {
  49577. function remove$$1 () {
  49578. if (--remove$$1.listeners === 0) {
  49579. removeNode(childElm);
  49580. }
  49581. }
  49582. remove$$1.listeners = listeners;
  49583. return remove$$1
  49584. }
  49585. function removeNode (el) {
  49586. var parent = nodeOps.parentNode(el);
  49587. // element may have already been removed due to v-html / v-text
  49588. if (isDef(parent)) {
  49589. nodeOps.removeChild(parent, el);
  49590. }
  49591. }
  49592. function isUnknownElement$$1 (vnode, inVPre) {
  49593. return (
  49594. !inVPre &&
  49595. !vnode.ns &&
  49596. !(
  49597. config.ignoredElements.length &&
  49598. config.ignoredElements.some(function (ignore) {
  49599. return isRegExp(ignore)
  49600. ? ignore.test(vnode.tag)
  49601. : ignore === vnode.tag
  49602. })
  49603. ) &&
  49604. config.isUnknownElement(vnode.tag)
  49605. )
  49606. }
  49607. var creatingElmInVPre = 0;
  49608. function createElm (
  49609. vnode,
  49610. insertedVnodeQueue,
  49611. parentElm,
  49612. refElm,
  49613. nested,
  49614. ownerArray,
  49615. index
  49616. ) {
  49617. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49618. // This vnode was used in a previous render!
  49619. // now it's used as a new node, overwriting its elm would cause
  49620. // potential patch errors down the road when it's used as an insertion
  49621. // reference node. Instead, we clone the node on-demand before creating
  49622. // associated DOM element for it.
  49623. vnode = ownerArray[index] = cloneVNode(vnode);
  49624. }
  49625. vnode.isRootInsert = !nested; // for transition enter check
  49626. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49627. return
  49628. }
  49629. var data = vnode.data;
  49630. var children = vnode.children;
  49631. var tag = vnode.tag;
  49632. if (isDef(tag)) {
  49633. {
  49634. if (data && data.pre) {
  49635. creatingElmInVPre++;
  49636. }
  49637. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49638. warn(
  49639. 'Unknown custom element: <' + tag + '> - did you ' +
  49640. 'register the component correctly? For recursive components, ' +
  49641. 'make sure to provide the "name" option.',
  49642. vnode.context
  49643. );
  49644. }
  49645. }
  49646. vnode.elm = vnode.ns
  49647. ? nodeOps.createElementNS(vnode.ns, tag)
  49648. : nodeOps.createElement(tag, vnode);
  49649. setScope(vnode);
  49650. /* istanbul ignore if */
  49651. {
  49652. createChildren(vnode, children, insertedVnodeQueue);
  49653. if (isDef(data)) {
  49654. invokeCreateHooks(vnode, insertedVnodeQueue);
  49655. }
  49656. insert(parentElm, vnode.elm, refElm);
  49657. }
  49658. if (data && data.pre) {
  49659. creatingElmInVPre--;
  49660. }
  49661. } else if (isTrue(vnode.isComment)) {
  49662. vnode.elm = nodeOps.createComment(vnode.text);
  49663. insert(parentElm, vnode.elm, refElm);
  49664. } else {
  49665. vnode.elm = nodeOps.createTextNode(vnode.text);
  49666. insert(parentElm, vnode.elm, refElm);
  49667. }
  49668. }
  49669. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49670. var i = vnode.data;
  49671. if (isDef(i)) {
  49672. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49673. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49674. i(vnode, false /* hydrating */);
  49675. }
  49676. // after calling the init hook, if the vnode is a child component
  49677. // it should've created a child instance and mounted it. the child
  49678. // component also has set the placeholder vnode's elm.
  49679. // in that case we can just return the element and be done.
  49680. if (isDef(vnode.componentInstance)) {
  49681. initComponent(vnode, insertedVnodeQueue);
  49682. insert(parentElm, vnode.elm, refElm);
  49683. if (isTrue(isReactivated)) {
  49684. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49685. }
  49686. return true
  49687. }
  49688. }
  49689. }
  49690. function initComponent (vnode, insertedVnodeQueue) {
  49691. if (isDef(vnode.data.pendingInsert)) {
  49692. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49693. vnode.data.pendingInsert = null;
  49694. }
  49695. vnode.elm = vnode.componentInstance.$el;
  49696. if (isPatchable(vnode)) {
  49697. invokeCreateHooks(vnode, insertedVnodeQueue);
  49698. setScope(vnode);
  49699. } else {
  49700. // empty component root.
  49701. // skip all element-related modules except for ref (#3455)
  49702. registerRef(vnode);
  49703. // make sure to invoke the insert hook
  49704. insertedVnodeQueue.push(vnode);
  49705. }
  49706. }
  49707. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49708. var i;
  49709. // hack for #4339: a reactivated component with inner transition
  49710. // does not trigger because the inner node's created hooks are not called
  49711. // again. It's not ideal to involve module-specific logic in here but
  49712. // there doesn't seem to be a better way to do it.
  49713. var innerNode = vnode;
  49714. while (innerNode.componentInstance) {
  49715. innerNode = innerNode.componentInstance._vnode;
  49716. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49717. for (i = 0; i < cbs.activate.length; ++i) {
  49718. cbs.activate[i](emptyNode, innerNode);
  49719. }
  49720. insertedVnodeQueue.push(innerNode);
  49721. break
  49722. }
  49723. }
  49724. // unlike a newly created component,
  49725. // a reactivated keep-alive component doesn't insert itself
  49726. insert(parentElm, vnode.elm, refElm);
  49727. }
  49728. function insert (parent, elm, ref$$1) {
  49729. if (isDef(parent)) {
  49730. if (isDef(ref$$1)) {
  49731. if (nodeOps.parentNode(ref$$1) === parent) {
  49732. nodeOps.insertBefore(parent, elm, ref$$1);
  49733. }
  49734. } else {
  49735. nodeOps.appendChild(parent, elm);
  49736. }
  49737. }
  49738. }
  49739. function createChildren (vnode, children, insertedVnodeQueue) {
  49740. if (Array.isArray(children)) {
  49741. {
  49742. checkDuplicateKeys(children);
  49743. }
  49744. for (var i = 0; i < children.length; ++i) {
  49745. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49746. }
  49747. } else if (isPrimitive(vnode.text)) {
  49748. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49749. }
  49750. }
  49751. function isPatchable (vnode) {
  49752. while (vnode.componentInstance) {
  49753. vnode = vnode.componentInstance._vnode;
  49754. }
  49755. return isDef(vnode.tag)
  49756. }
  49757. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49758. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49759. cbs.create[i$1](emptyNode, vnode);
  49760. }
  49761. i = vnode.data.hook; // Reuse variable
  49762. if (isDef(i)) {
  49763. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49764. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49765. }
  49766. }
  49767. // set scope id attribute for scoped CSS.
  49768. // this is implemented as a special case to avoid the overhead
  49769. // of going through the normal attribute patching process.
  49770. function setScope (vnode) {
  49771. var i;
  49772. if (isDef(i = vnode.fnScopeId)) {
  49773. nodeOps.setStyleScope(vnode.elm, i);
  49774. } else {
  49775. var ancestor = vnode;
  49776. while (ancestor) {
  49777. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  49778. nodeOps.setStyleScope(vnode.elm, i);
  49779. }
  49780. ancestor = ancestor.parent;
  49781. }
  49782. }
  49783. // for slot content they should also get the scopeId from the host instance.
  49784. if (isDef(i = activeInstance) &&
  49785. i !== vnode.context &&
  49786. i !== vnode.fnContext &&
  49787. isDef(i = i.$options._scopeId)
  49788. ) {
  49789. nodeOps.setStyleScope(vnode.elm, i);
  49790. }
  49791. }
  49792. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  49793. for (; startIdx <= endIdx; ++startIdx) {
  49794. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  49795. }
  49796. }
  49797. function invokeDestroyHook (vnode) {
  49798. var i, j;
  49799. var data = vnode.data;
  49800. if (isDef(data)) {
  49801. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  49802. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  49803. }
  49804. if (isDef(i = vnode.children)) {
  49805. for (j = 0; j < vnode.children.length; ++j) {
  49806. invokeDestroyHook(vnode.children[j]);
  49807. }
  49808. }
  49809. }
  49810. function removeVnodes (vnodes, startIdx, endIdx) {
  49811. for (; startIdx <= endIdx; ++startIdx) {
  49812. var ch = vnodes[startIdx];
  49813. if (isDef(ch)) {
  49814. if (isDef(ch.tag)) {
  49815. removeAndInvokeRemoveHook(ch);
  49816. invokeDestroyHook(ch);
  49817. } else { // Text node
  49818. removeNode(ch.elm);
  49819. }
  49820. }
  49821. }
  49822. }
  49823. function removeAndInvokeRemoveHook (vnode, rm) {
  49824. if (isDef(rm) || isDef(vnode.data)) {
  49825. var i;
  49826. var listeners = cbs.remove.length + 1;
  49827. if (isDef(rm)) {
  49828. // we have a recursively passed down rm callback
  49829. // increase the listeners count
  49830. rm.listeners += listeners;
  49831. } else {
  49832. // directly removing
  49833. rm = createRmCb(vnode.elm, listeners);
  49834. }
  49835. // recursively invoke hooks on child component root node
  49836. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  49837. removeAndInvokeRemoveHook(i, rm);
  49838. }
  49839. for (i = 0; i < cbs.remove.length; ++i) {
  49840. cbs.remove[i](vnode, rm);
  49841. }
  49842. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  49843. i(vnode, rm);
  49844. } else {
  49845. rm();
  49846. }
  49847. } else {
  49848. removeNode(vnode.elm);
  49849. }
  49850. }
  49851. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  49852. var oldStartIdx = 0;
  49853. var newStartIdx = 0;
  49854. var oldEndIdx = oldCh.length - 1;
  49855. var oldStartVnode = oldCh[0];
  49856. var oldEndVnode = oldCh[oldEndIdx];
  49857. var newEndIdx = newCh.length - 1;
  49858. var newStartVnode = newCh[0];
  49859. var newEndVnode = newCh[newEndIdx];
  49860. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  49861. // removeOnly is a special flag used only by <transition-group>
  49862. // to ensure removed elements stay in correct relative positions
  49863. // during leaving transitions
  49864. var canMove = !removeOnly;
  49865. {
  49866. checkDuplicateKeys(newCh);
  49867. }
  49868. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  49869. if (isUndef(oldStartVnode)) {
  49870. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  49871. } else if (isUndef(oldEndVnode)) {
  49872. oldEndVnode = oldCh[--oldEndIdx];
  49873. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  49874. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49875. oldStartVnode = oldCh[++oldStartIdx];
  49876. newStartVnode = newCh[++newStartIdx];
  49877. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  49878. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49879. oldEndVnode = oldCh[--oldEndIdx];
  49880. newEndVnode = newCh[--newEndIdx];
  49881. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  49882. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49883. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  49884. oldStartVnode = oldCh[++oldStartIdx];
  49885. newEndVnode = newCh[--newEndIdx];
  49886. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  49887. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49888. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  49889. oldEndVnode = oldCh[--oldEndIdx];
  49890. newStartVnode = newCh[++newStartIdx];
  49891. } else {
  49892. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  49893. idxInOld = isDef(newStartVnode.key)
  49894. ? oldKeyToIdx[newStartVnode.key]
  49895. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  49896. if (isUndef(idxInOld)) { // New element
  49897. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49898. } else {
  49899. vnodeToMove = oldCh[idxInOld];
  49900. if (sameVnode(vnodeToMove, newStartVnode)) {
  49901. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49902. oldCh[idxInOld] = undefined;
  49903. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  49904. } else {
  49905. // same key but different element. treat as new element
  49906. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49907. }
  49908. }
  49909. newStartVnode = newCh[++newStartIdx];
  49910. }
  49911. }
  49912. if (oldStartIdx > oldEndIdx) {
  49913. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  49914. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  49915. } else if (newStartIdx > newEndIdx) {
  49916. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  49917. }
  49918. }
  49919. function checkDuplicateKeys (children) {
  49920. var seenKeys = {};
  49921. for (var i = 0; i < children.length; i++) {
  49922. var vnode = children[i];
  49923. var key = vnode.key;
  49924. if (isDef(key)) {
  49925. if (seenKeys[key]) {
  49926. warn(
  49927. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  49928. vnode.context
  49929. );
  49930. } else {
  49931. seenKeys[key] = true;
  49932. }
  49933. }
  49934. }
  49935. }
  49936. function findIdxInOld (node, oldCh, start, end) {
  49937. for (var i = start; i < end; i++) {
  49938. var c = oldCh[i];
  49939. if (isDef(c) && sameVnode(node, c)) { return i }
  49940. }
  49941. }
  49942. function patchVnode (
  49943. oldVnode,
  49944. vnode,
  49945. insertedVnodeQueue,
  49946. ownerArray,
  49947. index,
  49948. removeOnly
  49949. ) {
  49950. if (oldVnode === vnode) {
  49951. return
  49952. }
  49953. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49954. // clone reused vnode
  49955. vnode = ownerArray[index] = cloneVNode(vnode);
  49956. }
  49957. var elm = vnode.elm = oldVnode.elm;
  49958. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  49959. if (isDef(vnode.asyncFactory.resolved)) {
  49960. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  49961. } else {
  49962. vnode.isAsyncPlaceholder = true;
  49963. }
  49964. return
  49965. }
  49966. // reuse element for static trees.
  49967. // note we only do this if the vnode is cloned -
  49968. // if the new node is not cloned it means the render functions have been
  49969. // reset by the hot-reload-api and we need to do a proper re-render.
  49970. if (isTrue(vnode.isStatic) &&
  49971. isTrue(oldVnode.isStatic) &&
  49972. vnode.key === oldVnode.key &&
  49973. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  49974. ) {
  49975. vnode.componentInstance = oldVnode.componentInstance;
  49976. return
  49977. }
  49978. var i;
  49979. var data = vnode.data;
  49980. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  49981. i(oldVnode, vnode);
  49982. }
  49983. var oldCh = oldVnode.children;
  49984. var ch = vnode.children;
  49985. if (isDef(data) && isPatchable(vnode)) {
  49986. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  49987. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  49988. }
  49989. if (isUndef(vnode.text)) {
  49990. if (isDef(oldCh) && isDef(ch)) {
  49991. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  49992. } else if (isDef(ch)) {
  49993. {
  49994. checkDuplicateKeys(ch);
  49995. }
  49996. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  49997. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  49998. } else if (isDef(oldCh)) {
  49999. removeVnodes(oldCh, 0, oldCh.length - 1);
  50000. } else if (isDef(oldVnode.text)) {
  50001. nodeOps.setTextContent(elm, '');
  50002. }
  50003. } else if (oldVnode.text !== vnode.text) {
  50004. nodeOps.setTextContent(elm, vnode.text);
  50005. }
  50006. if (isDef(data)) {
  50007. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50008. }
  50009. }
  50010. function invokeInsertHook (vnode, queue, initial) {
  50011. // delay insert hooks for component root nodes, invoke them after the
  50012. // element is really inserted
  50013. if (isTrue(initial) && isDef(vnode.parent)) {
  50014. vnode.parent.data.pendingInsert = queue;
  50015. } else {
  50016. for (var i = 0; i < queue.length; ++i) {
  50017. queue[i].data.hook.insert(queue[i]);
  50018. }
  50019. }
  50020. }
  50021. var hydrationBailed = false;
  50022. // list of modules that can skip create hook during hydration because they
  50023. // are already rendered on the client or has no need for initialization
  50024. // Note: style is excluded because it relies on initial clone for future
  50025. // deep updates (#7063).
  50026. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50027. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50028. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50029. var i;
  50030. var tag = vnode.tag;
  50031. var data = vnode.data;
  50032. var children = vnode.children;
  50033. inVPre = inVPre || (data && data.pre);
  50034. vnode.elm = elm;
  50035. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50036. vnode.isAsyncPlaceholder = true;
  50037. return true
  50038. }
  50039. // assert node match
  50040. {
  50041. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50042. return false
  50043. }
  50044. }
  50045. if (isDef(data)) {
  50046. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50047. if (isDef(i = vnode.componentInstance)) {
  50048. // child component. it should have hydrated its own tree.
  50049. initComponent(vnode, insertedVnodeQueue);
  50050. return true
  50051. }
  50052. }
  50053. if (isDef(tag)) {
  50054. if (isDef(children)) {
  50055. // empty element, allow client to pick up and populate children
  50056. if (!elm.hasChildNodes()) {
  50057. createChildren(vnode, children, insertedVnodeQueue);
  50058. } else {
  50059. // v-html and domProps: innerHTML
  50060. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50061. if (i !== elm.innerHTML) {
  50062. /* istanbul ignore if */
  50063. if (typeof console !== 'undefined' &&
  50064. !hydrationBailed
  50065. ) {
  50066. hydrationBailed = true;
  50067. console.warn('Parent: ', elm);
  50068. console.warn('server innerHTML: ', i);
  50069. console.warn('client innerHTML: ', elm.innerHTML);
  50070. }
  50071. return false
  50072. }
  50073. } else {
  50074. // iterate and compare children lists
  50075. var childrenMatch = true;
  50076. var childNode = elm.firstChild;
  50077. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50078. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50079. childrenMatch = false;
  50080. break
  50081. }
  50082. childNode = childNode.nextSibling;
  50083. }
  50084. // if childNode is not null, it means the actual childNodes list is
  50085. // longer than the virtual children list.
  50086. if (!childrenMatch || childNode) {
  50087. /* istanbul ignore if */
  50088. if (typeof console !== 'undefined' &&
  50089. !hydrationBailed
  50090. ) {
  50091. hydrationBailed = true;
  50092. console.warn('Parent: ', elm);
  50093. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50094. }
  50095. return false
  50096. }
  50097. }
  50098. }
  50099. }
  50100. if (isDef(data)) {
  50101. var fullInvoke = false;
  50102. for (var key in data) {
  50103. if (!isRenderedModule(key)) {
  50104. fullInvoke = true;
  50105. invokeCreateHooks(vnode, insertedVnodeQueue);
  50106. break
  50107. }
  50108. }
  50109. if (!fullInvoke && data['class']) {
  50110. // ensure collecting deps for deep class bindings for future updates
  50111. traverse(data['class']);
  50112. }
  50113. }
  50114. } else if (elm.data !== vnode.text) {
  50115. elm.data = vnode.text;
  50116. }
  50117. return true
  50118. }
  50119. function assertNodeMatch (node, vnode, inVPre) {
  50120. if (isDef(vnode.tag)) {
  50121. return vnode.tag.indexOf('vue-component') === 0 || (
  50122. !isUnknownElement$$1(vnode, inVPre) &&
  50123. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50124. )
  50125. } else {
  50126. return node.nodeType === (vnode.isComment ? 8 : 3)
  50127. }
  50128. }
  50129. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50130. if (isUndef(vnode)) {
  50131. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50132. return
  50133. }
  50134. var isInitialPatch = false;
  50135. var insertedVnodeQueue = [];
  50136. if (isUndef(oldVnode)) {
  50137. // empty mount (likely as component), create new root element
  50138. isInitialPatch = true;
  50139. createElm(vnode, insertedVnodeQueue);
  50140. } else {
  50141. var isRealElement = isDef(oldVnode.nodeType);
  50142. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50143. // patch existing root node
  50144. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50145. } else {
  50146. if (isRealElement) {
  50147. // mounting to a real element
  50148. // check if this is server-rendered content and if we can perform
  50149. // a successful hydration.
  50150. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50151. oldVnode.removeAttribute(SSR_ATTR);
  50152. hydrating = true;
  50153. }
  50154. if (isTrue(hydrating)) {
  50155. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50156. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50157. return oldVnode
  50158. } else {
  50159. warn(
  50160. 'The client-side rendered virtual DOM tree is not matching ' +
  50161. 'server-rendered content. This is likely caused by incorrect ' +
  50162. 'HTML markup, for example nesting block-level elements inside ' +
  50163. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50164. 'full client-side render.'
  50165. );
  50166. }
  50167. }
  50168. // either not server-rendered, or hydration failed.
  50169. // create an empty node and replace it
  50170. oldVnode = emptyNodeAt(oldVnode);
  50171. }
  50172. // replacing existing element
  50173. var oldElm = oldVnode.elm;
  50174. var parentElm = nodeOps.parentNode(oldElm);
  50175. // create new node
  50176. createElm(
  50177. vnode,
  50178. insertedVnodeQueue,
  50179. // extremely rare edge case: do not insert if old element is in a
  50180. // leaving transition. Only happens when combining transition +
  50181. // keep-alive + HOCs. (#4590)
  50182. oldElm._leaveCb ? null : parentElm,
  50183. nodeOps.nextSibling(oldElm)
  50184. );
  50185. // update parent placeholder node element, recursively
  50186. if (isDef(vnode.parent)) {
  50187. var ancestor = vnode.parent;
  50188. var patchable = isPatchable(vnode);
  50189. while (ancestor) {
  50190. for (var i = 0; i < cbs.destroy.length; ++i) {
  50191. cbs.destroy[i](ancestor);
  50192. }
  50193. ancestor.elm = vnode.elm;
  50194. if (patchable) {
  50195. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50196. cbs.create[i$1](emptyNode, ancestor);
  50197. }
  50198. // #6513
  50199. // invoke insert hooks that may have been merged by create hooks.
  50200. // e.g. for directives that uses the "inserted" hook.
  50201. var insert = ancestor.data.hook.insert;
  50202. if (insert.merged) {
  50203. // start at index 1 to avoid re-invoking component mounted hook
  50204. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50205. insert.fns[i$2]();
  50206. }
  50207. }
  50208. } else {
  50209. registerRef(ancestor);
  50210. }
  50211. ancestor = ancestor.parent;
  50212. }
  50213. }
  50214. // destroy old node
  50215. if (isDef(parentElm)) {
  50216. removeVnodes([oldVnode], 0, 0);
  50217. } else if (isDef(oldVnode.tag)) {
  50218. invokeDestroyHook(oldVnode);
  50219. }
  50220. }
  50221. }
  50222. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50223. return vnode.elm
  50224. }
  50225. }
  50226. /* */
  50227. var directives = {
  50228. create: updateDirectives,
  50229. update: updateDirectives,
  50230. destroy: function unbindDirectives (vnode) {
  50231. updateDirectives(vnode, emptyNode);
  50232. }
  50233. };
  50234. function updateDirectives (oldVnode, vnode) {
  50235. if (oldVnode.data.directives || vnode.data.directives) {
  50236. _update(oldVnode, vnode);
  50237. }
  50238. }
  50239. function _update (oldVnode, vnode) {
  50240. var isCreate = oldVnode === emptyNode;
  50241. var isDestroy = vnode === emptyNode;
  50242. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50243. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50244. var dirsWithInsert = [];
  50245. var dirsWithPostpatch = [];
  50246. var key, oldDir, dir;
  50247. for (key in newDirs) {
  50248. oldDir = oldDirs[key];
  50249. dir = newDirs[key];
  50250. if (!oldDir) {
  50251. // new directive, bind
  50252. callHook$1(dir, 'bind', vnode, oldVnode);
  50253. if (dir.def && dir.def.inserted) {
  50254. dirsWithInsert.push(dir);
  50255. }
  50256. } else {
  50257. // existing directive, update
  50258. dir.oldValue = oldDir.value;
  50259. dir.oldArg = oldDir.arg;
  50260. callHook$1(dir, 'update', vnode, oldVnode);
  50261. if (dir.def && dir.def.componentUpdated) {
  50262. dirsWithPostpatch.push(dir);
  50263. }
  50264. }
  50265. }
  50266. if (dirsWithInsert.length) {
  50267. var callInsert = function () {
  50268. for (var i = 0; i < dirsWithInsert.length; i++) {
  50269. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50270. }
  50271. };
  50272. if (isCreate) {
  50273. mergeVNodeHook(vnode, 'insert', callInsert);
  50274. } else {
  50275. callInsert();
  50276. }
  50277. }
  50278. if (dirsWithPostpatch.length) {
  50279. mergeVNodeHook(vnode, 'postpatch', function () {
  50280. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50281. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50282. }
  50283. });
  50284. }
  50285. if (!isCreate) {
  50286. for (key in oldDirs) {
  50287. if (!newDirs[key]) {
  50288. // no longer present, unbind
  50289. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50290. }
  50291. }
  50292. }
  50293. }
  50294. var emptyModifiers = Object.create(null);
  50295. function normalizeDirectives$1 (
  50296. dirs,
  50297. vm
  50298. ) {
  50299. var res = Object.create(null);
  50300. if (!dirs) {
  50301. // $flow-disable-line
  50302. return res
  50303. }
  50304. var i, dir;
  50305. for (i = 0; i < dirs.length; i++) {
  50306. dir = dirs[i];
  50307. if (!dir.modifiers) {
  50308. // $flow-disable-line
  50309. dir.modifiers = emptyModifiers;
  50310. }
  50311. res[getRawDirName(dir)] = dir;
  50312. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50313. }
  50314. // $flow-disable-line
  50315. return res
  50316. }
  50317. function getRawDirName (dir) {
  50318. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50319. }
  50320. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50321. var fn = dir.def && dir.def[hook];
  50322. if (fn) {
  50323. try {
  50324. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50325. } catch (e) {
  50326. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50327. }
  50328. }
  50329. }
  50330. var baseModules = [
  50331. ref,
  50332. directives
  50333. ];
  50334. /* */
  50335. function updateAttrs (oldVnode, vnode) {
  50336. var opts = vnode.componentOptions;
  50337. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50338. return
  50339. }
  50340. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50341. return
  50342. }
  50343. var key, cur, old;
  50344. var elm = vnode.elm;
  50345. var oldAttrs = oldVnode.data.attrs || {};
  50346. var attrs = vnode.data.attrs || {};
  50347. // clone observed objects, as the user probably wants to mutate it
  50348. if (isDef(attrs.__ob__)) {
  50349. attrs = vnode.data.attrs = extend({}, attrs);
  50350. }
  50351. for (key in attrs) {
  50352. cur = attrs[key];
  50353. old = oldAttrs[key];
  50354. if (old !== cur) {
  50355. setAttr(elm, key, cur);
  50356. }
  50357. }
  50358. // #4391: in IE9, setting type can reset value for input[type=radio]
  50359. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50360. /* istanbul ignore if */
  50361. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50362. setAttr(elm, 'value', attrs.value);
  50363. }
  50364. for (key in oldAttrs) {
  50365. if (isUndef(attrs[key])) {
  50366. if (isXlink(key)) {
  50367. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50368. } else if (!isEnumeratedAttr(key)) {
  50369. elm.removeAttribute(key);
  50370. }
  50371. }
  50372. }
  50373. }
  50374. function setAttr (el, key, value) {
  50375. if (el.tagName.indexOf('-') > -1) {
  50376. baseSetAttr(el, key, value);
  50377. } else if (isBooleanAttr(key)) {
  50378. // set attribute for blank value
  50379. // e.g. <option disabled>Select one</option>
  50380. if (isFalsyAttrValue(value)) {
  50381. el.removeAttribute(key);
  50382. } else {
  50383. // technically allowfullscreen is a boolean attribute for <iframe>,
  50384. // but Flash expects a value of "true" when used on <embed> tag
  50385. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50386. ? 'true'
  50387. : key;
  50388. el.setAttribute(key, value);
  50389. }
  50390. } else if (isEnumeratedAttr(key)) {
  50391. el.setAttribute(key, convertEnumeratedValue(key, value));
  50392. } else if (isXlink(key)) {
  50393. if (isFalsyAttrValue(value)) {
  50394. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50395. } else {
  50396. el.setAttributeNS(xlinkNS, key, value);
  50397. }
  50398. } else {
  50399. baseSetAttr(el, key, value);
  50400. }
  50401. }
  50402. function baseSetAttr (el, key, value) {
  50403. if (isFalsyAttrValue(value)) {
  50404. el.removeAttribute(key);
  50405. } else {
  50406. // #7138: IE10 & 11 fires input event when setting placeholder on
  50407. // <textarea>... block the first input event and remove the blocker
  50408. // immediately.
  50409. /* istanbul ignore if */
  50410. if (
  50411. isIE && !isIE9 &&
  50412. el.tagName === 'TEXTAREA' &&
  50413. key === 'placeholder' && value !== '' && !el.__ieph
  50414. ) {
  50415. var blocker = function (e) {
  50416. e.stopImmediatePropagation();
  50417. el.removeEventListener('input', blocker);
  50418. };
  50419. el.addEventListener('input', blocker);
  50420. // $flow-disable-line
  50421. el.__ieph = true; /* IE placeholder patched */
  50422. }
  50423. el.setAttribute(key, value);
  50424. }
  50425. }
  50426. var attrs = {
  50427. create: updateAttrs,
  50428. update: updateAttrs
  50429. };
  50430. /* */
  50431. function updateClass (oldVnode, vnode) {
  50432. var el = vnode.elm;
  50433. var data = vnode.data;
  50434. var oldData = oldVnode.data;
  50435. if (
  50436. isUndef(data.staticClass) &&
  50437. isUndef(data.class) && (
  50438. isUndef(oldData) || (
  50439. isUndef(oldData.staticClass) &&
  50440. isUndef(oldData.class)
  50441. )
  50442. )
  50443. ) {
  50444. return
  50445. }
  50446. var cls = genClassForVnode(vnode);
  50447. // handle transition classes
  50448. var transitionClass = el._transitionClasses;
  50449. if (isDef(transitionClass)) {
  50450. cls = concat(cls, stringifyClass(transitionClass));
  50451. }
  50452. // set the class
  50453. if (cls !== el._prevClass) {
  50454. el.setAttribute('class', cls);
  50455. el._prevClass = cls;
  50456. }
  50457. }
  50458. var klass = {
  50459. create: updateClass,
  50460. update: updateClass
  50461. };
  50462. /* */
  50463. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50464. function parseFilters (exp) {
  50465. var inSingle = false;
  50466. var inDouble = false;
  50467. var inTemplateString = false;
  50468. var inRegex = false;
  50469. var curly = 0;
  50470. var square = 0;
  50471. var paren = 0;
  50472. var lastFilterIndex = 0;
  50473. var c, prev, i, expression, filters;
  50474. for (i = 0; i < exp.length; i++) {
  50475. prev = c;
  50476. c = exp.charCodeAt(i);
  50477. if (inSingle) {
  50478. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50479. } else if (inDouble) {
  50480. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50481. } else if (inTemplateString) {
  50482. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50483. } else if (inRegex) {
  50484. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50485. } else if (
  50486. c === 0x7C && // pipe
  50487. exp.charCodeAt(i + 1) !== 0x7C &&
  50488. exp.charCodeAt(i - 1) !== 0x7C &&
  50489. !curly && !square && !paren
  50490. ) {
  50491. if (expression === undefined) {
  50492. // first filter, end of expression
  50493. lastFilterIndex = i + 1;
  50494. expression = exp.slice(0, i).trim();
  50495. } else {
  50496. pushFilter();
  50497. }
  50498. } else {
  50499. switch (c) {
  50500. case 0x22: inDouble = true; break // "
  50501. case 0x27: inSingle = true; break // '
  50502. case 0x60: inTemplateString = true; break // `
  50503. case 0x28: paren++; break // (
  50504. case 0x29: paren--; break // )
  50505. case 0x5B: square++; break // [
  50506. case 0x5D: square--; break // ]
  50507. case 0x7B: curly++; break // {
  50508. case 0x7D: curly--; break // }
  50509. }
  50510. if (c === 0x2f) { // /
  50511. var j = i - 1;
  50512. var p = (void 0);
  50513. // find first non-whitespace prev char
  50514. for (; j >= 0; j--) {
  50515. p = exp.charAt(j);
  50516. if (p !== ' ') { break }
  50517. }
  50518. if (!p || !validDivisionCharRE.test(p)) {
  50519. inRegex = true;
  50520. }
  50521. }
  50522. }
  50523. }
  50524. if (expression === undefined) {
  50525. expression = exp.slice(0, i).trim();
  50526. } else if (lastFilterIndex !== 0) {
  50527. pushFilter();
  50528. }
  50529. function pushFilter () {
  50530. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50531. lastFilterIndex = i + 1;
  50532. }
  50533. if (filters) {
  50534. for (i = 0; i < filters.length; i++) {
  50535. expression = wrapFilter(expression, filters[i]);
  50536. }
  50537. }
  50538. return expression
  50539. }
  50540. function wrapFilter (exp, filter) {
  50541. var i = filter.indexOf('(');
  50542. if (i < 0) {
  50543. // _f: resolveFilter
  50544. return ("_f(\"" + filter + "\")(" + exp + ")")
  50545. } else {
  50546. var name = filter.slice(0, i);
  50547. var args = filter.slice(i + 1);
  50548. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50549. }
  50550. }
  50551. /* */
  50552. /* eslint-disable no-unused-vars */
  50553. function baseWarn (msg, range) {
  50554. console.error(("[Vue compiler]: " + msg));
  50555. }
  50556. /* eslint-enable no-unused-vars */
  50557. function pluckModuleFunction (
  50558. modules,
  50559. key
  50560. ) {
  50561. return modules
  50562. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50563. : []
  50564. }
  50565. function addProp (el, name, value, range, dynamic) {
  50566. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50567. el.plain = false;
  50568. }
  50569. function addAttr (el, name, value, range, dynamic) {
  50570. var attrs = dynamic
  50571. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50572. : (el.attrs || (el.attrs = []));
  50573. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50574. el.plain = false;
  50575. }
  50576. // add a raw attr (use this in preTransforms)
  50577. function addRawAttr (el, name, value, range) {
  50578. el.attrsMap[name] = value;
  50579. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50580. }
  50581. function addDirective (
  50582. el,
  50583. name,
  50584. rawName,
  50585. value,
  50586. arg,
  50587. isDynamicArg,
  50588. modifiers,
  50589. range
  50590. ) {
  50591. (el.directives || (el.directives = [])).push(rangeSetItem({
  50592. name: name,
  50593. rawName: rawName,
  50594. value: value,
  50595. arg: arg,
  50596. isDynamicArg: isDynamicArg,
  50597. modifiers: modifiers
  50598. }, range));
  50599. el.plain = false;
  50600. }
  50601. function prependModifierMarker (symbol, name, dynamic) {
  50602. return dynamic
  50603. ? ("_p(" + name + ",\"" + symbol + "\")")
  50604. : symbol + name // mark the event as captured
  50605. }
  50606. function addHandler (
  50607. el,
  50608. name,
  50609. value,
  50610. modifiers,
  50611. important,
  50612. warn,
  50613. range,
  50614. dynamic
  50615. ) {
  50616. modifiers = modifiers || emptyObject;
  50617. // warn prevent and passive modifier
  50618. /* istanbul ignore if */
  50619. if (
  50620. warn &&
  50621. modifiers.prevent && modifiers.passive
  50622. ) {
  50623. warn(
  50624. 'passive and prevent can\'t be used together. ' +
  50625. 'Passive handler can\'t prevent default event.',
  50626. range
  50627. );
  50628. }
  50629. // normalize click.right and click.middle since they don't actually fire
  50630. // this is technically browser-specific, but at least for now browsers are
  50631. // the only target envs that have right/middle clicks.
  50632. if (modifiers.right) {
  50633. if (dynamic) {
  50634. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50635. } else if (name === 'click') {
  50636. name = 'contextmenu';
  50637. delete modifiers.right;
  50638. }
  50639. } else if (modifiers.middle) {
  50640. if (dynamic) {
  50641. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50642. } else if (name === 'click') {
  50643. name = 'mouseup';
  50644. }
  50645. }
  50646. // check capture modifier
  50647. if (modifiers.capture) {
  50648. delete modifiers.capture;
  50649. name = prependModifierMarker('!', name, dynamic);
  50650. }
  50651. if (modifiers.once) {
  50652. delete modifiers.once;
  50653. name = prependModifierMarker('~', name, dynamic);
  50654. }
  50655. /* istanbul ignore if */
  50656. if (modifiers.passive) {
  50657. delete modifiers.passive;
  50658. name = prependModifierMarker('&', name, dynamic);
  50659. }
  50660. var events;
  50661. if (modifiers.native) {
  50662. delete modifiers.native;
  50663. events = el.nativeEvents || (el.nativeEvents = {});
  50664. } else {
  50665. events = el.events || (el.events = {});
  50666. }
  50667. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50668. if (modifiers !== emptyObject) {
  50669. newHandler.modifiers = modifiers;
  50670. }
  50671. var handlers = events[name];
  50672. /* istanbul ignore if */
  50673. if (Array.isArray(handlers)) {
  50674. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50675. } else if (handlers) {
  50676. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50677. } else {
  50678. events[name] = newHandler;
  50679. }
  50680. el.plain = false;
  50681. }
  50682. function getRawBindingAttr (
  50683. el,
  50684. name
  50685. ) {
  50686. return el.rawAttrsMap[':' + name] ||
  50687. el.rawAttrsMap['v-bind:' + name] ||
  50688. el.rawAttrsMap[name]
  50689. }
  50690. function getBindingAttr (
  50691. el,
  50692. name,
  50693. getStatic
  50694. ) {
  50695. var dynamicValue =
  50696. getAndRemoveAttr(el, ':' + name) ||
  50697. getAndRemoveAttr(el, 'v-bind:' + name);
  50698. if (dynamicValue != null) {
  50699. return parseFilters(dynamicValue)
  50700. } else if (getStatic !== false) {
  50701. var staticValue = getAndRemoveAttr(el, name);
  50702. if (staticValue != null) {
  50703. return JSON.stringify(staticValue)
  50704. }
  50705. }
  50706. }
  50707. // note: this only removes the attr from the Array (attrsList) so that it
  50708. // doesn't get processed by processAttrs.
  50709. // By default it does NOT remove it from the map (attrsMap) because the map is
  50710. // needed during codegen.
  50711. function getAndRemoveAttr (
  50712. el,
  50713. name,
  50714. removeFromMap
  50715. ) {
  50716. var val;
  50717. if ((val = el.attrsMap[name]) != null) {
  50718. var list = el.attrsList;
  50719. for (var i = 0, l = list.length; i < l; i++) {
  50720. if (list[i].name === name) {
  50721. list.splice(i, 1);
  50722. break
  50723. }
  50724. }
  50725. }
  50726. if (removeFromMap) {
  50727. delete el.attrsMap[name];
  50728. }
  50729. return val
  50730. }
  50731. function getAndRemoveAttrByRegex (
  50732. el,
  50733. name
  50734. ) {
  50735. var list = el.attrsList;
  50736. for (var i = 0, l = list.length; i < l; i++) {
  50737. var attr = list[i];
  50738. if (name.test(attr.name)) {
  50739. list.splice(i, 1);
  50740. return attr
  50741. }
  50742. }
  50743. }
  50744. function rangeSetItem (
  50745. item,
  50746. range
  50747. ) {
  50748. if (range) {
  50749. if (range.start != null) {
  50750. item.start = range.start;
  50751. }
  50752. if (range.end != null) {
  50753. item.end = range.end;
  50754. }
  50755. }
  50756. return item
  50757. }
  50758. /* */
  50759. /**
  50760. * Cross-platform code generation for component v-model
  50761. */
  50762. function genComponentModel (
  50763. el,
  50764. value,
  50765. modifiers
  50766. ) {
  50767. var ref = modifiers || {};
  50768. var number = ref.number;
  50769. var trim = ref.trim;
  50770. var baseValueExpression = '$$v';
  50771. var valueExpression = baseValueExpression;
  50772. if (trim) {
  50773. valueExpression =
  50774. "(typeof " + baseValueExpression + " === 'string'" +
  50775. "? " + baseValueExpression + ".trim()" +
  50776. ": " + baseValueExpression + ")";
  50777. }
  50778. if (number) {
  50779. valueExpression = "_n(" + valueExpression + ")";
  50780. }
  50781. var assignment = genAssignmentCode(value, valueExpression);
  50782. el.model = {
  50783. value: ("(" + value + ")"),
  50784. expression: JSON.stringify(value),
  50785. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  50786. };
  50787. }
  50788. /**
  50789. * Cross-platform codegen helper for generating v-model value assignment code.
  50790. */
  50791. function genAssignmentCode (
  50792. value,
  50793. assignment
  50794. ) {
  50795. var res = parseModel(value);
  50796. if (res.key === null) {
  50797. return (value + "=" + assignment)
  50798. } else {
  50799. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  50800. }
  50801. }
  50802. /**
  50803. * Parse a v-model expression into a base path and a final key segment.
  50804. * Handles both dot-path and possible square brackets.
  50805. *
  50806. * Possible cases:
  50807. *
  50808. * - test
  50809. * - test[key]
  50810. * - test[test1[key]]
  50811. * - test["a"][key]
  50812. * - xxx.test[a[a].test1[key]]
  50813. * - test.xxx.a["asa"][test1[key]]
  50814. *
  50815. */
  50816. var len, str, chr, index$1, expressionPos, expressionEndPos;
  50817. function parseModel (val) {
  50818. // Fix https://github.com/vuejs/vue/pull/7730
  50819. // allow v-model="obj.val " (trailing whitespace)
  50820. val = val.trim();
  50821. len = val.length;
  50822. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  50823. index$1 = val.lastIndexOf('.');
  50824. if (index$1 > -1) {
  50825. return {
  50826. exp: val.slice(0, index$1),
  50827. key: '"' + val.slice(index$1 + 1) + '"'
  50828. }
  50829. } else {
  50830. return {
  50831. exp: val,
  50832. key: null
  50833. }
  50834. }
  50835. }
  50836. str = val;
  50837. index$1 = expressionPos = expressionEndPos = 0;
  50838. while (!eof()) {
  50839. chr = next();
  50840. /* istanbul ignore if */
  50841. if (isStringStart(chr)) {
  50842. parseString(chr);
  50843. } else if (chr === 0x5B) {
  50844. parseBracket(chr);
  50845. }
  50846. }
  50847. return {
  50848. exp: val.slice(0, expressionPos),
  50849. key: val.slice(expressionPos + 1, expressionEndPos)
  50850. }
  50851. }
  50852. function next () {
  50853. return str.charCodeAt(++index$1)
  50854. }
  50855. function eof () {
  50856. return index$1 >= len
  50857. }
  50858. function isStringStart (chr) {
  50859. return chr === 0x22 || chr === 0x27
  50860. }
  50861. function parseBracket (chr) {
  50862. var inBracket = 1;
  50863. expressionPos = index$1;
  50864. while (!eof()) {
  50865. chr = next();
  50866. if (isStringStart(chr)) {
  50867. parseString(chr);
  50868. continue
  50869. }
  50870. if (chr === 0x5B) { inBracket++; }
  50871. if (chr === 0x5D) { inBracket--; }
  50872. if (inBracket === 0) {
  50873. expressionEndPos = index$1;
  50874. break
  50875. }
  50876. }
  50877. }
  50878. function parseString (chr) {
  50879. var stringQuote = chr;
  50880. while (!eof()) {
  50881. chr = next();
  50882. if (chr === stringQuote) {
  50883. break
  50884. }
  50885. }
  50886. }
  50887. /* */
  50888. var warn$1;
  50889. // in some cases, the event used has to be determined at runtime
  50890. // so we used some reserved tokens during compile.
  50891. var RANGE_TOKEN = '__r';
  50892. var CHECKBOX_RADIO_TOKEN = '__c';
  50893. function model (
  50894. el,
  50895. dir,
  50896. _warn
  50897. ) {
  50898. warn$1 = _warn;
  50899. var value = dir.value;
  50900. var modifiers = dir.modifiers;
  50901. var tag = el.tag;
  50902. var type = el.attrsMap.type;
  50903. {
  50904. // inputs with type="file" are read only and setting the input's
  50905. // value will throw an error.
  50906. if (tag === 'input' && type === 'file') {
  50907. warn$1(
  50908. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  50909. "File inputs are read only. Use a v-on:change listener instead.",
  50910. el.rawAttrsMap['v-model']
  50911. );
  50912. }
  50913. }
  50914. if (el.component) {
  50915. genComponentModel(el, value, modifiers);
  50916. // component v-model doesn't need extra runtime
  50917. return false
  50918. } else if (tag === 'select') {
  50919. genSelect(el, value, modifiers);
  50920. } else if (tag === 'input' && type === 'checkbox') {
  50921. genCheckboxModel(el, value, modifiers);
  50922. } else if (tag === 'input' && type === 'radio') {
  50923. genRadioModel(el, value, modifiers);
  50924. } else if (tag === 'input' || tag === 'textarea') {
  50925. genDefaultModel(el, value, modifiers);
  50926. } else if (!config.isReservedTag(tag)) {
  50927. genComponentModel(el, value, modifiers);
  50928. // component v-model doesn't need extra runtime
  50929. return false
  50930. } else {
  50931. warn$1(
  50932. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  50933. "v-model is not supported on this element type. " +
  50934. 'If you are working with contenteditable, it\'s recommended to ' +
  50935. 'wrap a library dedicated for that purpose inside a custom component.',
  50936. el.rawAttrsMap['v-model']
  50937. );
  50938. }
  50939. // ensure runtime directive metadata
  50940. return true
  50941. }
  50942. function genCheckboxModel (
  50943. el,
  50944. value,
  50945. modifiers
  50946. ) {
  50947. var number = modifiers && modifiers.number;
  50948. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50949. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  50950. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  50951. addProp(el, 'checked',
  50952. "Array.isArray(" + value + ")" +
  50953. "?_i(" + value + "," + valueBinding + ")>-1" + (
  50954. trueValueBinding === 'true'
  50955. ? (":(" + value + ")")
  50956. : (":_q(" + value + "," + trueValueBinding + ")")
  50957. )
  50958. );
  50959. addHandler(el, 'change',
  50960. "var $$a=" + value + "," +
  50961. '$$el=$event.target,' +
  50962. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  50963. 'if(Array.isArray($$a)){' +
  50964. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  50965. '$$i=_i($$a,$$v);' +
  50966. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  50967. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  50968. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  50969. null, true
  50970. );
  50971. }
  50972. function genRadioModel (
  50973. el,
  50974. value,
  50975. modifiers
  50976. ) {
  50977. var number = modifiers && modifiers.number;
  50978. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50979. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  50980. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  50981. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  50982. }
  50983. function genSelect (
  50984. el,
  50985. value,
  50986. modifiers
  50987. ) {
  50988. var number = modifiers && modifiers.number;
  50989. var selectedVal = "Array.prototype.filter" +
  50990. ".call($event.target.options,function(o){return o.selected})" +
  50991. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  50992. "return " + (number ? '_n(val)' : 'val') + "})";
  50993. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  50994. var code = "var $$selectedVal = " + selectedVal + ";";
  50995. code = code + " " + (genAssignmentCode(value, assignment));
  50996. addHandler(el, 'change', code, null, true);
  50997. }
  50998. function genDefaultModel (
  50999. el,
  51000. value,
  51001. modifiers
  51002. ) {
  51003. var type = el.attrsMap.type;
  51004. // warn if v-bind:value conflicts with v-model
  51005. // except for inputs with v-bind:type
  51006. {
  51007. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51008. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51009. if (value$1 && !typeBinding) {
  51010. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51011. warn$1(
  51012. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51013. 'because the latter already expands to a value binding internally',
  51014. el.rawAttrsMap[binding]
  51015. );
  51016. }
  51017. }
  51018. var ref = modifiers || {};
  51019. var lazy = ref.lazy;
  51020. var number = ref.number;
  51021. var trim = ref.trim;
  51022. var needCompositionGuard = !lazy && type !== 'range';
  51023. var event = lazy
  51024. ? 'change'
  51025. : type === 'range'
  51026. ? RANGE_TOKEN
  51027. : 'input';
  51028. var valueExpression = '$event.target.value';
  51029. if (trim) {
  51030. valueExpression = "$event.target.value.trim()";
  51031. }
  51032. if (number) {
  51033. valueExpression = "_n(" + valueExpression + ")";
  51034. }
  51035. var code = genAssignmentCode(value, valueExpression);
  51036. if (needCompositionGuard) {
  51037. code = "if($event.target.composing)return;" + code;
  51038. }
  51039. addProp(el, 'value', ("(" + value + ")"));
  51040. addHandler(el, event, code, null, true);
  51041. if (trim || number) {
  51042. addHandler(el, 'blur', '$forceUpdate()');
  51043. }
  51044. }
  51045. /* */
  51046. // normalize v-model event tokens that can only be determined at runtime.
  51047. // it's important to place the event as the first in the array because
  51048. // the whole point is ensuring the v-model callback gets called before
  51049. // user-attached handlers.
  51050. function normalizeEvents (on) {
  51051. /* istanbul ignore if */
  51052. if (isDef(on[RANGE_TOKEN])) {
  51053. // IE input[type=range] only supports `change` event
  51054. var event = isIE ? 'change' : 'input';
  51055. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51056. delete on[RANGE_TOKEN];
  51057. }
  51058. // This was originally intended to fix #4521 but no longer necessary
  51059. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51060. /* istanbul ignore if */
  51061. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51062. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51063. delete on[CHECKBOX_RADIO_TOKEN];
  51064. }
  51065. }
  51066. var target$1;
  51067. function createOnceHandler$1 (event, handler, capture) {
  51068. var _target = target$1; // save current target element in closure
  51069. return function onceHandler () {
  51070. var res = handler.apply(null, arguments);
  51071. if (res !== null) {
  51072. remove$2(event, onceHandler, capture, _target);
  51073. }
  51074. }
  51075. }
  51076. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51077. // implementation and does not fire microtasks in between event propagation, so
  51078. // safe to exclude.
  51079. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51080. function add$1 (
  51081. name,
  51082. handler,
  51083. capture,
  51084. passive
  51085. ) {
  51086. // async edge case #6566: inner click event triggers patch, event handler
  51087. // attached to outer element during patch, and triggered again. This
  51088. // happens because browsers fire microtask ticks between event propagation.
  51089. // the solution is simple: we save the timestamp when a handler is attached,
  51090. // and the handler would only fire if the event passed to it was fired
  51091. // AFTER it was attached.
  51092. if (useMicrotaskFix) {
  51093. var attachedTimestamp = currentFlushTimestamp;
  51094. var original = handler;
  51095. handler = original._wrapper = function (e) {
  51096. if (
  51097. // no bubbling, should always fire.
  51098. // this is just a safety net in case event.timeStamp is unreliable in
  51099. // certain weird environments...
  51100. e.target === e.currentTarget ||
  51101. // event is fired after handler attachment
  51102. e.timeStamp >= attachedTimestamp ||
  51103. // bail for environments that have buggy event.timeStamp implementations
  51104. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51105. // #9681 QtWebEngine event.timeStamp is negative value
  51106. e.timeStamp <= 0 ||
  51107. // #9448 bail if event is fired in another document in a multi-page
  51108. // electron/nw.js app, since event.timeStamp will be using a different
  51109. // starting reference
  51110. e.target.ownerDocument !== document
  51111. ) {
  51112. return original.apply(this, arguments)
  51113. }
  51114. };
  51115. }
  51116. target$1.addEventListener(
  51117. name,
  51118. handler,
  51119. supportsPassive
  51120. ? { capture: capture, passive: passive }
  51121. : capture
  51122. );
  51123. }
  51124. function remove$2 (
  51125. name,
  51126. handler,
  51127. capture,
  51128. _target
  51129. ) {
  51130. (_target || target$1).removeEventListener(
  51131. name,
  51132. handler._wrapper || handler,
  51133. capture
  51134. );
  51135. }
  51136. function updateDOMListeners (oldVnode, vnode) {
  51137. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51138. return
  51139. }
  51140. var on = vnode.data.on || {};
  51141. var oldOn = oldVnode.data.on || {};
  51142. target$1 = vnode.elm;
  51143. normalizeEvents(on);
  51144. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51145. target$1 = undefined;
  51146. }
  51147. var events = {
  51148. create: updateDOMListeners,
  51149. update: updateDOMListeners
  51150. };
  51151. /* */
  51152. var svgContainer;
  51153. function updateDOMProps (oldVnode, vnode) {
  51154. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51155. return
  51156. }
  51157. var key, cur;
  51158. var elm = vnode.elm;
  51159. var oldProps = oldVnode.data.domProps || {};
  51160. var props = vnode.data.domProps || {};
  51161. // clone observed objects, as the user probably wants to mutate it
  51162. if (isDef(props.__ob__)) {
  51163. props = vnode.data.domProps = extend({}, props);
  51164. }
  51165. for (key in oldProps) {
  51166. if (!(key in props)) {
  51167. elm[key] = '';
  51168. }
  51169. }
  51170. for (key in props) {
  51171. cur = props[key];
  51172. // ignore children if the node has textContent or innerHTML,
  51173. // as these will throw away existing DOM nodes and cause removal errors
  51174. // on subsequent patches (#3360)
  51175. if (key === 'textContent' || key === 'innerHTML') {
  51176. if (vnode.children) { vnode.children.length = 0; }
  51177. if (cur === oldProps[key]) { continue }
  51178. // #6601 work around Chrome version <= 55 bug where single textNode
  51179. // replaced by innerHTML/textContent retains its parentNode property
  51180. if (elm.childNodes.length === 1) {
  51181. elm.removeChild(elm.childNodes[0]);
  51182. }
  51183. }
  51184. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51185. // store value as _value as well since
  51186. // non-string values will be stringified
  51187. elm._value = cur;
  51188. // avoid resetting cursor position when value is the same
  51189. var strCur = isUndef(cur) ? '' : String(cur);
  51190. if (shouldUpdateValue(elm, strCur)) {
  51191. elm.value = strCur;
  51192. }
  51193. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51194. // IE doesn't support innerHTML for SVG elements
  51195. svgContainer = svgContainer || document.createElement('div');
  51196. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51197. var svg = svgContainer.firstChild;
  51198. while (elm.firstChild) {
  51199. elm.removeChild(elm.firstChild);
  51200. }
  51201. while (svg.firstChild) {
  51202. elm.appendChild(svg.firstChild);
  51203. }
  51204. } else if (
  51205. // skip the update if old and new VDOM state is the same.
  51206. // `value` is handled separately because the DOM value may be temporarily
  51207. // out of sync with VDOM state due to focus, composition and modifiers.
  51208. // This #4521 by skipping the unnecesarry `checked` update.
  51209. cur !== oldProps[key]
  51210. ) {
  51211. // some property updates can throw
  51212. // e.g. `value` on <progress> w/ non-finite value
  51213. try {
  51214. elm[key] = cur;
  51215. } catch (e) {}
  51216. }
  51217. }
  51218. }
  51219. // check platforms/web/util/attrs.js acceptValue
  51220. function shouldUpdateValue (elm, checkVal) {
  51221. return (!elm.composing && (
  51222. elm.tagName === 'OPTION' ||
  51223. isNotInFocusAndDirty(elm, checkVal) ||
  51224. isDirtyWithModifiers(elm, checkVal)
  51225. ))
  51226. }
  51227. function isNotInFocusAndDirty (elm, checkVal) {
  51228. // return true when textbox (.number and .trim) loses focus and its value is
  51229. // not equal to the updated value
  51230. var notInFocus = true;
  51231. // #6157
  51232. // work around IE bug when accessing document.activeElement in an iframe
  51233. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51234. return notInFocus && elm.value !== checkVal
  51235. }
  51236. function isDirtyWithModifiers (elm, newVal) {
  51237. var value = elm.value;
  51238. var modifiers = elm._vModifiers; // injected by v-model runtime
  51239. if (isDef(modifiers)) {
  51240. if (modifiers.number) {
  51241. return toNumber(value) !== toNumber(newVal)
  51242. }
  51243. if (modifiers.trim) {
  51244. return value.trim() !== newVal.trim()
  51245. }
  51246. }
  51247. return value !== newVal
  51248. }
  51249. var domProps = {
  51250. create: updateDOMProps,
  51251. update: updateDOMProps
  51252. };
  51253. /* */
  51254. var parseStyleText = cached(function (cssText) {
  51255. var res = {};
  51256. var listDelimiter = /;(?![^(]*\))/g;
  51257. var propertyDelimiter = /:(.+)/;
  51258. cssText.split(listDelimiter).forEach(function (item) {
  51259. if (item) {
  51260. var tmp = item.split(propertyDelimiter);
  51261. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51262. }
  51263. });
  51264. return res
  51265. });
  51266. // merge static and dynamic style data on the same vnode
  51267. function normalizeStyleData (data) {
  51268. var style = normalizeStyleBinding(data.style);
  51269. // static style is pre-processed into an object during compilation
  51270. // and is always a fresh object, so it's safe to merge into it
  51271. return data.staticStyle
  51272. ? extend(data.staticStyle, style)
  51273. : style
  51274. }
  51275. // normalize possible array / string values into Object
  51276. function normalizeStyleBinding (bindingStyle) {
  51277. if (Array.isArray(bindingStyle)) {
  51278. return toObject(bindingStyle)
  51279. }
  51280. if (typeof bindingStyle === 'string') {
  51281. return parseStyleText(bindingStyle)
  51282. }
  51283. return bindingStyle
  51284. }
  51285. /**
  51286. * parent component style should be after child's
  51287. * so that parent component's style could override it
  51288. */
  51289. function getStyle (vnode, checkChild) {
  51290. var res = {};
  51291. var styleData;
  51292. if (checkChild) {
  51293. var childNode = vnode;
  51294. while (childNode.componentInstance) {
  51295. childNode = childNode.componentInstance._vnode;
  51296. if (
  51297. childNode && childNode.data &&
  51298. (styleData = normalizeStyleData(childNode.data))
  51299. ) {
  51300. extend(res, styleData);
  51301. }
  51302. }
  51303. }
  51304. if ((styleData = normalizeStyleData(vnode.data))) {
  51305. extend(res, styleData);
  51306. }
  51307. var parentNode = vnode;
  51308. while ((parentNode = parentNode.parent)) {
  51309. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51310. extend(res, styleData);
  51311. }
  51312. }
  51313. return res
  51314. }
  51315. /* */
  51316. var cssVarRE = /^--/;
  51317. var importantRE = /\s*!important$/;
  51318. var setProp = function (el, name, val) {
  51319. /* istanbul ignore if */
  51320. if (cssVarRE.test(name)) {
  51321. el.style.setProperty(name, val);
  51322. } else if (importantRE.test(val)) {
  51323. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51324. } else {
  51325. var normalizedName = normalize(name);
  51326. if (Array.isArray(val)) {
  51327. // Support values array created by autoprefixer, e.g.
  51328. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51329. // Set them one by one, and the browser will only set those it can recognize
  51330. for (var i = 0, len = val.length; i < len; i++) {
  51331. el.style[normalizedName] = val[i];
  51332. }
  51333. } else {
  51334. el.style[normalizedName] = val;
  51335. }
  51336. }
  51337. };
  51338. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51339. var emptyStyle;
  51340. var normalize = cached(function (prop) {
  51341. emptyStyle = emptyStyle || document.createElement('div').style;
  51342. prop = camelize(prop);
  51343. if (prop !== 'filter' && (prop in emptyStyle)) {
  51344. return prop
  51345. }
  51346. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51347. for (var i = 0; i < vendorNames.length; i++) {
  51348. var name = vendorNames[i] + capName;
  51349. if (name in emptyStyle) {
  51350. return name
  51351. }
  51352. }
  51353. });
  51354. function updateStyle (oldVnode, vnode) {
  51355. var data = vnode.data;
  51356. var oldData = oldVnode.data;
  51357. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51358. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51359. ) {
  51360. return
  51361. }
  51362. var cur, name;
  51363. var el = vnode.elm;
  51364. var oldStaticStyle = oldData.staticStyle;
  51365. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51366. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51367. var oldStyle = oldStaticStyle || oldStyleBinding;
  51368. var style = normalizeStyleBinding(vnode.data.style) || {};
  51369. // store normalized style under a different key for next diff
  51370. // make sure to clone it if it's reactive, since the user likely wants
  51371. // to mutate it.
  51372. vnode.data.normalizedStyle = isDef(style.__ob__)
  51373. ? extend({}, style)
  51374. : style;
  51375. var newStyle = getStyle(vnode, true);
  51376. for (name in oldStyle) {
  51377. if (isUndef(newStyle[name])) {
  51378. setProp(el, name, '');
  51379. }
  51380. }
  51381. for (name in newStyle) {
  51382. cur = newStyle[name];
  51383. if (cur !== oldStyle[name]) {
  51384. // ie9 setting to null has no effect, must use empty string
  51385. setProp(el, name, cur == null ? '' : cur);
  51386. }
  51387. }
  51388. }
  51389. var style = {
  51390. create: updateStyle,
  51391. update: updateStyle
  51392. };
  51393. /* */
  51394. var whitespaceRE = /\s+/;
  51395. /**
  51396. * Add class with compatibility for SVG since classList is not supported on
  51397. * SVG elements in IE
  51398. */
  51399. function addClass (el, cls) {
  51400. /* istanbul ignore if */
  51401. if (!cls || !(cls = cls.trim())) {
  51402. return
  51403. }
  51404. /* istanbul ignore else */
  51405. if (el.classList) {
  51406. if (cls.indexOf(' ') > -1) {
  51407. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51408. } else {
  51409. el.classList.add(cls);
  51410. }
  51411. } else {
  51412. var cur = " " + (el.getAttribute('class') || '') + " ";
  51413. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51414. el.setAttribute('class', (cur + cls).trim());
  51415. }
  51416. }
  51417. }
  51418. /**
  51419. * Remove class with compatibility for SVG since classList is not supported on
  51420. * SVG elements in IE
  51421. */
  51422. function removeClass (el, cls) {
  51423. /* istanbul ignore if */
  51424. if (!cls || !(cls = cls.trim())) {
  51425. return
  51426. }
  51427. /* istanbul ignore else */
  51428. if (el.classList) {
  51429. if (cls.indexOf(' ') > -1) {
  51430. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51431. } else {
  51432. el.classList.remove(cls);
  51433. }
  51434. if (!el.classList.length) {
  51435. el.removeAttribute('class');
  51436. }
  51437. } else {
  51438. var cur = " " + (el.getAttribute('class') || '') + " ";
  51439. var tar = ' ' + cls + ' ';
  51440. while (cur.indexOf(tar) >= 0) {
  51441. cur = cur.replace(tar, ' ');
  51442. }
  51443. cur = cur.trim();
  51444. if (cur) {
  51445. el.setAttribute('class', cur);
  51446. } else {
  51447. el.removeAttribute('class');
  51448. }
  51449. }
  51450. }
  51451. /* */
  51452. function resolveTransition (def$$1) {
  51453. if (!def$$1) {
  51454. return
  51455. }
  51456. /* istanbul ignore else */
  51457. if (typeof def$$1 === 'object') {
  51458. var res = {};
  51459. if (def$$1.css !== false) {
  51460. extend(res, autoCssTransition(def$$1.name || 'v'));
  51461. }
  51462. extend(res, def$$1);
  51463. return res
  51464. } else if (typeof def$$1 === 'string') {
  51465. return autoCssTransition(def$$1)
  51466. }
  51467. }
  51468. var autoCssTransition = cached(function (name) {
  51469. return {
  51470. enterClass: (name + "-enter"),
  51471. enterToClass: (name + "-enter-to"),
  51472. enterActiveClass: (name + "-enter-active"),
  51473. leaveClass: (name + "-leave"),
  51474. leaveToClass: (name + "-leave-to"),
  51475. leaveActiveClass: (name + "-leave-active")
  51476. }
  51477. });
  51478. var hasTransition = inBrowser && !isIE9;
  51479. var TRANSITION = 'transition';
  51480. var ANIMATION = 'animation';
  51481. // Transition property/event sniffing
  51482. var transitionProp = 'transition';
  51483. var transitionEndEvent = 'transitionend';
  51484. var animationProp = 'animation';
  51485. var animationEndEvent = 'animationend';
  51486. if (hasTransition) {
  51487. /* istanbul ignore if */
  51488. if (window.ontransitionend === undefined &&
  51489. window.onwebkittransitionend !== undefined
  51490. ) {
  51491. transitionProp = 'WebkitTransition';
  51492. transitionEndEvent = 'webkitTransitionEnd';
  51493. }
  51494. if (window.onanimationend === undefined &&
  51495. window.onwebkitanimationend !== undefined
  51496. ) {
  51497. animationProp = 'WebkitAnimation';
  51498. animationEndEvent = 'webkitAnimationEnd';
  51499. }
  51500. }
  51501. // binding to window is necessary to make hot reload work in IE in strict mode
  51502. var raf = inBrowser
  51503. ? window.requestAnimationFrame
  51504. ? window.requestAnimationFrame.bind(window)
  51505. : setTimeout
  51506. : /* istanbul ignore next */ function (fn) { return fn(); };
  51507. function nextFrame (fn) {
  51508. raf(function () {
  51509. raf(fn);
  51510. });
  51511. }
  51512. function addTransitionClass (el, cls) {
  51513. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51514. if (transitionClasses.indexOf(cls) < 0) {
  51515. transitionClasses.push(cls);
  51516. addClass(el, cls);
  51517. }
  51518. }
  51519. function removeTransitionClass (el, cls) {
  51520. if (el._transitionClasses) {
  51521. remove(el._transitionClasses, cls);
  51522. }
  51523. removeClass(el, cls);
  51524. }
  51525. function whenTransitionEnds (
  51526. el,
  51527. expectedType,
  51528. cb
  51529. ) {
  51530. var ref = getTransitionInfo(el, expectedType);
  51531. var type = ref.type;
  51532. var timeout = ref.timeout;
  51533. var propCount = ref.propCount;
  51534. if (!type) { return cb() }
  51535. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51536. var ended = 0;
  51537. var end = function () {
  51538. el.removeEventListener(event, onEnd);
  51539. cb();
  51540. };
  51541. var onEnd = function (e) {
  51542. if (e.target === el) {
  51543. if (++ended >= propCount) {
  51544. end();
  51545. }
  51546. }
  51547. };
  51548. setTimeout(function () {
  51549. if (ended < propCount) {
  51550. end();
  51551. }
  51552. }, timeout + 1);
  51553. el.addEventListener(event, onEnd);
  51554. }
  51555. var transformRE = /\b(transform|all)(,|$)/;
  51556. function getTransitionInfo (el, expectedType) {
  51557. var styles = window.getComputedStyle(el);
  51558. // JSDOM may return undefined for transition properties
  51559. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51560. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51561. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51562. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51563. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51564. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51565. var type;
  51566. var timeout = 0;
  51567. var propCount = 0;
  51568. /* istanbul ignore if */
  51569. if (expectedType === TRANSITION) {
  51570. if (transitionTimeout > 0) {
  51571. type = TRANSITION;
  51572. timeout = transitionTimeout;
  51573. propCount = transitionDurations.length;
  51574. }
  51575. } else if (expectedType === ANIMATION) {
  51576. if (animationTimeout > 0) {
  51577. type = ANIMATION;
  51578. timeout = animationTimeout;
  51579. propCount = animationDurations.length;
  51580. }
  51581. } else {
  51582. timeout = Math.max(transitionTimeout, animationTimeout);
  51583. type = timeout > 0
  51584. ? transitionTimeout > animationTimeout
  51585. ? TRANSITION
  51586. : ANIMATION
  51587. : null;
  51588. propCount = type
  51589. ? type === TRANSITION
  51590. ? transitionDurations.length
  51591. : animationDurations.length
  51592. : 0;
  51593. }
  51594. var hasTransform =
  51595. type === TRANSITION &&
  51596. transformRE.test(styles[transitionProp + 'Property']);
  51597. return {
  51598. type: type,
  51599. timeout: timeout,
  51600. propCount: propCount,
  51601. hasTransform: hasTransform
  51602. }
  51603. }
  51604. function getTimeout (delays, durations) {
  51605. /* istanbul ignore next */
  51606. while (delays.length < durations.length) {
  51607. delays = delays.concat(delays);
  51608. }
  51609. return Math.max.apply(null, durations.map(function (d, i) {
  51610. return toMs(d) + toMs(delays[i])
  51611. }))
  51612. }
  51613. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51614. // in a locale-dependent way, using a comma instead of a dot.
  51615. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51616. // as a floor function) causing unexpected behaviors
  51617. function toMs (s) {
  51618. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51619. }
  51620. /* */
  51621. function enter (vnode, toggleDisplay) {
  51622. var el = vnode.elm;
  51623. // call leave callback now
  51624. if (isDef(el._leaveCb)) {
  51625. el._leaveCb.cancelled = true;
  51626. el._leaveCb();
  51627. }
  51628. var data = resolveTransition(vnode.data.transition);
  51629. if (isUndef(data)) {
  51630. return
  51631. }
  51632. /* istanbul ignore if */
  51633. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51634. return
  51635. }
  51636. var css = data.css;
  51637. var type = data.type;
  51638. var enterClass = data.enterClass;
  51639. var enterToClass = data.enterToClass;
  51640. var enterActiveClass = data.enterActiveClass;
  51641. var appearClass = data.appearClass;
  51642. var appearToClass = data.appearToClass;
  51643. var appearActiveClass = data.appearActiveClass;
  51644. var beforeEnter = data.beforeEnter;
  51645. var enter = data.enter;
  51646. var afterEnter = data.afterEnter;
  51647. var enterCancelled = data.enterCancelled;
  51648. var beforeAppear = data.beforeAppear;
  51649. var appear = data.appear;
  51650. var afterAppear = data.afterAppear;
  51651. var appearCancelled = data.appearCancelled;
  51652. var duration = data.duration;
  51653. // activeInstance will always be the <transition> component managing this
  51654. // transition. One edge case to check is when the <transition> is placed
  51655. // as the root node of a child component. In that case we need to check
  51656. // <transition>'s parent for appear check.
  51657. var context = activeInstance;
  51658. var transitionNode = activeInstance.$vnode;
  51659. while (transitionNode && transitionNode.parent) {
  51660. context = transitionNode.context;
  51661. transitionNode = transitionNode.parent;
  51662. }
  51663. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51664. if (isAppear && !appear && appear !== '') {
  51665. return
  51666. }
  51667. var startClass = isAppear && appearClass
  51668. ? appearClass
  51669. : enterClass;
  51670. var activeClass = isAppear && appearActiveClass
  51671. ? appearActiveClass
  51672. : enterActiveClass;
  51673. var toClass = isAppear && appearToClass
  51674. ? appearToClass
  51675. : enterToClass;
  51676. var beforeEnterHook = isAppear
  51677. ? (beforeAppear || beforeEnter)
  51678. : beforeEnter;
  51679. var enterHook = isAppear
  51680. ? (typeof appear === 'function' ? appear : enter)
  51681. : enter;
  51682. var afterEnterHook = isAppear
  51683. ? (afterAppear || afterEnter)
  51684. : afterEnter;
  51685. var enterCancelledHook = isAppear
  51686. ? (appearCancelled || enterCancelled)
  51687. : enterCancelled;
  51688. var explicitEnterDuration = toNumber(
  51689. isObject(duration)
  51690. ? duration.enter
  51691. : duration
  51692. );
  51693. if (explicitEnterDuration != null) {
  51694. checkDuration(explicitEnterDuration, 'enter', vnode);
  51695. }
  51696. var expectsCSS = css !== false && !isIE9;
  51697. var userWantsControl = getHookArgumentsLength(enterHook);
  51698. var cb = el._enterCb = once(function () {
  51699. if (expectsCSS) {
  51700. removeTransitionClass(el, toClass);
  51701. removeTransitionClass(el, activeClass);
  51702. }
  51703. if (cb.cancelled) {
  51704. if (expectsCSS) {
  51705. removeTransitionClass(el, startClass);
  51706. }
  51707. enterCancelledHook && enterCancelledHook(el);
  51708. } else {
  51709. afterEnterHook && afterEnterHook(el);
  51710. }
  51711. el._enterCb = null;
  51712. });
  51713. if (!vnode.data.show) {
  51714. // remove pending leave element on enter by injecting an insert hook
  51715. mergeVNodeHook(vnode, 'insert', function () {
  51716. var parent = el.parentNode;
  51717. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51718. if (pendingNode &&
  51719. pendingNode.tag === vnode.tag &&
  51720. pendingNode.elm._leaveCb
  51721. ) {
  51722. pendingNode.elm._leaveCb();
  51723. }
  51724. enterHook && enterHook(el, cb);
  51725. });
  51726. }
  51727. // start enter transition
  51728. beforeEnterHook && beforeEnterHook(el);
  51729. if (expectsCSS) {
  51730. addTransitionClass(el, startClass);
  51731. addTransitionClass(el, activeClass);
  51732. nextFrame(function () {
  51733. removeTransitionClass(el, startClass);
  51734. if (!cb.cancelled) {
  51735. addTransitionClass(el, toClass);
  51736. if (!userWantsControl) {
  51737. if (isValidDuration(explicitEnterDuration)) {
  51738. setTimeout(cb, explicitEnterDuration);
  51739. } else {
  51740. whenTransitionEnds(el, type, cb);
  51741. }
  51742. }
  51743. }
  51744. });
  51745. }
  51746. if (vnode.data.show) {
  51747. toggleDisplay && toggleDisplay();
  51748. enterHook && enterHook(el, cb);
  51749. }
  51750. if (!expectsCSS && !userWantsControl) {
  51751. cb();
  51752. }
  51753. }
  51754. function leave (vnode, rm) {
  51755. var el = vnode.elm;
  51756. // call enter callback now
  51757. if (isDef(el._enterCb)) {
  51758. el._enterCb.cancelled = true;
  51759. el._enterCb();
  51760. }
  51761. var data = resolveTransition(vnode.data.transition);
  51762. if (isUndef(data) || el.nodeType !== 1) {
  51763. return rm()
  51764. }
  51765. /* istanbul ignore if */
  51766. if (isDef(el._leaveCb)) {
  51767. return
  51768. }
  51769. var css = data.css;
  51770. var type = data.type;
  51771. var leaveClass = data.leaveClass;
  51772. var leaveToClass = data.leaveToClass;
  51773. var leaveActiveClass = data.leaveActiveClass;
  51774. var beforeLeave = data.beforeLeave;
  51775. var leave = data.leave;
  51776. var afterLeave = data.afterLeave;
  51777. var leaveCancelled = data.leaveCancelled;
  51778. var delayLeave = data.delayLeave;
  51779. var duration = data.duration;
  51780. var expectsCSS = css !== false && !isIE9;
  51781. var userWantsControl = getHookArgumentsLength(leave);
  51782. var explicitLeaveDuration = toNumber(
  51783. isObject(duration)
  51784. ? duration.leave
  51785. : duration
  51786. );
  51787. if (isDef(explicitLeaveDuration)) {
  51788. checkDuration(explicitLeaveDuration, 'leave', vnode);
  51789. }
  51790. var cb = el._leaveCb = once(function () {
  51791. if (el.parentNode && el.parentNode._pending) {
  51792. el.parentNode._pending[vnode.key] = null;
  51793. }
  51794. if (expectsCSS) {
  51795. removeTransitionClass(el, leaveToClass);
  51796. removeTransitionClass(el, leaveActiveClass);
  51797. }
  51798. if (cb.cancelled) {
  51799. if (expectsCSS) {
  51800. removeTransitionClass(el, leaveClass);
  51801. }
  51802. leaveCancelled && leaveCancelled(el);
  51803. } else {
  51804. rm();
  51805. afterLeave && afterLeave(el);
  51806. }
  51807. el._leaveCb = null;
  51808. });
  51809. if (delayLeave) {
  51810. delayLeave(performLeave);
  51811. } else {
  51812. performLeave();
  51813. }
  51814. function performLeave () {
  51815. // the delayed leave may have already been cancelled
  51816. if (cb.cancelled) {
  51817. return
  51818. }
  51819. // record leaving element
  51820. if (!vnode.data.show && el.parentNode) {
  51821. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  51822. }
  51823. beforeLeave && beforeLeave(el);
  51824. if (expectsCSS) {
  51825. addTransitionClass(el, leaveClass);
  51826. addTransitionClass(el, leaveActiveClass);
  51827. nextFrame(function () {
  51828. removeTransitionClass(el, leaveClass);
  51829. if (!cb.cancelled) {
  51830. addTransitionClass(el, leaveToClass);
  51831. if (!userWantsControl) {
  51832. if (isValidDuration(explicitLeaveDuration)) {
  51833. setTimeout(cb, explicitLeaveDuration);
  51834. } else {
  51835. whenTransitionEnds(el, type, cb);
  51836. }
  51837. }
  51838. }
  51839. });
  51840. }
  51841. leave && leave(el, cb);
  51842. if (!expectsCSS && !userWantsControl) {
  51843. cb();
  51844. }
  51845. }
  51846. }
  51847. // only used in dev mode
  51848. function checkDuration (val, name, vnode) {
  51849. if (typeof val !== 'number') {
  51850. warn(
  51851. "<transition> explicit " + name + " duration is not a valid number - " +
  51852. "got " + (JSON.stringify(val)) + ".",
  51853. vnode.context
  51854. );
  51855. } else if (isNaN(val)) {
  51856. warn(
  51857. "<transition> explicit " + name + " duration is NaN - " +
  51858. 'the duration expression might be incorrect.',
  51859. vnode.context
  51860. );
  51861. }
  51862. }
  51863. function isValidDuration (val) {
  51864. return typeof val === 'number' && !isNaN(val)
  51865. }
  51866. /**
  51867. * Normalize a transition hook's argument length. The hook may be:
  51868. * - a merged hook (invoker) with the original in .fns
  51869. * - a wrapped component method (check ._length)
  51870. * - a plain function (.length)
  51871. */
  51872. function getHookArgumentsLength (fn) {
  51873. if (isUndef(fn)) {
  51874. return false
  51875. }
  51876. var invokerFns = fn.fns;
  51877. if (isDef(invokerFns)) {
  51878. // invoker
  51879. return getHookArgumentsLength(
  51880. Array.isArray(invokerFns)
  51881. ? invokerFns[0]
  51882. : invokerFns
  51883. )
  51884. } else {
  51885. return (fn._length || fn.length) > 1
  51886. }
  51887. }
  51888. function _enter (_, vnode) {
  51889. if (vnode.data.show !== true) {
  51890. enter(vnode);
  51891. }
  51892. }
  51893. var transition = inBrowser ? {
  51894. create: _enter,
  51895. activate: _enter,
  51896. remove: function remove$$1 (vnode, rm) {
  51897. /* istanbul ignore else */
  51898. if (vnode.data.show !== true) {
  51899. leave(vnode, rm);
  51900. } else {
  51901. rm();
  51902. }
  51903. }
  51904. } : {};
  51905. var platformModules = [
  51906. attrs,
  51907. klass,
  51908. events,
  51909. domProps,
  51910. style,
  51911. transition
  51912. ];
  51913. /* */
  51914. // the directive module should be applied last, after all
  51915. // built-in modules have been applied.
  51916. var modules = platformModules.concat(baseModules);
  51917. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  51918. /**
  51919. * Not type checking this file because flow doesn't like attaching
  51920. * properties to Elements.
  51921. */
  51922. /* istanbul ignore if */
  51923. if (isIE9) {
  51924. // http://www.matts411.com/post/internet-explorer-9-oninput/
  51925. document.addEventListener('selectionchange', function () {
  51926. var el = document.activeElement;
  51927. if (el && el.vmodel) {
  51928. trigger(el, 'input');
  51929. }
  51930. });
  51931. }
  51932. var directive = {
  51933. inserted: function inserted (el, binding, vnode, oldVnode) {
  51934. if (vnode.tag === 'select') {
  51935. // #6903
  51936. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  51937. mergeVNodeHook(vnode, 'postpatch', function () {
  51938. directive.componentUpdated(el, binding, vnode);
  51939. });
  51940. } else {
  51941. setSelected(el, binding, vnode.context);
  51942. }
  51943. el._vOptions = [].map.call(el.options, getValue);
  51944. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  51945. el._vModifiers = binding.modifiers;
  51946. if (!binding.modifiers.lazy) {
  51947. el.addEventListener('compositionstart', onCompositionStart);
  51948. el.addEventListener('compositionend', onCompositionEnd);
  51949. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  51950. // switching focus before confirming composition choice
  51951. // this also fixes the issue where some browsers e.g. iOS Chrome
  51952. // fires "change" instead of "input" on autocomplete.
  51953. el.addEventListener('change', onCompositionEnd);
  51954. /* istanbul ignore if */
  51955. if (isIE9) {
  51956. el.vmodel = true;
  51957. }
  51958. }
  51959. }
  51960. },
  51961. componentUpdated: function componentUpdated (el, binding, vnode) {
  51962. if (vnode.tag === 'select') {
  51963. setSelected(el, binding, vnode.context);
  51964. // in case the options rendered by v-for have changed,
  51965. // it's possible that the value is out-of-sync with the rendered options.
  51966. // detect such cases and filter out values that no longer has a matching
  51967. // option in the DOM.
  51968. var prevOptions = el._vOptions;
  51969. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  51970. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  51971. // trigger change event if
  51972. // no matching option found for at least one value
  51973. var needReset = el.multiple
  51974. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  51975. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  51976. if (needReset) {
  51977. trigger(el, 'change');
  51978. }
  51979. }
  51980. }
  51981. }
  51982. };
  51983. function setSelected (el, binding, vm) {
  51984. actuallySetSelected(el, binding, vm);
  51985. /* istanbul ignore if */
  51986. if (isIE || isEdge) {
  51987. setTimeout(function () {
  51988. actuallySetSelected(el, binding, vm);
  51989. }, 0);
  51990. }
  51991. }
  51992. function actuallySetSelected (el, binding, vm) {
  51993. var value = binding.value;
  51994. var isMultiple = el.multiple;
  51995. if (isMultiple && !Array.isArray(value)) {
  51996. warn(
  51997. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  51998. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  51999. vm
  52000. );
  52001. return
  52002. }
  52003. var selected, option;
  52004. for (var i = 0, l = el.options.length; i < l; i++) {
  52005. option = el.options[i];
  52006. if (isMultiple) {
  52007. selected = looseIndexOf(value, getValue(option)) > -1;
  52008. if (option.selected !== selected) {
  52009. option.selected = selected;
  52010. }
  52011. } else {
  52012. if (looseEqual(getValue(option), value)) {
  52013. if (el.selectedIndex !== i) {
  52014. el.selectedIndex = i;
  52015. }
  52016. return
  52017. }
  52018. }
  52019. }
  52020. if (!isMultiple) {
  52021. el.selectedIndex = -1;
  52022. }
  52023. }
  52024. function hasNoMatchingOption (value, options) {
  52025. return options.every(function (o) { return !looseEqual(o, value); })
  52026. }
  52027. function getValue (option) {
  52028. return '_value' in option
  52029. ? option._value
  52030. : option.value
  52031. }
  52032. function onCompositionStart (e) {
  52033. e.target.composing = true;
  52034. }
  52035. function onCompositionEnd (e) {
  52036. // prevent triggering an input event for no reason
  52037. if (!e.target.composing) { return }
  52038. e.target.composing = false;
  52039. trigger(e.target, 'input');
  52040. }
  52041. function trigger (el, type) {
  52042. var e = document.createEvent('HTMLEvents');
  52043. e.initEvent(type, true, true);
  52044. el.dispatchEvent(e);
  52045. }
  52046. /* */
  52047. // recursively search for possible transition defined inside the component root
  52048. function locateNode (vnode) {
  52049. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52050. ? locateNode(vnode.componentInstance._vnode)
  52051. : vnode
  52052. }
  52053. var show = {
  52054. bind: function bind (el, ref, vnode) {
  52055. var value = ref.value;
  52056. vnode = locateNode(vnode);
  52057. var transition$$1 = vnode.data && vnode.data.transition;
  52058. var originalDisplay = el.__vOriginalDisplay =
  52059. el.style.display === 'none' ? '' : el.style.display;
  52060. if (value && transition$$1) {
  52061. vnode.data.show = true;
  52062. enter(vnode, function () {
  52063. el.style.display = originalDisplay;
  52064. });
  52065. } else {
  52066. el.style.display = value ? originalDisplay : 'none';
  52067. }
  52068. },
  52069. update: function update (el, ref, vnode) {
  52070. var value = ref.value;
  52071. var oldValue = ref.oldValue;
  52072. /* istanbul ignore if */
  52073. if (!value === !oldValue) { return }
  52074. vnode = locateNode(vnode);
  52075. var transition$$1 = vnode.data && vnode.data.transition;
  52076. if (transition$$1) {
  52077. vnode.data.show = true;
  52078. if (value) {
  52079. enter(vnode, function () {
  52080. el.style.display = el.__vOriginalDisplay;
  52081. });
  52082. } else {
  52083. leave(vnode, function () {
  52084. el.style.display = 'none';
  52085. });
  52086. }
  52087. } else {
  52088. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52089. }
  52090. },
  52091. unbind: function unbind (
  52092. el,
  52093. binding,
  52094. vnode,
  52095. oldVnode,
  52096. isDestroy
  52097. ) {
  52098. if (!isDestroy) {
  52099. el.style.display = el.__vOriginalDisplay;
  52100. }
  52101. }
  52102. };
  52103. var platformDirectives = {
  52104. model: directive,
  52105. show: show
  52106. };
  52107. /* */
  52108. var transitionProps = {
  52109. name: String,
  52110. appear: Boolean,
  52111. css: Boolean,
  52112. mode: String,
  52113. type: String,
  52114. enterClass: String,
  52115. leaveClass: String,
  52116. enterToClass: String,
  52117. leaveToClass: String,
  52118. enterActiveClass: String,
  52119. leaveActiveClass: String,
  52120. appearClass: String,
  52121. appearActiveClass: String,
  52122. appearToClass: String,
  52123. duration: [Number, String, Object]
  52124. };
  52125. // in case the child is also an abstract component, e.g. <keep-alive>
  52126. // we want to recursively retrieve the real component to be rendered
  52127. function getRealChild (vnode) {
  52128. var compOptions = vnode && vnode.componentOptions;
  52129. if (compOptions && compOptions.Ctor.options.abstract) {
  52130. return getRealChild(getFirstComponentChild(compOptions.children))
  52131. } else {
  52132. return vnode
  52133. }
  52134. }
  52135. function extractTransitionData (comp) {
  52136. var data = {};
  52137. var options = comp.$options;
  52138. // props
  52139. for (var key in options.propsData) {
  52140. data[key] = comp[key];
  52141. }
  52142. // events.
  52143. // extract listeners and pass them directly to the transition methods
  52144. var listeners = options._parentListeners;
  52145. for (var key$1 in listeners) {
  52146. data[camelize(key$1)] = listeners[key$1];
  52147. }
  52148. return data
  52149. }
  52150. function placeholder (h, rawChild) {
  52151. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52152. return h('keep-alive', {
  52153. props: rawChild.componentOptions.propsData
  52154. })
  52155. }
  52156. }
  52157. function hasParentTransition (vnode) {
  52158. while ((vnode = vnode.parent)) {
  52159. if (vnode.data.transition) {
  52160. return true
  52161. }
  52162. }
  52163. }
  52164. function isSameChild (child, oldChild) {
  52165. return oldChild.key === child.key && oldChild.tag === child.tag
  52166. }
  52167. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52168. var isVShowDirective = function (d) { return d.name === 'show'; };
  52169. var Transition = {
  52170. name: 'transition',
  52171. props: transitionProps,
  52172. abstract: true,
  52173. render: function render (h) {
  52174. var this$1 = this;
  52175. var children = this.$slots.default;
  52176. if (!children) {
  52177. return
  52178. }
  52179. // filter out text nodes (possible whitespaces)
  52180. children = children.filter(isNotTextNode);
  52181. /* istanbul ignore if */
  52182. if (!children.length) {
  52183. return
  52184. }
  52185. // warn multiple elements
  52186. if (children.length > 1) {
  52187. warn(
  52188. '<transition> can only be used on a single element. Use ' +
  52189. '<transition-group> for lists.',
  52190. this.$parent
  52191. );
  52192. }
  52193. var mode = this.mode;
  52194. // warn invalid mode
  52195. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52196. ) {
  52197. warn(
  52198. 'invalid <transition> mode: ' + mode,
  52199. this.$parent
  52200. );
  52201. }
  52202. var rawChild = children[0];
  52203. // if this is a component root node and the component's
  52204. // parent container node also has transition, skip.
  52205. if (hasParentTransition(this.$vnode)) {
  52206. return rawChild
  52207. }
  52208. // apply transition data to child
  52209. // use getRealChild() to ignore abstract components e.g. keep-alive
  52210. var child = getRealChild(rawChild);
  52211. /* istanbul ignore if */
  52212. if (!child) {
  52213. return rawChild
  52214. }
  52215. if (this._leaving) {
  52216. return placeholder(h, rawChild)
  52217. }
  52218. // ensure a key that is unique to the vnode type and to this transition
  52219. // component instance. This key will be used to remove pending leaving nodes
  52220. // during entering.
  52221. var id = "__transition-" + (this._uid) + "-";
  52222. child.key = child.key == null
  52223. ? child.isComment
  52224. ? id + 'comment'
  52225. : id + child.tag
  52226. : isPrimitive(child.key)
  52227. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52228. : child.key;
  52229. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52230. var oldRawChild = this._vnode;
  52231. var oldChild = getRealChild(oldRawChild);
  52232. // mark v-show
  52233. // so that the transition module can hand over the control to the directive
  52234. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52235. child.data.show = true;
  52236. }
  52237. if (
  52238. oldChild &&
  52239. oldChild.data &&
  52240. !isSameChild(child, oldChild) &&
  52241. !isAsyncPlaceholder(oldChild) &&
  52242. // #6687 component root is a comment node
  52243. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52244. ) {
  52245. // replace old child transition data with fresh one
  52246. // important for dynamic transitions!
  52247. var oldData = oldChild.data.transition = extend({}, data);
  52248. // handle transition mode
  52249. if (mode === 'out-in') {
  52250. // return placeholder node and queue update when leave finishes
  52251. this._leaving = true;
  52252. mergeVNodeHook(oldData, 'afterLeave', function () {
  52253. this$1._leaving = false;
  52254. this$1.$forceUpdate();
  52255. });
  52256. return placeholder(h, rawChild)
  52257. } else if (mode === 'in-out') {
  52258. if (isAsyncPlaceholder(child)) {
  52259. return oldRawChild
  52260. }
  52261. var delayedLeave;
  52262. var performLeave = function () { delayedLeave(); };
  52263. mergeVNodeHook(data, 'afterEnter', performLeave);
  52264. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52265. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52266. }
  52267. }
  52268. return rawChild
  52269. }
  52270. };
  52271. /* */
  52272. var props = extend({
  52273. tag: String,
  52274. moveClass: String
  52275. }, transitionProps);
  52276. delete props.mode;
  52277. var TransitionGroup = {
  52278. props: props,
  52279. beforeMount: function beforeMount () {
  52280. var this$1 = this;
  52281. var update = this._update;
  52282. this._update = function (vnode, hydrating) {
  52283. var restoreActiveInstance = setActiveInstance(this$1);
  52284. // force removing pass
  52285. this$1.__patch__(
  52286. this$1._vnode,
  52287. this$1.kept,
  52288. false, // hydrating
  52289. true // removeOnly (!important, avoids unnecessary moves)
  52290. );
  52291. this$1._vnode = this$1.kept;
  52292. restoreActiveInstance();
  52293. update.call(this$1, vnode, hydrating);
  52294. };
  52295. },
  52296. render: function render (h) {
  52297. var tag = this.tag || this.$vnode.data.tag || 'span';
  52298. var map = Object.create(null);
  52299. var prevChildren = this.prevChildren = this.children;
  52300. var rawChildren = this.$slots.default || [];
  52301. var children = this.children = [];
  52302. var transitionData = extractTransitionData(this);
  52303. for (var i = 0; i < rawChildren.length; i++) {
  52304. var c = rawChildren[i];
  52305. if (c.tag) {
  52306. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52307. children.push(c);
  52308. map[c.key] = c
  52309. ;(c.data || (c.data = {})).transition = transitionData;
  52310. } else {
  52311. var opts = c.componentOptions;
  52312. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52313. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52314. }
  52315. }
  52316. }
  52317. if (prevChildren) {
  52318. var kept = [];
  52319. var removed = [];
  52320. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52321. var c$1 = prevChildren[i$1];
  52322. c$1.data.transition = transitionData;
  52323. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52324. if (map[c$1.key]) {
  52325. kept.push(c$1);
  52326. } else {
  52327. removed.push(c$1);
  52328. }
  52329. }
  52330. this.kept = h(tag, null, kept);
  52331. this.removed = removed;
  52332. }
  52333. return h(tag, null, children)
  52334. },
  52335. updated: function updated () {
  52336. var children = this.prevChildren;
  52337. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52338. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52339. return
  52340. }
  52341. // we divide the work into three loops to avoid mixing DOM reads and writes
  52342. // in each iteration - which helps prevent layout thrashing.
  52343. children.forEach(callPendingCbs);
  52344. children.forEach(recordPosition);
  52345. children.forEach(applyTranslation);
  52346. // force reflow to put everything in position
  52347. // assign to this to avoid being removed in tree-shaking
  52348. // $flow-disable-line
  52349. this._reflow = document.body.offsetHeight;
  52350. children.forEach(function (c) {
  52351. if (c.data.moved) {
  52352. var el = c.elm;
  52353. var s = el.style;
  52354. addTransitionClass(el, moveClass);
  52355. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52356. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52357. if (e && e.target !== el) {
  52358. return
  52359. }
  52360. if (!e || /transform$/.test(e.propertyName)) {
  52361. el.removeEventListener(transitionEndEvent, cb);
  52362. el._moveCb = null;
  52363. removeTransitionClass(el, moveClass);
  52364. }
  52365. });
  52366. }
  52367. });
  52368. },
  52369. methods: {
  52370. hasMove: function hasMove (el, moveClass) {
  52371. /* istanbul ignore if */
  52372. if (!hasTransition) {
  52373. return false
  52374. }
  52375. /* istanbul ignore if */
  52376. if (this._hasMove) {
  52377. return this._hasMove
  52378. }
  52379. // Detect whether an element with the move class applied has
  52380. // CSS transitions. Since the element may be inside an entering
  52381. // transition at this very moment, we make a clone of it and remove
  52382. // all other transition classes applied to ensure only the move class
  52383. // is applied.
  52384. var clone = el.cloneNode();
  52385. if (el._transitionClasses) {
  52386. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52387. }
  52388. addClass(clone, moveClass);
  52389. clone.style.display = 'none';
  52390. this.$el.appendChild(clone);
  52391. var info = getTransitionInfo(clone);
  52392. this.$el.removeChild(clone);
  52393. return (this._hasMove = info.hasTransform)
  52394. }
  52395. }
  52396. };
  52397. function callPendingCbs (c) {
  52398. /* istanbul ignore if */
  52399. if (c.elm._moveCb) {
  52400. c.elm._moveCb();
  52401. }
  52402. /* istanbul ignore if */
  52403. if (c.elm._enterCb) {
  52404. c.elm._enterCb();
  52405. }
  52406. }
  52407. function recordPosition (c) {
  52408. c.data.newPos = c.elm.getBoundingClientRect();
  52409. }
  52410. function applyTranslation (c) {
  52411. var oldPos = c.data.pos;
  52412. var newPos = c.data.newPos;
  52413. var dx = oldPos.left - newPos.left;
  52414. var dy = oldPos.top - newPos.top;
  52415. if (dx || dy) {
  52416. c.data.moved = true;
  52417. var s = c.elm.style;
  52418. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52419. s.transitionDuration = '0s';
  52420. }
  52421. }
  52422. var platformComponents = {
  52423. Transition: Transition,
  52424. TransitionGroup: TransitionGroup
  52425. };
  52426. /* */
  52427. // install platform specific utils
  52428. Vue.config.mustUseProp = mustUseProp;
  52429. Vue.config.isReservedTag = isReservedTag;
  52430. Vue.config.isReservedAttr = isReservedAttr;
  52431. Vue.config.getTagNamespace = getTagNamespace;
  52432. Vue.config.isUnknownElement = isUnknownElement;
  52433. // install platform runtime directives & components
  52434. extend(Vue.options.directives, platformDirectives);
  52435. extend(Vue.options.components, platformComponents);
  52436. // install platform patch function
  52437. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52438. // public mount method
  52439. Vue.prototype.$mount = function (
  52440. el,
  52441. hydrating
  52442. ) {
  52443. el = el && inBrowser ? query(el) : undefined;
  52444. return mountComponent(this, el, hydrating)
  52445. };
  52446. // devtools global hook
  52447. /* istanbul ignore next */
  52448. if (inBrowser) {
  52449. setTimeout(function () {
  52450. if (config.devtools) {
  52451. if (devtools) {
  52452. devtools.emit('init', Vue);
  52453. } else {
  52454. console[console.info ? 'info' : 'log'](
  52455. 'Download the Vue Devtools extension for a better development experience:\n' +
  52456. 'https://github.com/vuejs/vue-devtools'
  52457. );
  52458. }
  52459. }
  52460. if (config.productionTip !== false &&
  52461. typeof console !== 'undefined'
  52462. ) {
  52463. console[console.info ? 'info' : 'log'](
  52464. "You are running Vue in development mode.\n" +
  52465. "Make sure to turn on production mode when deploying for production.\n" +
  52466. "See more tips at https://vuejs.org/guide/deployment.html"
  52467. );
  52468. }
  52469. }, 0);
  52470. }
  52471. /* */
  52472. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52473. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52474. var buildRegex = cached(function (delimiters) {
  52475. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52476. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52477. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52478. });
  52479. function parseText (
  52480. text,
  52481. delimiters
  52482. ) {
  52483. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52484. if (!tagRE.test(text)) {
  52485. return
  52486. }
  52487. var tokens = [];
  52488. var rawTokens = [];
  52489. var lastIndex = tagRE.lastIndex = 0;
  52490. var match, index, tokenValue;
  52491. while ((match = tagRE.exec(text))) {
  52492. index = match.index;
  52493. // push text token
  52494. if (index > lastIndex) {
  52495. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52496. tokens.push(JSON.stringify(tokenValue));
  52497. }
  52498. // tag token
  52499. var exp = parseFilters(match[1].trim());
  52500. tokens.push(("_s(" + exp + ")"));
  52501. rawTokens.push({ '@binding': exp });
  52502. lastIndex = index + match[0].length;
  52503. }
  52504. if (lastIndex < text.length) {
  52505. rawTokens.push(tokenValue = text.slice(lastIndex));
  52506. tokens.push(JSON.stringify(tokenValue));
  52507. }
  52508. return {
  52509. expression: tokens.join('+'),
  52510. tokens: rawTokens
  52511. }
  52512. }
  52513. /* */
  52514. function transformNode (el, options) {
  52515. var warn = options.warn || baseWarn;
  52516. var staticClass = getAndRemoveAttr(el, 'class');
  52517. if (staticClass) {
  52518. var res = parseText(staticClass, options.delimiters);
  52519. if (res) {
  52520. warn(
  52521. "class=\"" + staticClass + "\": " +
  52522. 'Interpolation inside attributes has been removed. ' +
  52523. 'Use v-bind or the colon shorthand instead. For example, ' +
  52524. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52525. el.rawAttrsMap['class']
  52526. );
  52527. }
  52528. }
  52529. if (staticClass) {
  52530. el.staticClass = JSON.stringify(staticClass);
  52531. }
  52532. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52533. if (classBinding) {
  52534. el.classBinding = classBinding;
  52535. }
  52536. }
  52537. function genData (el) {
  52538. var data = '';
  52539. if (el.staticClass) {
  52540. data += "staticClass:" + (el.staticClass) + ",";
  52541. }
  52542. if (el.classBinding) {
  52543. data += "class:" + (el.classBinding) + ",";
  52544. }
  52545. return data
  52546. }
  52547. var klass$1 = {
  52548. staticKeys: ['staticClass'],
  52549. transformNode: transformNode,
  52550. genData: genData
  52551. };
  52552. /* */
  52553. function transformNode$1 (el, options) {
  52554. var warn = options.warn || baseWarn;
  52555. var staticStyle = getAndRemoveAttr(el, 'style');
  52556. if (staticStyle) {
  52557. /* istanbul ignore if */
  52558. {
  52559. var res = parseText(staticStyle, options.delimiters);
  52560. if (res) {
  52561. warn(
  52562. "style=\"" + staticStyle + "\": " +
  52563. 'Interpolation inside attributes has been removed. ' +
  52564. 'Use v-bind or the colon shorthand instead. For example, ' +
  52565. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52566. el.rawAttrsMap['style']
  52567. );
  52568. }
  52569. }
  52570. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52571. }
  52572. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52573. if (styleBinding) {
  52574. el.styleBinding = styleBinding;
  52575. }
  52576. }
  52577. function genData$1 (el) {
  52578. var data = '';
  52579. if (el.staticStyle) {
  52580. data += "staticStyle:" + (el.staticStyle) + ",";
  52581. }
  52582. if (el.styleBinding) {
  52583. data += "style:(" + (el.styleBinding) + "),";
  52584. }
  52585. return data
  52586. }
  52587. var style$1 = {
  52588. staticKeys: ['staticStyle'],
  52589. transformNode: transformNode$1,
  52590. genData: genData$1
  52591. };
  52592. /* */
  52593. var decoder;
  52594. var he = {
  52595. decode: function decode (html) {
  52596. decoder = decoder || document.createElement('div');
  52597. decoder.innerHTML = html;
  52598. return decoder.textContent
  52599. }
  52600. };
  52601. /* */
  52602. var isUnaryTag = makeMap(
  52603. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52604. 'link,meta,param,source,track,wbr'
  52605. );
  52606. // Elements that you can, intentionally, leave open
  52607. // (and which close themselves)
  52608. var canBeLeftOpenTag = makeMap(
  52609. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52610. );
  52611. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52612. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52613. var isNonPhrasingTag = makeMap(
  52614. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52615. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52616. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52617. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52618. 'title,tr,track'
  52619. );
  52620. /**
  52621. * Not type-checking this file because it's mostly vendor code.
  52622. */
  52623. // Regular Expressions for parsing tags and attributes
  52624. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52625. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52626. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52627. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52628. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52629. var startTagClose = /^\s*(\/?)>/;
  52630. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52631. var doctype = /^<!DOCTYPE [^>]+>/i;
  52632. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52633. var comment = /^<!\--/;
  52634. var conditionalComment = /^<!\[/;
  52635. // Special Elements (can contain anything)
  52636. var isPlainTextElement = makeMap('script,style,textarea', true);
  52637. var reCache = {};
  52638. var decodingMap = {
  52639. '&lt;': '<',
  52640. '&gt;': '>',
  52641. '&quot;': '"',
  52642. '&amp;': '&',
  52643. '&#10;': '\n',
  52644. '&#9;': '\t',
  52645. '&#39;': "'"
  52646. };
  52647. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52648. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52649. // #5992
  52650. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52651. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52652. function decodeAttr (value, shouldDecodeNewlines) {
  52653. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52654. return value.replace(re, function (match) { return decodingMap[match]; })
  52655. }
  52656. function parseHTML (html, options) {
  52657. var stack = [];
  52658. var expectHTML = options.expectHTML;
  52659. var isUnaryTag$$1 = options.isUnaryTag || no;
  52660. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52661. var index = 0;
  52662. var last, lastTag;
  52663. while (html) {
  52664. last = html;
  52665. // Make sure we're not in a plaintext content element like script/style
  52666. if (!lastTag || !isPlainTextElement(lastTag)) {
  52667. var textEnd = html.indexOf('<');
  52668. if (textEnd === 0) {
  52669. // Comment:
  52670. if (comment.test(html)) {
  52671. var commentEnd = html.indexOf('-->');
  52672. if (commentEnd >= 0) {
  52673. if (options.shouldKeepComment) {
  52674. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52675. }
  52676. advance(commentEnd + 3);
  52677. continue
  52678. }
  52679. }
  52680. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52681. if (conditionalComment.test(html)) {
  52682. var conditionalEnd = html.indexOf(']>');
  52683. if (conditionalEnd >= 0) {
  52684. advance(conditionalEnd + 2);
  52685. continue
  52686. }
  52687. }
  52688. // Doctype:
  52689. var doctypeMatch = html.match(doctype);
  52690. if (doctypeMatch) {
  52691. advance(doctypeMatch[0].length);
  52692. continue
  52693. }
  52694. // End tag:
  52695. var endTagMatch = html.match(endTag);
  52696. if (endTagMatch) {
  52697. var curIndex = index;
  52698. advance(endTagMatch[0].length);
  52699. parseEndTag(endTagMatch[1], curIndex, index);
  52700. continue
  52701. }
  52702. // Start tag:
  52703. var startTagMatch = parseStartTag();
  52704. if (startTagMatch) {
  52705. handleStartTag(startTagMatch);
  52706. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52707. advance(1);
  52708. }
  52709. continue
  52710. }
  52711. }
  52712. var text = (void 0), rest = (void 0), next = (void 0);
  52713. if (textEnd >= 0) {
  52714. rest = html.slice(textEnd);
  52715. while (
  52716. !endTag.test(rest) &&
  52717. !startTagOpen.test(rest) &&
  52718. !comment.test(rest) &&
  52719. !conditionalComment.test(rest)
  52720. ) {
  52721. // < in plain text, be forgiving and treat it as text
  52722. next = rest.indexOf('<', 1);
  52723. if (next < 0) { break }
  52724. textEnd += next;
  52725. rest = html.slice(textEnd);
  52726. }
  52727. text = html.substring(0, textEnd);
  52728. }
  52729. if (textEnd < 0) {
  52730. text = html;
  52731. }
  52732. if (text) {
  52733. advance(text.length);
  52734. }
  52735. if (options.chars && text) {
  52736. options.chars(text, index - text.length, index);
  52737. }
  52738. } else {
  52739. var endTagLength = 0;
  52740. var stackedTag = lastTag.toLowerCase();
  52741. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52742. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52743. endTagLength = endTag.length;
  52744. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52745. text = text
  52746. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52747. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52748. }
  52749. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52750. text = text.slice(1);
  52751. }
  52752. if (options.chars) {
  52753. options.chars(text);
  52754. }
  52755. return ''
  52756. });
  52757. index += html.length - rest$1.length;
  52758. html = rest$1;
  52759. parseEndTag(stackedTag, index - endTagLength, index);
  52760. }
  52761. if (html === last) {
  52762. options.chars && options.chars(html);
  52763. if (!stack.length && options.warn) {
  52764. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52765. }
  52766. break
  52767. }
  52768. }
  52769. // Clean up any remaining tags
  52770. parseEndTag();
  52771. function advance (n) {
  52772. index += n;
  52773. html = html.substring(n);
  52774. }
  52775. function parseStartTag () {
  52776. var start = html.match(startTagOpen);
  52777. if (start) {
  52778. var match = {
  52779. tagName: start[1],
  52780. attrs: [],
  52781. start: index
  52782. };
  52783. advance(start[0].length);
  52784. var end, attr;
  52785. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  52786. attr.start = index;
  52787. advance(attr[0].length);
  52788. attr.end = index;
  52789. match.attrs.push(attr);
  52790. }
  52791. if (end) {
  52792. match.unarySlash = end[1];
  52793. advance(end[0].length);
  52794. match.end = index;
  52795. return match
  52796. }
  52797. }
  52798. }
  52799. function handleStartTag (match) {
  52800. var tagName = match.tagName;
  52801. var unarySlash = match.unarySlash;
  52802. if (expectHTML) {
  52803. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  52804. parseEndTag(lastTag);
  52805. }
  52806. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  52807. parseEndTag(tagName);
  52808. }
  52809. }
  52810. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  52811. var l = match.attrs.length;
  52812. var attrs = new Array(l);
  52813. for (var i = 0; i < l; i++) {
  52814. var args = match.attrs[i];
  52815. var value = args[3] || args[4] || args[5] || '';
  52816. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  52817. ? options.shouldDecodeNewlinesForHref
  52818. : options.shouldDecodeNewlines;
  52819. attrs[i] = {
  52820. name: args[1],
  52821. value: decodeAttr(value, shouldDecodeNewlines)
  52822. };
  52823. if (options.outputSourceRange) {
  52824. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  52825. attrs[i].end = args.end;
  52826. }
  52827. }
  52828. if (!unary) {
  52829. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  52830. lastTag = tagName;
  52831. }
  52832. if (options.start) {
  52833. options.start(tagName, attrs, unary, match.start, match.end);
  52834. }
  52835. }
  52836. function parseEndTag (tagName, start, end) {
  52837. var pos, lowerCasedTagName;
  52838. if (start == null) { start = index; }
  52839. if (end == null) { end = index; }
  52840. // Find the closest opened tag of the same type
  52841. if (tagName) {
  52842. lowerCasedTagName = tagName.toLowerCase();
  52843. for (pos = stack.length - 1; pos >= 0; pos--) {
  52844. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  52845. break
  52846. }
  52847. }
  52848. } else {
  52849. // If no tag name is provided, clean shop
  52850. pos = 0;
  52851. }
  52852. if (pos >= 0) {
  52853. // Close all the open elements, up the stack
  52854. for (var i = stack.length - 1; i >= pos; i--) {
  52855. if (i > pos || !tagName &&
  52856. options.warn
  52857. ) {
  52858. options.warn(
  52859. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  52860. { start: stack[i].start, end: stack[i].end }
  52861. );
  52862. }
  52863. if (options.end) {
  52864. options.end(stack[i].tag, start, end);
  52865. }
  52866. }
  52867. // Remove the open elements from the stack
  52868. stack.length = pos;
  52869. lastTag = pos && stack[pos - 1].tag;
  52870. } else if (lowerCasedTagName === 'br') {
  52871. if (options.start) {
  52872. options.start(tagName, [], true, start, end);
  52873. }
  52874. } else if (lowerCasedTagName === 'p') {
  52875. if (options.start) {
  52876. options.start(tagName, [], false, start, end);
  52877. }
  52878. if (options.end) {
  52879. options.end(tagName, start, end);
  52880. }
  52881. }
  52882. }
  52883. }
  52884. /* */
  52885. var onRE = /^@|^v-on:/;
  52886. var dirRE = /^v-|^@|^:|^#/;
  52887. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  52888. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  52889. var stripParensRE = /^\(|\)$/g;
  52890. var dynamicArgRE = /^\[.*\]$/;
  52891. var argRE = /:(.*)$/;
  52892. var bindRE = /^:|^\.|^v-bind:/;
  52893. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  52894. var slotRE = /^v-slot(:|$)|^#/;
  52895. var lineBreakRE = /[\r\n]/;
  52896. var whitespaceRE$1 = /\s+/g;
  52897. var invalidAttributeRE = /[\s"'<>\/=]/;
  52898. var decodeHTMLCached = cached(he.decode);
  52899. var emptySlotScopeToken = "_empty_";
  52900. // configurable state
  52901. var warn$2;
  52902. var delimiters;
  52903. var transforms;
  52904. var preTransforms;
  52905. var postTransforms;
  52906. var platformIsPreTag;
  52907. var platformMustUseProp;
  52908. var platformGetTagNamespace;
  52909. var maybeComponent;
  52910. function createASTElement (
  52911. tag,
  52912. attrs,
  52913. parent
  52914. ) {
  52915. return {
  52916. type: 1,
  52917. tag: tag,
  52918. attrsList: attrs,
  52919. attrsMap: makeAttrsMap(attrs),
  52920. rawAttrsMap: {},
  52921. parent: parent,
  52922. children: []
  52923. }
  52924. }
  52925. /**
  52926. * Convert HTML string to AST.
  52927. */
  52928. function parse (
  52929. template,
  52930. options
  52931. ) {
  52932. warn$2 = options.warn || baseWarn;
  52933. platformIsPreTag = options.isPreTag || no;
  52934. platformMustUseProp = options.mustUseProp || no;
  52935. platformGetTagNamespace = options.getTagNamespace || no;
  52936. var isReservedTag = options.isReservedTag || no;
  52937. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  52938. transforms = pluckModuleFunction(options.modules, 'transformNode');
  52939. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  52940. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  52941. delimiters = options.delimiters;
  52942. var stack = [];
  52943. var preserveWhitespace = options.preserveWhitespace !== false;
  52944. var whitespaceOption = options.whitespace;
  52945. var root;
  52946. var currentParent;
  52947. var inVPre = false;
  52948. var inPre = false;
  52949. var warned = false;
  52950. function warnOnce (msg, range) {
  52951. if (!warned) {
  52952. warned = true;
  52953. warn$2(msg, range);
  52954. }
  52955. }
  52956. function closeElement (element) {
  52957. trimEndingWhitespace(element);
  52958. if (!inVPre && !element.processed) {
  52959. element = processElement(element, options);
  52960. }
  52961. // tree management
  52962. if (!stack.length && element !== root) {
  52963. // allow root elements with v-if, v-else-if and v-else
  52964. if (root.if && (element.elseif || element.else)) {
  52965. {
  52966. checkRootConstraints(element);
  52967. }
  52968. addIfCondition(root, {
  52969. exp: element.elseif,
  52970. block: element
  52971. });
  52972. } else {
  52973. warnOnce(
  52974. "Component template should contain exactly one root element. " +
  52975. "If you are using v-if on multiple elements, " +
  52976. "use v-else-if to chain them instead.",
  52977. { start: element.start }
  52978. );
  52979. }
  52980. }
  52981. if (currentParent && !element.forbidden) {
  52982. if (element.elseif || element.else) {
  52983. processIfConditions(element, currentParent);
  52984. } else {
  52985. if (element.slotScope) {
  52986. // scoped slot
  52987. // keep it in the children list so that v-else(-if) conditions can
  52988. // find it as the prev node.
  52989. var name = element.slotTarget || '"default"'
  52990. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  52991. }
  52992. currentParent.children.push(element);
  52993. element.parent = currentParent;
  52994. }
  52995. }
  52996. // final children cleanup
  52997. // filter out scoped slots
  52998. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  52999. // remove trailing whitespace node again
  53000. trimEndingWhitespace(element);
  53001. // check pre state
  53002. if (element.pre) {
  53003. inVPre = false;
  53004. }
  53005. if (platformIsPreTag(element.tag)) {
  53006. inPre = false;
  53007. }
  53008. // apply post-transforms
  53009. for (var i = 0; i < postTransforms.length; i++) {
  53010. postTransforms[i](element, options);
  53011. }
  53012. }
  53013. function trimEndingWhitespace (el) {
  53014. // remove trailing whitespace node
  53015. if (!inPre) {
  53016. var lastNode;
  53017. while (
  53018. (lastNode = el.children[el.children.length - 1]) &&
  53019. lastNode.type === 3 &&
  53020. lastNode.text === ' '
  53021. ) {
  53022. el.children.pop();
  53023. }
  53024. }
  53025. }
  53026. function checkRootConstraints (el) {
  53027. if (el.tag === 'slot' || el.tag === 'template') {
  53028. warnOnce(
  53029. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53030. 'contain multiple nodes.',
  53031. { start: el.start }
  53032. );
  53033. }
  53034. if (el.attrsMap.hasOwnProperty('v-for')) {
  53035. warnOnce(
  53036. 'Cannot use v-for on stateful component root element because ' +
  53037. 'it renders multiple elements.',
  53038. el.rawAttrsMap['v-for']
  53039. );
  53040. }
  53041. }
  53042. parseHTML(template, {
  53043. warn: warn$2,
  53044. expectHTML: options.expectHTML,
  53045. isUnaryTag: options.isUnaryTag,
  53046. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53047. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53048. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53049. shouldKeepComment: options.comments,
  53050. outputSourceRange: options.outputSourceRange,
  53051. start: function start (tag, attrs, unary, start$1, end) {
  53052. // check namespace.
  53053. // inherit parent ns if there is one
  53054. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53055. // handle IE svg bug
  53056. /* istanbul ignore if */
  53057. if (isIE && ns === 'svg') {
  53058. attrs = guardIESVGBug(attrs);
  53059. }
  53060. var element = createASTElement(tag, attrs, currentParent);
  53061. if (ns) {
  53062. element.ns = ns;
  53063. }
  53064. {
  53065. if (options.outputSourceRange) {
  53066. element.start = start$1;
  53067. element.end = end;
  53068. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53069. cumulated[attr.name] = attr;
  53070. return cumulated
  53071. }, {});
  53072. }
  53073. attrs.forEach(function (attr) {
  53074. if (invalidAttributeRE.test(attr.name)) {
  53075. warn$2(
  53076. "Invalid dynamic argument expression: attribute names cannot contain " +
  53077. "spaces, quotes, <, >, / or =.",
  53078. {
  53079. start: attr.start + attr.name.indexOf("["),
  53080. end: attr.start + attr.name.length
  53081. }
  53082. );
  53083. }
  53084. });
  53085. }
  53086. if (isForbiddenTag(element) && !isServerRendering()) {
  53087. element.forbidden = true;
  53088. warn$2(
  53089. 'Templates should only be responsible for mapping the state to the ' +
  53090. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53091. "<" + tag + ">" + ', as they will not be parsed.',
  53092. { start: element.start }
  53093. );
  53094. }
  53095. // apply pre-transforms
  53096. for (var i = 0; i < preTransforms.length; i++) {
  53097. element = preTransforms[i](element, options) || element;
  53098. }
  53099. if (!inVPre) {
  53100. processPre(element);
  53101. if (element.pre) {
  53102. inVPre = true;
  53103. }
  53104. }
  53105. if (platformIsPreTag(element.tag)) {
  53106. inPre = true;
  53107. }
  53108. if (inVPre) {
  53109. processRawAttrs(element);
  53110. } else if (!element.processed) {
  53111. // structural directives
  53112. processFor(element);
  53113. processIf(element);
  53114. processOnce(element);
  53115. }
  53116. if (!root) {
  53117. root = element;
  53118. {
  53119. checkRootConstraints(root);
  53120. }
  53121. }
  53122. if (!unary) {
  53123. currentParent = element;
  53124. stack.push(element);
  53125. } else {
  53126. closeElement(element);
  53127. }
  53128. },
  53129. end: function end (tag, start, end$1) {
  53130. var element = stack[stack.length - 1];
  53131. // pop stack
  53132. stack.length -= 1;
  53133. currentParent = stack[stack.length - 1];
  53134. if (options.outputSourceRange) {
  53135. element.end = end$1;
  53136. }
  53137. closeElement(element);
  53138. },
  53139. chars: function chars (text, start, end) {
  53140. if (!currentParent) {
  53141. {
  53142. if (text === template) {
  53143. warnOnce(
  53144. 'Component template requires a root element, rather than just text.',
  53145. { start: start }
  53146. );
  53147. } else if ((text = text.trim())) {
  53148. warnOnce(
  53149. ("text \"" + text + "\" outside root element will be ignored."),
  53150. { start: start }
  53151. );
  53152. }
  53153. }
  53154. return
  53155. }
  53156. // IE textarea placeholder bug
  53157. /* istanbul ignore if */
  53158. if (isIE &&
  53159. currentParent.tag === 'textarea' &&
  53160. currentParent.attrsMap.placeholder === text
  53161. ) {
  53162. return
  53163. }
  53164. var children = currentParent.children;
  53165. if (inPre || text.trim()) {
  53166. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53167. } else if (!children.length) {
  53168. // remove the whitespace-only node right after an opening tag
  53169. text = '';
  53170. } else if (whitespaceOption) {
  53171. if (whitespaceOption === 'condense') {
  53172. // in condense mode, remove the whitespace node if it contains
  53173. // line break, otherwise condense to a single space
  53174. text = lineBreakRE.test(text) ? '' : ' ';
  53175. } else {
  53176. text = ' ';
  53177. }
  53178. } else {
  53179. text = preserveWhitespace ? ' ' : '';
  53180. }
  53181. if (text) {
  53182. if (!inPre && whitespaceOption === 'condense') {
  53183. // condense consecutive whitespaces into single space
  53184. text = text.replace(whitespaceRE$1, ' ');
  53185. }
  53186. var res;
  53187. var child;
  53188. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53189. child = {
  53190. type: 2,
  53191. expression: res.expression,
  53192. tokens: res.tokens,
  53193. text: text
  53194. };
  53195. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53196. child = {
  53197. type: 3,
  53198. text: text
  53199. };
  53200. }
  53201. if (child) {
  53202. if (options.outputSourceRange) {
  53203. child.start = start;
  53204. child.end = end;
  53205. }
  53206. children.push(child);
  53207. }
  53208. }
  53209. },
  53210. comment: function comment (text, start, end) {
  53211. // adding anyting as a sibling to the root node is forbidden
  53212. // comments should still be allowed, but ignored
  53213. if (currentParent) {
  53214. var child = {
  53215. type: 3,
  53216. text: text,
  53217. isComment: true
  53218. };
  53219. if (options.outputSourceRange) {
  53220. child.start = start;
  53221. child.end = end;
  53222. }
  53223. currentParent.children.push(child);
  53224. }
  53225. }
  53226. });
  53227. return root
  53228. }
  53229. function processPre (el) {
  53230. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53231. el.pre = true;
  53232. }
  53233. }
  53234. function processRawAttrs (el) {
  53235. var list = el.attrsList;
  53236. var len = list.length;
  53237. if (len) {
  53238. var attrs = el.attrs = new Array(len);
  53239. for (var i = 0; i < len; i++) {
  53240. attrs[i] = {
  53241. name: list[i].name,
  53242. value: JSON.stringify(list[i].value)
  53243. };
  53244. if (list[i].start != null) {
  53245. attrs[i].start = list[i].start;
  53246. attrs[i].end = list[i].end;
  53247. }
  53248. }
  53249. } else if (!el.pre) {
  53250. // non root node in pre blocks with no attributes
  53251. el.plain = true;
  53252. }
  53253. }
  53254. function processElement (
  53255. element,
  53256. options
  53257. ) {
  53258. processKey(element);
  53259. // determine whether this is a plain element after
  53260. // removing structural attributes
  53261. element.plain = (
  53262. !element.key &&
  53263. !element.scopedSlots &&
  53264. !element.attrsList.length
  53265. );
  53266. processRef(element);
  53267. processSlotContent(element);
  53268. processSlotOutlet(element);
  53269. processComponent(element);
  53270. for (var i = 0; i < transforms.length; i++) {
  53271. element = transforms[i](element, options) || element;
  53272. }
  53273. processAttrs(element);
  53274. return element
  53275. }
  53276. function processKey (el) {
  53277. var exp = getBindingAttr(el, 'key');
  53278. if (exp) {
  53279. {
  53280. if (el.tag === 'template') {
  53281. warn$2(
  53282. "<template> cannot be keyed. Place the key on real elements instead.",
  53283. getRawBindingAttr(el, 'key')
  53284. );
  53285. }
  53286. if (el.for) {
  53287. var iterator = el.iterator2 || el.iterator1;
  53288. var parent = el.parent;
  53289. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53290. warn$2(
  53291. "Do not use v-for index as key on <transition-group> children, " +
  53292. "this is the same as not using keys.",
  53293. getRawBindingAttr(el, 'key'),
  53294. true /* tip */
  53295. );
  53296. }
  53297. }
  53298. }
  53299. el.key = exp;
  53300. }
  53301. }
  53302. function processRef (el) {
  53303. var ref = getBindingAttr(el, 'ref');
  53304. if (ref) {
  53305. el.ref = ref;
  53306. el.refInFor = checkInFor(el);
  53307. }
  53308. }
  53309. function processFor (el) {
  53310. var exp;
  53311. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53312. var res = parseFor(exp);
  53313. if (res) {
  53314. extend(el, res);
  53315. } else {
  53316. warn$2(
  53317. ("Invalid v-for expression: " + exp),
  53318. el.rawAttrsMap['v-for']
  53319. );
  53320. }
  53321. }
  53322. }
  53323. function parseFor (exp) {
  53324. var inMatch = exp.match(forAliasRE);
  53325. if (!inMatch) { return }
  53326. var res = {};
  53327. res.for = inMatch[2].trim();
  53328. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53329. var iteratorMatch = alias.match(forIteratorRE);
  53330. if (iteratorMatch) {
  53331. res.alias = alias.replace(forIteratorRE, '').trim();
  53332. res.iterator1 = iteratorMatch[1].trim();
  53333. if (iteratorMatch[2]) {
  53334. res.iterator2 = iteratorMatch[2].trim();
  53335. }
  53336. } else {
  53337. res.alias = alias;
  53338. }
  53339. return res
  53340. }
  53341. function processIf (el) {
  53342. var exp = getAndRemoveAttr(el, 'v-if');
  53343. if (exp) {
  53344. el.if = exp;
  53345. addIfCondition(el, {
  53346. exp: exp,
  53347. block: el
  53348. });
  53349. } else {
  53350. if (getAndRemoveAttr(el, 'v-else') != null) {
  53351. el.else = true;
  53352. }
  53353. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53354. if (elseif) {
  53355. el.elseif = elseif;
  53356. }
  53357. }
  53358. }
  53359. function processIfConditions (el, parent) {
  53360. var prev = findPrevElement(parent.children);
  53361. if (prev && prev.if) {
  53362. addIfCondition(prev, {
  53363. exp: el.elseif,
  53364. block: el
  53365. });
  53366. } else {
  53367. warn$2(
  53368. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53369. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53370. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53371. );
  53372. }
  53373. }
  53374. function findPrevElement (children) {
  53375. var i = children.length;
  53376. while (i--) {
  53377. if (children[i].type === 1) {
  53378. return children[i]
  53379. } else {
  53380. if (children[i].text !== ' ') {
  53381. warn$2(
  53382. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53383. "will be ignored.",
  53384. children[i]
  53385. );
  53386. }
  53387. children.pop();
  53388. }
  53389. }
  53390. }
  53391. function addIfCondition (el, condition) {
  53392. if (!el.ifConditions) {
  53393. el.ifConditions = [];
  53394. }
  53395. el.ifConditions.push(condition);
  53396. }
  53397. function processOnce (el) {
  53398. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53399. if (once$$1 != null) {
  53400. el.once = true;
  53401. }
  53402. }
  53403. // handle content being passed to a component as slot,
  53404. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53405. function processSlotContent (el) {
  53406. var slotScope;
  53407. if (el.tag === 'template') {
  53408. slotScope = getAndRemoveAttr(el, 'scope');
  53409. /* istanbul ignore if */
  53410. if (slotScope) {
  53411. warn$2(
  53412. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53413. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53414. "can also be used on plain elements in addition to <template> to " +
  53415. "denote scoped slots.",
  53416. el.rawAttrsMap['scope'],
  53417. true
  53418. );
  53419. }
  53420. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53421. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53422. /* istanbul ignore if */
  53423. if (el.attrsMap['v-for']) {
  53424. warn$2(
  53425. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53426. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53427. "scoped slot to make it clearer.",
  53428. el.rawAttrsMap['slot-scope'],
  53429. true
  53430. );
  53431. }
  53432. el.slotScope = slotScope;
  53433. }
  53434. // slot="xxx"
  53435. var slotTarget = getBindingAttr(el, 'slot');
  53436. if (slotTarget) {
  53437. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53438. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53439. // preserve slot as an attribute for native shadow DOM compat
  53440. // only for non-scoped slots.
  53441. if (el.tag !== 'template' && !el.slotScope) {
  53442. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53443. }
  53444. }
  53445. // 2.6 v-slot syntax
  53446. {
  53447. if (el.tag === 'template') {
  53448. // v-slot on <template>
  53449. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53450. if (slotBinding) {
  53451. {
  53452. if (el.slotTarget || el.slotScope) {
  53453. warn$2(
  53454. "Unexpected mixed usage of different slot syntaxes.",
  53455. el
  53456. );
  53457. }
  53458. if (el.parent && !maybeComponent(el.parent)) {
  53459. warn$2(
  53460. "<template v-slot> can only appear at the root level inside " +
  53461. "the receiving component",
  53462. el
  53463. );
  53464. }
  53465. }
  53466. var ref = getSlotName(slotBinding);
  53467. var name = ref.name;
  53468. var dynamic = ref.dynamic;
  53469. el.slotTarget = name;
  53470. el.slotTargetDynamic = dynamic;
  53471. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53472. }
  53473. } else {
  53474. // v-slot on component, denotes default slot
  53475. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53476. if (slotBinding$1) {
  53477. {
  53478. if (!maybeComponent(el)) {
  53479. warn$2(
  53480. "v-slot can only be used on components or <template>.",
  53481. slotBinding$1
  53482. );
  53483. }
  53484. if (el.slotScope || el.slotTarget) {
  53485. warn$2(
  53486. "Unexpected mixed usage of different slot syntaxes.",
  53487. el
  53488. );
  53489. }
  53490. if (el.scopedSlots) {
  53491. warn$2(
  53492. "To avoid scope ambiguity, the default slot should also use " +
  53493. "<template> syntax when there are other named slots.",
  53494. slotBinding$1
  53495. );
  53496. }
  53497. }
  53498. // add the component's children to its default slot
  53499. var slots = el.scopedSlots || (el.scopedSlots = {});
  53500. var ref$1 = getSlotName(slotBinding$1);
  53501. var name$1 = ref$1.name;
  53502. var dynamic$1 = ref$1.dynamic;
  53503. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53504. slotContainer.slotTarget = name$1;
  53505. slotContainer.slotTargetDynamic = dynamic$1;
  53506. slotContainer.children = el.children.filter(function (c) {
  53507. if (!c.slotScope) {
  53508. c.parent = slotContainer;
  53509. return true
  53510. }
  53511. });
  53512. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53513. // remove children as they are returned from scopedSlots now
  53514. el.children = [];
  53515. // mark el non-plain so data gets generated
  53516. el.plain = false;
  53517. }
  53518. }
  53519. }
  53520. }
  53521. function getSlotName (binding) {
  53522. var name = binding.name.replace(slotRE, '');
  53523. if (!name) {
  53524. if (binding.name[0] !== '#') {
  53525. name = 'default';
  53526. } else {
  53527. warn$2(
  53528. "v-slot shorthand syntax requires a slot name.",
  53529. binding
  53530. );
  53531. }
  53532. }
  53533. return dynamicArgRE.test(name)
  53534. // dynamic [name]
  53535. ? { name: name.slice(1, -1), dynamic: true }
  53536. // static name
  53537. : { name: ("\"" + name + "\""), dynamic: false }
  53538. }
  53539. // handle <slot/> outlets
  53540. function processSlotOutlet (el) {
  53541. if (el.tag === 'slot') {
  53542. el.slotName = getBindingAttr(el, 'name');
  53543. if (el.key) {
  53544. warn$2(
  53545. "`key` does not work on <slot> because slots are abstract outlets " +
  53546. "and can possibly expand into multiple elements. " +
  53547. "Use the key on a wrapping element instead.",
  53548. getRawBindingAttr(el, 'key')
  53549. );
  53550. }
  53551. }
  53552. }
  53553. function processComponent (el) {
  53554. var binding;
  53555. if ((binding = getBindingAttr(el, 'is'))) {
  53556. el.component = binding;
  53557. }
  53558. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53559. el.inlineTemplate = true;
  53560. }
  53561. }
  53562. function processAttrs (el) {
  53563. var list = el.attrsList;
  53564. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53565. for (i = 0, l = list.length; i < l; i++) {
  53566. name = rawName = list[i].name;
  53567. value = list[i].value;
  53568. if (dirRE.test(name)) {
  53569. // mark element as dynamic
  53570. el.hasBindings = true;
  53571. // modifiers
  53572. modifiers = parseModifiers(name.replace(dirRE, ''));
  53573. // support .foo shorthand syntax for the .prop modifier
  53574. if (modifiers) {
  53575. name = name.replace(modifierRE, '');
  53576. }
  53577. if (bindRE.test(name)) { // v-bind
  53578. name = name.replace(bindRE, '');
  53579. value = parseFilters(value);
  53580. isDynamic = dynamicArgRE.test(name);
  53581. if (isDynamic) {
  53582. name = name.slice(1, -1);
  53583. }
  53584. if (
  53585. value.trim().length === 0
  53586. ) {
  53587. warn$2(
  53588. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53589. );
  53590. }
  53591. if (modifiers) {
  53592. if (modifiers.prop && !isDynamic) {
  53593. name = camelize(name);
  53594. if (name === 'innerHtml') { name = 'innerHTML'; }
  53595. }
  53596. if (modifiers.camel && !isDynamic) {
  53597. name = camelize(name);
  53598. }
  53599. if (modifiers.sync) {
  53600. syncGen = genAssignmentCode(value, "$event");
  53601. if (!isDynamic) {
  53602. addHandler(
  53603. el,
  53604. ("update:" + (camelize(name))),
  53605. syncGen,
  53606. null,
  53607. false,
  53608. warn$2,
  53609. list[i]
  53610. );
  53611. if (hyphenate(name) !== camelize(name)) {
  53612. addHandler(
  53613. el,
  53614. ("update:" + (hyphenate(name))),
  53615. syncGen,
  53616. null,
  53617. false,
  53618. warn$2,
  53619. list[i]
  53620. );
  53621. }
  53622. } else {
  53623. // handler w/ dynamic event name
  53624. addHandler(
  53625. el,
  53626. ("\"update:\"+(" + name + ")"),
  53627. syncGen,
  53628. null,
  53629. false,
  53630. warn$2,
  53631. list[i],
  53632. true // dynamic
  53633. );
  53634. }
  53635. }
  53636. }
  53637. if ((modifiers && modifiers.prop) || (
  53638. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53639. )) {
  53640. addProp(el, name, value, list[i], isDynamic);
  53641. } else {
  53642. addAttr(el, name, value, list[i], isDynamic);
  53643. }
  53644. } else if (onRE.test(name)) { // v-on
  53645. name = name.replace(onRE, '');
  53646. isDynamic = dynamicArgRE.test(name);
  53647. if (isDynamic) {
  53648. name = name.slice(1, -1);
  53649. }
  53650. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53651. } else { // normal directives
  53652. name = name.replace(dirRE, '');
  53653. // parse arg
  53654. var argMatch = name.match(argRE);
  53655. var arg = argMatch && argMatch[1];
  53656. isDynamic = false;
  53657. if (arg) {
  53658. name = name.slice(0, -(arg.length + 1));
  53659. if (dynamicArgRE.test(arg)) {
  53660. arg = arg.slice(1, -1);
  53661. isDynamic = true;
  53662. }
  53663. }
  53664. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53665. if (name === 'model') {
  53666. checkForAliasModel(el, value);
  53667. }
  53668. }
  53669. } else {
  53670. // literal attribute
  53671. {
  53672. var res = parseText(value, delimiters);
  53673. if (res) {
  53674. warn$2(
  53675. name + "=\"" + value + "\": " +
  53676. 'Interpolation inside attributes has been removed. ' +
  53677. 'Use v-bind or the colon shorthand instead. For example, ' +
  53678. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53679. list[i]
  53680. );
  53681. }
  53682. }
  53683. addAttr(el, name, JSON.stringify(value), list[i]);
  53684. // #6887 firefox doesn't update muted state if set via attribute
  53685. // even immediately after element creation
  53686. if (!el.component &&
  53687. name === 'muted' &&
  53688. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53689. addProp(el, name, 'true', list[i]);
  53690. }
  53691. }
  53692. }
  53693. }
  53694. function checkInFor (el) {
  53695. var parent = el;
  53696. while (parent) {
  53697. if (parent.for !== undefined) {
  53698. return true
  53699. }
  53700. parent = parent.parent;
  53701. }
  53702. return false
  53703. }
  53704. function parseModifiers (name) {
  53705. var match = name.match(modifierRE);
  53706. if (match) {
  53707. var ret = {};
  53708. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53709. return ret
  53710. }
  53711. }
  53712. function makeAttrsMap (attrs) {
  53713. var map = {};
  53714. for (var i = 0, l = attrs.length; i < l; i++) {
  53715. if (
  53716. map[attrs[i].name] && !isIE && !isEdge
  53717. ) {
  53718. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53719. }
  53720. map[attrs[i].name] = attrs[i].value;
  53721. }
  53722. return map
  53723. }
  53724. // for script (e.g. type="x/template") or style, do not decode content
  53725. function isTextTag (el) {
  53726. return el.tag === 'script' || el.tag === 'style'
  53727. }
  53728. function isForbiddenTag (el) {
  53729. return (
  53730. el.tag === 'style' ||
  53731. (el.tag === 'script' && (
  53732. !el.attrsMap.type ||
  53733. el.attrsMap.type === 'text/javascript'
  53734. ))
  53735. )
  53736. }
  53737. var ieNSBug = /^xmlns:NS\d+/;
  53738. var ieNSPrefix = /^NS\d+:/;
  53739. /* istanbul ignore next */
  53740. function guardIESVGBug (attrs) {
  53741. var res = [];
  53742. for (var i = 0; i < attrs.length; i++) {
  53743. var attr = attrs[i];
  53744. if (!ieNSBug.test(attr.name)) {
  53745. attr.name = attr.name.replace(ieNSPrefix, '');
  53746. res.push(attr);
  53747. }
  53748. }
  53749. return res
  53750. }
  53751. function checkForAliasModel (el, value) {
  53752. var _el = el;
  53753. while (_el) {
  53754. if (_el.for && _el.alias === value) {
  53755. warn$2(
  53756. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53757. "You are binding v-model directly to a v-for iteration alias. " +
  53758. "This will not be able to modify the v-for source array because " +
  53759. "writing to the alias is like modifying a function local variable. " +
  53760. "Consider using an array of objects and use v-model on an object property instead.",
  53761. el.rawAttrsMap['v-model']
  53762. );
  53763. }
  53764. _el = _el.parent;
  53765. }
  53766. }
  53767. /* */
  53768. function preTransformNode (el, options) {
  53769. if (el.tag === 'input') {
  53770. var map = el.attrsMap;
  53771. if (!map['v-model']) {
  53772. return
  53773. }
  53774. var typeBinding;
  53775. if (map[':type'] || map['v-bind:type']) {
  53776. typeBinding = getBindingAttr(el, 'type');
  53777. }
  53778. if (!map.type && !typeBinding && map['v-bind']) {
  53779. typeBinding = "(" + (map['v-bind']) + ").type";
  53780. }
  53781. if (typeBinding) {
  53782. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  53783. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  53784. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  53785. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  53786. // 1. checkbox
  53787. var branch0 = cloneASTElement(el);
  53788. // process for on the main node
  53789. processFor(branch0);
  53790. addRawAttr(branch0, 'type', 'checkbox');
  53791. processElement(branch0, options);
  53792. branch0.processed = true; // prevent it from double-processed
  53793. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  53794. addIfCondition(branch0, {
  53795. exp: branch0.if,
  53796. block: branch0
  53797. });
  53798. // 2. add radio else-if condition
  53799. var branch1 = cloneASTElement(el);
  53800. getAndRemoveAttr(branch1, 'v-for', true);
  53801. addRawAttr(branch1, 'type', 'radio');
  53802. processElement(branch1, options);
  53803. addIfCondition(branch0, {
  53804. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  53805. block: branch1
  53806. });
  53807. // 3. other
  53808. var branch2 = cloneASTElement(el);
  53809. getAndRemoveAttr(branch2, 'v-for', true);
  53810. addRawAttr(branch2, ':type', typeBinding);
  53811. processElement(branch2, options);
  53812. addIfCondition(branch0, {
  53813. exp: ifCondition,
  53814. block: branch2
  53815. });
  53816. if (hasElse) {
  53817. branch0.else = true;
  53818. } else if (elseIfCondition) {
  53819. branch0.elseif = elseIfCondition;
  53820. }
  53821. return branch0
  53822. }
  53823. }
  53824. }
  53825. function cloneASTElement (el) {
  53826. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  53827. }
  53828. var model$1 = {
  53829. preTransformNode: preTransformNode
  53830. };
  53831. var modules$1 = [
  53832. klass$1,
  53833. style$1,
  53834. model$1
  53835. ];
  53836. /* */
  53837. function text (el, dir) {
  53838. if (dir.value) {
  53839. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  53840. }
  53841. }
  53842. /* */
  53843. function html (el, dir) {
  53844. if (dir.value) {
  53845. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  53846. }
  53847. }
  53848. var directives$1 = {
  53849. model: model,
  53850. text: text,
  53851. html: html
  53852. };
  53853. /* */
  53854. var baseOptions = {
  53855. expectHTML: true,
  53856. modules: modules$1,
  53857. directives: directives$1,
  53858. isPreTag: isPreTag,
  53859. isUnaryTag: isUnaryTag,
  53860. mustUseProp: mustUseProp,
  53861. canBeLeftOpenTag: canBeLeftOpenTag,
  53862. isReservedTag: isReservedTag,
  53863. getTagNamespace: getTagNamespace,
  53864. staticKeys: genStaticKeys(modules$1)
  53865. };
  53866. /* */
  53867. var isStaticKey;
  53868. var isPlatformReservedTag;
  53869. var genStaticKeysCached = cached(genStaticKeys$1);
  53870. /**
  53871. * Goal of the optimizer: walk the generated template AST tree
  53872. * and detect sub-trees that are purely static, i.e. parts of
  53873. * the DOM that never needs to change.
  53874. *
  53875. * Once we detect these sub-trees, we can:
  53876. *
  53877. * 1. Hoist them into constants, so that we no longer need to
  53878. * create fresh nodes for them on each re-render;
  53879. * 2. Completely skip them in the patching process.
  53880. */
  53881. function optimize (root, options) {
  53882. if (!root) { return }
  53883. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  53884. isPlatformReservedTag = options.isReservedTag || no;
  53885. // first pass: mark all non-static nodes.
  53886. markStatic$1(root);
  53887. // second pass: mark static roots.
  53888. markStaticRoots(root, false);
  53889. }
  53890. function genStaticKeys$1 (keys) {
  53891. return makeMap(
  53892. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  53893. (keys ? ',' + keys : '')
  53894. )
  53895. }
  53896. function markStatic$1 (node) {
  53897. node.static = isStatic(node);
  53898. if (node.type === 1) {
  53899. // do not make component slot content static. this avoids
  53900. // 1. components not able to mutate slot nodes
  53901. // 2. static slot content fails for hot-reloading
  53902. if (
  53903. !isPlatformReservedTag(node.tag) &&
  53904. node.tag !== 'slot' &&
  53905. node.attrsMap['inline-template'] == null
  53906. ) {
  53907. return
  53908. }
  53909. for (var i = 0, l = node.children.length; i < l; i++) {
  53910. var child = node.children[i];
  53911. markStatic$1(child);
  53912. if (!child.static) {
  53913. node.static = false;
  53914. }
  53915. }
  53916. if (node.ifConditions) {
  53917. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53918. var block = node.ifConditions[i$1].block;
  53919. markStatic$1(block);
  53920. if (!block.static) {
  53921. node.static = false;
  53922. }
  53923. }
  53924. }
  53925. }
  53926. }
  53927. function markStaticRoots (node, isInFor) {
  53928. if (node.type === 1) {
  53929. if (node.static || node.once) {
  53930. node.staticInFor = isInFor;
  53931. }
  53932. // For a node to qualify as a static root, it should have children that
  53933. // are not just static text. Otherwise the cost of hoisting out will
  53934. // outweigh the benefits and it's better off to just always render it fresh.
  53935. if (node.static && node.children.length && !(
  53936. node.children.length === 1 &&
  53937. node.children[0].type === 3
  53938. )) {
  53939. node.staticRoot = true;
  53940. return
  53941. } else {
  53942. node.staticRoot = false;
  53943. }
  53944. if (node.children) {
  53945. for (var i = 0, l = node.children.length; i < l; i++) {
  53946. markStaticRoots(node.children[i], isInFor || !!node.for);
  53947. }
  53948. }
  53949. if (node.ifConditions) {
  53950. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53951. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  53952. }
  53953. }
  53954. }
  53955. }
  53956. function isStatic (node) {
  53957. if (node.type === 2) { // expression
  53958. return false
  53959. }
  53960. if (node.type === 3) { // text
  53961. return true
  53962. }
  53963. return !!(node.pre || (
  53964. !node.hasBindings && // no dynamic bindings
  53965. !node.if && !node.for && // not v-if or v-for or v-else
  53966. !isBuiltInTag(node.tag) && // not a built-in
  53967. isPlatformReservedTag(node.tag) && // not a component
  53968. !isDirectChildOfTemplateFor(node) &&
  53969. Object.keys(node).every(isStaticKey)
  53970. ))
  53971. }
  53972. function isDirectChildOfTemplateFor (node) {
  53973. while (node.parent) {
  53974. node = node.parent;
  53975. if (node.tag !== 'template') {
  53976. return false
  53977. }
  53978. if (node.for) {
  53979. return true
  53980. }
  53981. }
  53982. return false
  53983. }
  53984. /* */
  53985. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  53986. var fnInvokeRE = /\([^)]*?\);*$/;
  53987. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  53988. // KeyboardEvent.keyCode aliases
  53989. var keyCodes = {
  53990. esc: 27,
  53991. tab: 9,
  53992. enter: 13,
  53993. space: 32,
  53994. up: 38,
  53995. left: 37,
  53996. right: 39,
  53997. down: 40,
  53998. 'delete': [8, 46]
  53999. };
  54000. // KeyboardEvent.key aliases
  54001. var keyNames = {
  54002. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54003. esc: ['Esc', 'Escape'],
  54004. tab: 'Tab',
  54005. enter: 'Enter',
  54006. // #9112: IE11 uses `Spacebar` for Space key name.
  54007. space: [' ', 'Spacebar'],
  54008. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54009. up: ['Up', 'ArrowUp'],
  54010. left: ['Left', 'ArrowLeft'],
  54011. right: ['Right', 'ArrowRight'],
  54012. down: ['Down', 'ArrowDown'],
  54013. // #9112: IE11 uses `Del` for Delete key name.
  54014. 'delete': ['Backspace', 'Delete', 'Del']
  54015. };
  54016. // #4868: modifiers that prevent the execution of the listener
  54017. // need to explicitly return null so that we can determine whether to remove
  54018. // the listener for .once
  54019. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54020. var modifierCode = {
  54021. stop: '$event.stopPropagation();',
  54022. prevent: '$event.preventDefault();',
  54023. self: genGuard("$event.target !== $event.currentTarget"),
  54024. ctrl: genGuard("!$event.ctrlKey"),
  54025. shift: genGuard("!$event.shiftKey"),
  54026. alt: genGuard("!$event.altKey"),
  54027. meta: genGuard("!$event.metaKey"),
  54028. left: genGuard("'button' in $event && $event.button !== 0"),
  54029. middle: genGuard("'button' in $event && $event.button !== 1"),
  54030. right: genGuard("'button' in $event && $event.button !== 2")
  54031. };
  54032. function genHandlers (
  54033. events,
  54034. isNative
  54035. ) {
  54036. var prefix = isNative ? 'nativeOn:' : 'on:';
  54037. var staticHandlers = "";
  54038. var dynamicHandlers = "";
  54039. for (var name in events) {
  54040. var handlerCode = genHandler(events[name]);
  54041. if (events[name] && events[name].dynamic) {
  54042. dynamicHandlers += name + "," + handlerCode + ",";
  54043. } else {
  54044. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54045. }
  54046. }
  54047. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54048. if (dynamicHandlers) {
  54049. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54050. } else {
  54051. return prefix + staticHandlers
  54052. }
  54053. }
  54054. function genHandler (handler) {
  54055. if (!handler) {
  54056. return 'function(){}'
  54057. }
  54058. if (Array.isArray(handler)) {
  54059. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54060. }
  54061. var isMethodPath = simplePathRE.test(handler.value);
  54062. var isFunctionExpression = fnExpRE.test(handler.value);
  54063. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54064. if (!handler.modifiers) {
  54065. if (isMethodPath || isFunctionExpression) {
  54066. return handler.value
  54067. }
  54068. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54069. } else {
  54070. var code = '';
  54071. var genModifierCode = '';
  54072. var keys = [];
  54073. for (var key in handler.modifiers) {
  54074. if (modifierCode[key]) {
  54075. genModifierCode += modifierCode[key];
  54076. // left/right
  54077. if (keyCodes[key]) {
  54078. keys.push(key);
  54079. }
  54080. } else if (key === 'exact') {
  54081. var modifiers = (handler.modifiers);
  54082. genModifierCode += genGuard(
  54083. ['ctrl', 'shift', 'alt', 'meta']
  54084. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54085. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54086. .join('||')
  54087. );
  54088. } else {
  54089. keys.push(key);
  54090. }
  54091. }
  54092. if (keys.length) {
  54093. code += genKeyFilter(keys);
  54094. }
  54095. // Make sure modifiers like prevent and stop get executed after key filtering
  54096. if (genModifierCode) {
  54097. code += genModifierCode;
  54098. }
  54099. var handlerCode = isMethodPath
  54100. ? ("return " + (handler.value) + "($event)")
  54101. : isFunctionExpression
  54102. ? ("return (" + (handler.value) + ")($event)")
  54103. : isFunctionInvocation
  54104. ? ("return " + (handler.value))
  54105. : handler.value;
  54106. return ("function($event){" + code + handlerCode + "}")
  54107. }
  54108. }
  54109. function genKeyFilter (keys) {
  54110. return (
  54111. // make sure the key filters only apply to KeyboardEvents
  54112. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54113. // key events that do not have keyCode property...
  54114. "if(!$event.type.indexOf('key')&&" +
  54115. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54116. )
  54117. }
  54118. function genFilterCode (key) {
  54119. var keyVal = parseInt(key, 10);
  54120. if (keyVal) {
  54121. return ("$event.keyCode!==" + keyVal)
  54122. }
  54123. var keyCode = keyCodes[key];
  54124. var keyName = keyNames[key];
  54125. return (
  54126. "_k($event.keyCode," +
  54127. (JSON.stringify(key)) + "," +
  54128. (JSON.stringify(keyCode)) + "," +
  54129. "$event.key," +
  54130. "" + (JSON.stringify(keyName)) +
  54131. ")"
  54132. )
  54133. }
  54134. /* */
  54135. function on (el, dir) {
  54136. if (dir.modifiers) {
  54137. warn("v-on without argument does not support modifiers.");
  54138. }
  54139. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54140. }
  54141. /* */
  54142. function bind$1 (el, dir) {
  54143. el.wrapData = function (code) {
  54144. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54145. };
  54146. }
  54147. /* */
  54148. var baseDirectives = {
  54149. on: on,
  54150. bind: bind$1,
  54151. cloak: noop
  54152. };
  54153. /* */
  54154. var CodegenState = function CodegenState (options) {
  54155. this.options = options;
  54156. this.warn = options.warn || baseWarn;
  54157. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54158. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54159. this.directives = extend(extend({}, baseDirectives), options.directives);
  54160. var isReservedTag = options.isReservedTag || no;
  54161. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54162. this.onceId = 0;
  54163. this.staticRenderFns = [];
  54164. this.pre = false;
  54165. };
  54166. function generate (
  54167. ast,
  54168. options
  54169. ) {
  54170. var state = new CodegenState(options);
  54171. var code = ast ? genElement(ast, state) : '_c("div")';
  54172. return {
  54173. render: ("with(this){return " + code + "}"),
  54174. staticRenderFns: state.staticRenderFns
  54175. }
  54176. }
  54177. function genElement (el, state) {
  54178. if (el.parent) {
  54179. el.pre = el.pre || el.parent.pre;
  54180. }
  54181. if (el.staticRoot && !el.staticProcessed) {
  54182. return genStatic(el, state)
  54183. } else if (el.once && !el.onceProcessed) {
  54184. return genOnce(el, state)
  54185. } else if (el.for && !el.forProcessed) {
  54186. return genFor(el, state)
  54187. } else if (el.if && !el.ifProcessed) {
  54188. return genIf(el, state)
  54189. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54190. return genChildren(el, state) || 'void 0'
  54191. } else if (el.tag === 'slot') {
  54192. return genSlot(el, state)
  54193. } else {
  54194. // component or element
  54195. var code;
  54196. if (el.component) {
  54197. code = genComponent(el.component, el, state);
  54198. } else {
  54199. var data;
  54200. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54201. data = genData$2(el, state);
  54202. }
  54203. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54204. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54205. }
  54206. // module transforms
  54207. for (var i = 0; i < state.transforms.length; i++) {
  54208. code = state.transforms[i](el, code);
  54209. }
  54210. return code
  54211. }
  54212. }
  54213. // hoist static sub-trees out
  54214. function genStatic (el, state) {
  54215. el.staticProcessed = true;
  54216. // Some elements (templates) need to behave differently inside of a v-pre
  54217. // node. All pre nodes are static roots, so we can use this as a location to
  54218. // wrap a state change and reset it upon exiting the pre node.
  54219. var originalPreState = state.pre;
  54220. if (el.pre) {
  54221. state.pre = el.pre;
  54222. }
  54223. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54224. state.pre = originalPreState;
  54225. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54226. }
  54227. // v-once
  54228. function genOnce (el, state) {
  54229. el.onceProcessed = true;
  54230. if (el.if && !el.ifProcessed) {
  54231. return genIf(el, state)
  54232. } else if (el.staticInFor) {
  54233. var key = '';
  54234. var parent = el.parent;
  54235. while (parent) {
  54236. if (parent.for) {
  54237. key = parent.key;
  54238. break
  54239. }
  54240. parent = parent.parent;
  54241. }
  54242. if (!key) {
  54243. state.warn(
  54244. "v-once can only be used inside v-for that is keyed. ",
  54245. el.rawAttrsMap['v-once']
  54246. );
  54247. return genElement(el, state)
  54248. }
  54249. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54250. } else {
  54251. return genStatic(el, state)
  54252. }
  54253. }
  54254. function genIf (
  54255. el,
  54256. state,
  54257. altGen,
  54258. altEmpty
  54259. ) {
  54260. el.ifProcessed = true; // avoid recursion
  54261. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54262. }
  54263. function genIfConditions (
  54264. conditions,
  54265. state,
  54266. altGen,
  54267. altEmpty
  54268. ) {
  54269. if (!conditions.length) {
  54270. return altEmpty || '_e()'
  54271. }
  54272. var condition = conditions.shift();
  54273. if (condition.exp) {
  54274. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54275. } else {
  54276. return ("" + (genTernaryExp(condition.block)))
  54277. }
  54278. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54279. function genTernaryExp (el) {
  54280. return altGen
  54281. ? altGen(el, state)
  54282. : el.once
  54283. ? genOnce(el, state)
  54284. : genElement(el, state)
  54285. }
  54286. }
  54287. function genFor (
  54288. el,
  54289. state,
  54290. altGen,
  54291. altHelper
  54292. ) {
  54293. var exp = el.for;
  54294. var alias = el.alias;
  54295. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54296. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54297. if (state.maybeComponent(el) &&
  54298. el.tag !== 'slot' &&
  54299. el.tag !== 'template' &&
  54300. !el.key
  54301. ) {
  54302. state.warn(
  54303. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54304. "v-for should have explicit keys. " +
  54305. "See https://vuejs.org/guide/list.html#key for more info.",
  54306. el.rawAttrsMap['v-for'],
  54307. true /* tip */
  54308. );
  54309. }
  54310. el.forProcessed = true; // avoid recursion
  54311. return (altHelper || '_l') + "((" + exp + ")," +
  54312. "function(" + alias + iterator1 + iterator2 + "){" +
  54313. "return " + ((altGen || genElement)(el, state)) +
  54314. '})'
  54315. }
  54316. function genData$2 (el, state) {
  54317. var data = '{';
  54318. // directives first.
  54319. // directives may mutate the el's other properties before they are generated.
  54320. var dirs = genDirectives(el, state);
  54321. if (dirs) { data += dirs + ','; }
  54322. // key
  54323. if (el.key) {
  54324. data += "key:" + (el.key) + ",";
  54325. }
  54326. // ref
  54327. if (el.ref) {
  54328. data += "ref:" + (el.ref) + ",";
  54329. }
  54330. if (el.refInFor) {
  54331. data += "refInFor:true,";
  54332. }
  54333. // pre
  54334. if (el.pre) {
  54335. data += "pre:true,";
  54336. }
  54337. // record original tag name for components using "is" attribute
  54338. if (el.component) {
  54339. data += "tag:\"" + (el.tag) + "\",";
  54340. }
  54341. // module data generation functions
  54342. for (var i = 0; i < state.dataGenFns.length; i++) {
  54343. data += state.dataGenFns[i](el);
  54344. }
  54345. // attributes
  54346. if (el.attrs) {
  54347. data += "attrs:" + (genProps(el.attrs)) + ",";
  54348. }
  54349. // DOM props
  54350. if (el.props) {
  54351. data += "domProps:" + (genProps(el.props)) + ",";
  54352. }
  54353. // event handlers
  54354. if (el.events) {
  54355. data += (genHandlers(el.events, false)) + ",";
  54356. }
  54357. if (el.nativeEvents) {
  54358. data += (genHandlers(el.nativeEvents, true)) + ",";
  54359. }
  54360. // slot target
  54361. // only for non-scoped slots
  54362. if (el.slotTarget && !el.slotScope) {
  54363. data += "slot:" + (el.slotTarget) + ",";
  54364. }
  54365. // scoped slots
  54366. if (el.scopedSlots) {
  54367. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54368. }
  54369. // component v-model
  54370. if (el.model) {
  54371. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54372. }
  54373. // inline-template
  54374. if (el.inlineTemplate) {
  54375. var inlineTemplate = genInlineTemplate(el, state);
  54376. if (inlineTemplate) {
  54377. data += inlineTemplate + ",";
  54378. }
  54379. }
  54380. data = data.replace(/,$/, '') + '}';
  54381. // v-bind dynamic argument wrap
  54382. // v-bind with dynamic arguments must be applied using the same v-bind object
  54383. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54384. if (el.dynamicAttrs) {
  54385. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54386. }
  54387. // v-bind data wrap
  54388. if (el.wrapData) {
  54389. data = el.wrapData(data);
  54390. }
  54391. // v-on data wrap
  54392. if (el.wrapListeners) {
  54393. data = el.wrapListeners(data);
  54394. }
  54395. return data
  54396. }
  54397. function genDirectives (el, state) {
  54398. var dirs = el.directives;
  54399. if (!dirs) { return }
  54400. var res = 'directives:[';
  54401. var hasRuntime = false;
  54402. var i, l, dir, needRuntime;
  54403. for (i = 0, l = dirs.length; i < l; i++) {
  54404. dir = dirs[i];
  54405. needRuntime = true;
  54406. var gen = state.directives[dir.name];
  54407. if (gen) {
  54408. // compile-time directive that manipulates AST.
  54409. // returns true if it also needs a runtime counterpart.
  54410. needRuntime = !!gen(el, dir, state.warn);
  54411. }
  54412. if (needRuntime) {
  54413. hasRuntime = true;
  54414. 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))) : '') + "},";
  54415. }
  54416. }
  54417. if (hasRuntime) {
  54418. return res.slice(0, -1) + ']'
  54419. }
  54420. }
  54421. function genInlineTemplate (el, state) {
  54422. var ast = el.children[0];
  54423. if (el.children.length !== 1 || ast.type !== 1) {
  54424. state.warn(
  54425. 'Inline-template components must have exactly one child element.',
  54426. { start: el.start }
  54427. );
  54428. }
  54429. if (ast && ast.type === 1) {
  54430. var inlineRenderFns = generate(ast, state.options);
  54431. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54432. }
  54433. }
  54434. function genScopedSlots (
  54435. el,
  54436. slots,
  54437. state
  54438. ) {
  54439. // by default scoped slots are considered "stable", this allows child
  54440. // components with only scoped slots to skip forced updates from parent.
  54441. // but in some cases we have to bail-out of this optimization
  54442. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54443. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54444. var slot = slots[key];
  54445. return (
  54446. slot.slotTargetDynamic ||
  54447. slot.if ||
  54448. slot.for ||
  54449. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54450. )
  54451. });
  54452. // #9534: if a component with scoped slots is inside a conditional branch,
  54453. // it's possible for the same component to be reused but with different
  54454. // compiled slot content. To avoid that, we generate a unique key based on
  54455. // the generated code of all the slot contents.
  54456. var needsKey = !!el.if;
  54457. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54458. // disconnected due to the intermediate scope variable)
  54459. // #9438, #9506
  54460. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54461. // and skip force updating ones that do not actually use scope variables.
  54462. if (!needsForceUpdate) {
  54463. var parent = el.parent;
  54464. while (parent) {
  54465. if (
  54466. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54467. parent.for
  54468. ) {
  54469. needsForceUpdate = true;
  54470. break
  54471. }
  54472. if (parent.if) {
  54473. needsKey = true;
  54474. }
  54475. parent = parent.parent;
  54476. }
  54477. }
  54478. var generatedSlots = Object.keys(slots)
  54479. .map(function (key) { return genScopedSlot(slots[key], state); })
  54480. .join(',');
  54481. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54482. }
  54483. function hash(str) {
  54484. var hash = 5381;
  54485. var i = str.length;
  54486. while(i) {
  54487. hash = (hash * 33) ^ str.charCodeAt(--i);
  54488. }
  54489. return hash >>> 0
  54490. }
  54491. function containsSlotChild (el) {
  54492. if (el.type === 1) {
  54493. if (el.tag === 'slot') {
  54494. return true
  54495. }
  54496. return el.children.some(containsSlotChild)
  54497. }
  54498. return false
  54499. }
  54500. function genScopedSlot (
  54501. el,
  54502. state
  54503. ) {
  54504. var isLegacySyntax = el.attrsMap['slot-scope'];
  54505. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54506. return genIf(el, state, genScopedSlot, "null")
  54507. }
  54508. if (el.for && !el.forProcessed) {
  54509. return genFor(el, state, genScopedSlot)
  54510. }
  54511. var slotScope = el.slotScope === emptySlotScopeToken
  54512. ? ""
  54513. : String(el.slotScope);
  54514. var fn = "function(" + slotScope + "){" +
  54515. "return " + (el.tag === 'template'
  54516. ? el.if && isLegacySyntax
  54517. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54518. : genChildren(el, state) || 'undefined'
  54519. : genElement(el, state)) + "}";
  54520. // reverse proxy v-slot without scope on this.$slots
  54521. var reverseProxy = slotScope ? "" : ",proxy:true";
  54522. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54523. }
  54524. function genChildren (
  54525. el,
  54526. state,
  54527. checkSkip,
  54528. altGenElement,
  54529. altGenNode
  54530. ) {
  54531. var children = el.children;
  54532. if (children.length) {
  54533. var el$1 = children[0];
  54534. // optimize single v-for
  54535. if (children.length === 1 &&
  54536. el$1.for &&
  54537. el$1.tag !== 'template' &&
  54538. el$1.tag !== 'slot'
  54539. ) {
  54540. var normalizationType = checkSkip
  54541. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54542. : "";
  54543. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54544. }
  54545. var normalizationType$1 = checkSkip
  54546. ? getNormalizationType(children, state.maybeComponent)
  54547. : 0;
  54548. var gen = altGenNode || genNode;
  54549. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54550. }
  54551. }
  54552. // determine the normalization needed for the children array.
  54553. // 0: no normalization needed
  54554. // 1: simple normalization needed (possible 1-level deep nested array)
  54555. // 2: full normalization needed
  54556. function getNormalizationType (
  54557. children,
  54558. maybeComponent
  54559. ) {
  54560. var res = 0;
  54561. for (var i = 0; i < children.length; i++) {
  54562. var el = children[i];
  54563. if (el.type !== 1) {
  54564. continue
  54565. }
  54566. if (needsNormalization(el) ||
  54567. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54568. res = 2;
  54569. break
  54570. }
  54571. if (maybeComponent(el) ||
  54572. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54573. res = 1;
  54574. }
  54575. }
  54576. return res
  54577. }
  54578. function needsNormalization (el) {
  54579. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54580. }
  54581. function genNode (node, state) {
  54582. if (node.type === 1) {
  54583. return genElement(node, state)
  54584. } else if (node.type === 3 && node.isComment) {
  54585. return genComment(node)
  54586. } else {
  54587. return genText(node)
  54588. }
  54589. }
  54590. function genText (text) {
  54591. return ("_v(" + (text.type === 2
  54592. ? text.expression // no need for () because already wrapped in _s()
  54593. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54594. }
  54595. function genComment (comment) {
  54596. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54597. }
  54598. function genSlot (el, state) {
  54599. var slotName = el.slotName || '"default"';
  54600. var children = genChildren(el, state);
  54601. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54602. var attrs = el.attrs || el.dynamicAttrs
  54603. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54604. // slot props are camelized
  54605. name: camelize(attr.name),
  54606. value: attr.value,
  54607. dynamic: attr.dynamic
  54608. }); }))
  54609. : null;
  54610. var bind$$1 = el.attrsMap['v-bind'];
  54611. if ((attrs || bind$$1) && !children) {
  54612. res += ",null";
  54613. }
  54614. if (attrs) {
  54615. res += "," + attrs;
  54616. }
  54617. if (bind$$1) {
  54618. res += (attrs ? '' : ',null') + "," + bind$$1;
  54619. }
  54620. return res + ')'
  54621. }
  54622. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54623. function genComponent (
  54624. componentName,
  54625. el,
  54626. state
  54627. ) {
  54628. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54629. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54630. }
  54631. function genProps (props) {
  54632. var staticProps = "";
  54633. var dynamicProps = "";
  54634. for (var i = 0; i < props.length; i++) {
  54635. var prop = props[i];
  54636. var value = transformSpecialNewlines(prop.value);
  54637. if (prop.dynamic) {
  54638. dynamicProps += (prop.name) + "," + value + ",";
  54639. } else {
  54640. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54641. }
  54642. }
  54643. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54644. if (dynamicProps) {
  54645. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54646. } else {
  54647. return staticProps
  54648. }
  54649. }
  54650. // #3895, #4268
  54651. function transformSpecialNewlines (text) {
  54652. return text
  54653. .replace(/\u2028/g, '\\u2028')
  54654. .replace(/\u2029/g, '\\u2029')
  54655. }
  54656. /* */
  54657. // these keywords should not appear inside expressions, but operators like
  54658. // typeof, instanceof and in are allowed
  54659. var prohibitedKeywordRE = new RegExp('\\b' + (
  54660. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54661. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54662. 'extends,finally,continue,debugger,function,arguments'
  54663. ).split(',').join('\\b|\\b') + '\\b');
  54664. // these unary operators should not be used as property/method names
  54665. var unaryOperatorsRE = new RegExp('\\b' + (
  54666. 'delete,typeof,void'
  54667. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54668. // strip strings in expressions
  54669. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54670. // detect problematic expressions in a template
  54671. function detectErrors (ast, warn) {
  54672. if (ast) {
  54673. checkNode(ast, warn);
  54674. }
  54675. }
  54676. function checkNode (node, warn) {
  54677. if (node.type === 1) {
  54678. for (var name in node.attrsMap) {
  54679. if (dirRE.test(name)) {
  54680. var value = node.attrsMap[name];
  54681. if (value) {
  54682. var range = node.rawAttrsMap[name];
  54683. if (name === 'v-for') {
  54684. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54685. } else if (name === 'v-slot' || name[0] === '#') {
  54686. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54687. } else if (onRE.test(name)) {
  54688. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54689. } else {
  54690. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54691. }
  54692. }
  54693. }
  54694. }
  54695. if (node.children) {
  54696. for (var i = 0; i < node.children.length; i++) {
  54697. checkNode(node.children[i], warn);
  54698. }
  54699. }
  54700. } else if (node.type === 2) {
  54701. checkExpression(node.expression, node.text, warn, node);
  54702. }
  54703. }
  54704. function checkEvent (exp, text, warn, range) {
  54705. var stripped = exp.replace(stripStringRE, '');
  54706. var keywordMatch = stripped.match(unaryOperatorsRE);
  54707. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54708. warn(
  54709. "avoid using JavaScript unary operator as property name: " +
  54710. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54711. range
  54712. );
  54713. }
  54714. checkExpression(exp, text, warn, range);
  54715. }
  54716. function checkFor (node, text, warn, range) {
  54717. checkExpression(node.for || '', text, warn, range);
  54718. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54719. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54720. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54721. }
  54722. function checkIdentifier (
  54723. ident,
  54724. type,
  54725. text,
  54726. warn,
  54727. range
  54728. ) {
  54729. if (typeof ident === 'string') {
  54730. try {
  54731. new Function(("var " + ident + "=_"));
  54732. } catch (e) {
  54733. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54734. }
  54735. }
  54736. }
  54737. function checkExpression (exp, text, warn, range) {
  54738. try {
  54739. new Function(("return " + exp));
  54740. } catch (e) {
  54741. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54742. if (keywordMatch) {
  54743. warn(
  54744. "avoid using JavaScript keyword as property name: " +
  54745. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54746. range
  54747. );
  54748. } else {
  54749. warn(
  54750. "invalid expression: " + (e.message) + " in\n\n" +
  54751. " " + exp + "\n\n" +
  54752. " Raw expression: " + (text.trim()) + "\n",
  54753. range
  54754. );
  54755. }
  54756. }
  54757. }
  54758. function checkFunctionParameterExpression (exp, text, warn, range) {
  54759. try {
  54760. new Function(exp, '');
  54761. } catch (e) {
  54762. warn(
  54763. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54764. " " + exp + "\n\n" +
  54765. " Raw expression: " + (text.trim()) + "\n",
  54766. range
  54767. );
  54768. }
  54769. }
  54770. /* */
  54771. var range = 2;
  54772. function generateCodeFrame (
  54773. source,
  54774. start,
  54775. end
  54776. ) {
  54777. if ( start === void 0 ) start = 0;
  54778. if ( end === void 0 ) end = source.length;
  54779. var lines = source.split(/\r?\n/);
  54780. var count = 0;
  54781. var res = [];
  54782. for (var i = 0; i < lines.length; i++) {
  54783. count += lines[i].length + 1;
  54784. if (count >= start) {
  54785. for (var j = i - range; j <= i + range || end > count; j++) {
  54786. if (j < 0 || j >= lines.length) { continue }
  54787. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  54788. var lineLength = lines[j].length;
  54789. if (j === i) {
  54790. // push underline
  54791. var pad = start - (count - lineLength) + 1;
  54792. var length = end > count ? lineLength - pad : end - start;
  54793. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  54794. } else if (j > i) {
  54795. if (end > count) {
  54796. var length$1 = Math.min(end - count, lineLength);
  54797. res.push(" | " + repeat$1("^", length$1));
  54798. }
  54799. count += lineLength + 1;
  54800. }
  54801. }
  54802. break
  54803. }
  54804. }
  54805. return res.join('\n')
  54806. }
  54807. function repeat$1 (str, n) {
  54808. var result = '';
  54809. if (n > 0) {
  54810. while (true) { // eslint-disable-line
  54811. if (n & 1) { result += str; }
  54812. n >>>= 1;
  54813. if (n <= 0) { break }
  54814. str += str;
  54815. }
  54816. }
  54817. return result
  54818. }
  54819. /* */
  54820. function createFunction (code, errors) {
  54821. try {
  54822. return new Function(code)
  54823. } catch (err) {
  54824. errors.push({ err: err, code: code });
  54825. return noop
  54826. }
  54827. }
  54828. function createCompileToFunctionFn (compile) {
  54829. var cache = Object.create(null);
  54830. return function compileToFunctions (
  54831. template,
  54832. options,
  54833. vm
  54834. ) {
  54835. options = extend({}, options);
  54836. var warn$$1 = options.warn || warn;
  54837. delete options.warn;
  54838. /* istanbul ignore if */
  54839. {
  54840. // detect possible CSP restriction
  54841. try {
  54842. new Function('return 1');
  54843. } catch (e) {
  54844. if (e.toString().match(/unsafe-eval|CSP/)) {
  54845. warn$$1(
  54846. 'It seems you are using the standalone build of Vue.js in an ' +
  54847. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  54848. 'The template compiler cannot work in this environment. Consider ' +
  54849. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  54850. 'templates into render functions.'
  54851. );
  54852. }
  54853. }
  54854. }
  54855. // check cache
  54856. var key = options.delimiters
  54857. ? String(options.delimiters) + template
  54858. : template;
  54859. if (cache[key]) {
  54860. return cache[key]
  54861. }
  54862. // compile
  54863. var compiled = compile(template, options);
  54864. // check compilation errors/tips
  54865. {
  54866. if (compiled.errors && compiled.errors.length) {
  54867. if (options.outputSourceRange) {
  54868. compiled.errors.forEach(function (e) {
  54869. warn$$1(
  54870. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  54871. generateCodeFrame(template, e.start, e.end),
  54872. vm
  54873. );
  54874. });
  54875. } else {
  54876. warn$$1(
  54877. "Error compiling template:\n\n" + template + "\n\n" +
  54878. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  54879. vm
  54880. );
  54881. }
  54882. }
  54883. if (compiled.tips && compiled.tips.length) {
  54884. if (options.outputSourceRange) {
  54885. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  54886. } else {
  54887. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  54888. }
  54889. }
  54890. }
  54891. // turn code into functions
  54892. var res = {};
  54893. var fnGenErrors = [];
  54894. res.render = createFunction(compiled.render, fnGenErrors);
  54895. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  54896. return createFunction(code, fnGenErrors)
  54897. });
  54898. // check function generation errors.
  54899. // this should only happen if there is a bug in the compiler itself.
  54900. // mostly for codegen development use
  54901. /* istanbul ignore if */
  54902. {
  54903. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  54904. warn$$1(
  54905. "Failed to generate render function:\n\n" +
  54906. fnGenErrors.map(function (ref) {
  54907. var err = ref.err;
  54908. var code = ref.code;
  54909. return ((err.toString()) + " in\n\n" + code + "\n");
  54910. }).join('\n'),
  54911. vm
  54912. );
  54913. }
  54914. }
  54915. return (cache[key] = res)
  54916. }
  54917. }
  54918. /* */
  54919. function createCompilerCreator (baseCompile) {
  54920. return function createCompiler (baseOptions) {
  54921. function compile (
  54922. template,
  54923. options
  54924. ) {
  54925. var finalOptions = Object.create(baseOptions);
  54926. var errors = [];
  54927. var tips = [];
  54928. var warn = function (msg, range, tip) {
  54929. (tip ? tips : errors).push(msg);
  54930. };
  54931. if (options) {
  54932. if (options.outputSourceRange) {
  54933. // $flow-disable-line
  54934. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  54935. warn = function (msg, range, tip) {
  54936. var data = { msg: msg };
  54937. if (range) {
  54938. if (range.start != null) {
  54939. data.start = range.start + leadingSpaceLength;
  54940. }
  54941. if (range.end != null) {
  54942. data.end = range.end + leadingSpaceLength;
  54943. }
  54944. }
  54945. (tip ? tips : errors).push(data);
  54946. };
  54947. }
  54948. // merge custom modules
  54949. if (options.modules) {
  54950. finalOptions.modules =
  54951. (baseOptions.modules || []).concat(options.modules);
  54952. }
  54953. // merge custom directives
  54954. if (options.directives) {
  54955. finalOptions.directives = extend(
  54956. Object.create(baseOptions.directives || null),
  54957. options.directives
  54958. );
  54959. }
  54960. // copy other options
  54961. for (var key in options) {
  54962. if (key !== 'modules' && key !== 'directives') {
  54963. finalOptions[key] = options[key];
  54964. }
  54965. }
  54966. }
  54967. finalOptions.warn = warn;
  54968. var compiled = baseCompile(template.trim(), finalOptions);
  54969. {
  54970. detectErrors(compiled.ast, warn);
  54971. }
  54972. compiled.errors = errors;
  54973. compiled.tips = tips;
  54974. return compiled
  54975. }
  54976. return {
  54977. compile: compile,
  54978. compileToFunctions: createCompileToFunctionFn(compile)
  54979. }
  54980. }
  54981. }
  54982. /* */
  54983. // `createCompilerCreator` allows creating compilers that use alternative
  54984. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  54985. // Here we just export a default compiler using the default parts.
  54986. var createCompiler = createCompilerCreator(function baseCompile (
  54987. template,
  54988. options
  54989. ) {
  54990. var ast = parse(template.trim(), options);
  54991. if (options.optimize !== false) {
  54992. optimize(ast, options);
  54993. }
  54994. var code = generate(ast, options);
  54995. return {
  54996. ast: ast,
  54997. render: code.render,
  54998. staticRenderFns: code.staticRenderFns
  54999. }
  55000. });
  55001. /* */
  55002. var ref$1 = createCompiler(baseOptions);
  55003. var compile = ref$1.compile;
  55004. var compileToFunctions = ref$1.compileToFunctions;
  55005. /* */
  55006. // check whether current browser encodes a char inside attribute values
  55007. var div;
  55008. function getShouldDecode (href) {
  55009. div = div || document.createElement('div');
  55010. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55011. return div.innerHTML.indexOf('&#10;') > 0
  55012. }
  55013. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55014. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55015. // #6828: chrome encodes content in a[href]
  55016. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55017. /* */
  55018. var idToTemplate = cached(function (id) {
  55019. var el = query(id);
  55020. return el && el.innerHTML
  55021. });
  55022. var mount = Vue.prototype.$mount;
  55023. Vue.prototype.$mount = function (
  55024. el,
  55025. hydrating
  55026. ) {
  55027. el = el && query(el);
  55028. /* istanbul ignore if */
  55029. if (el === document.body || el === document.documentElement) {
  55030. warn(
  55031. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55032. );
  55033. return this
  55034. }
  55035. var options = this.$options;
  55036. // resolve template/el and convert to render function
  55037. if (!options.render) {
  55038. var template = options.template;
  55039. if (template) {
  55040. if (typeof template === 'string') {
  55041. if (template.charAt(0) === '#') {
  55042. template = idToTemplate(template);
  55043. /* istanbul ignore if */
  55044. if (!template) {
  55045. warn(
  55046. ("Template element not found or is empty: " + (options.template)),
  55047. this
  55048. );
  55049. }
  55050. }
  55051. } else if (template.nodeType) {
  55052. template = template.innerHTML;
  55053. } else {
  55054. {
  55055. warn('invalid template option:' + template, this);
  55056. }
  55057. return this
  55058. }
  55059. } else if (el) {
  55060. template = getOuterHTML(el);
  55061. }
  55062. if (template) {
  55063. /* istanbul ignore if */
  55064. if (config.performance && mark) {
  55065. mark('compile');
  55066. }
  55067. var ref = compileToFunctions(template, {
  55068. outputSourceRange: "development" !== 'production',
  55069. shouldDecodeNewlines: shouldDecodeNewlines,
  55070. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55071. delimiters: options.delimiters,
  55072. comments: options.comments
  55073. }, this);
  55074. var render = ref.render;
  55075. var staticRenderFns = ref.staticRenderFns;
  55076. options.render = render;
  55077. options.staticRenderFns = staticRenderFns;
  55078. /* istanbul ignore if */
  55079. if (config.performance && mark) {
  55080. mark('compile end');
  55081. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55082. }
  55083. }
  55084. }
  55085. return mount.call(this, el, hydrating)
  55086. };
  55087. /**
  55088. * Get outerHTML of elements, taking care
  55089. * of SVG elements in IE as well.
  55090. */
  55091. function getOuterHTML (el) {
  55092. if (el.outerHTML) {
  55093. return el.outerHTML
  55094. } else {
  55095. var container = document.createElement('div');
  55096. container.appendChild(el.cloneNode(true));
  55097. return container.innerHTML
  55098. }
  55099. }
  55100. Vue.compile = compileToFunctions;
  55101. module.exports = Vue;
  55102. /* 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))
  55103. /***/ }),
  55104. /***/ "./node_modules/vue/dist/vue.common.js":
  55105. /*!*********************************************!*\
  55106. !*** ./node_modules/vue/dist/vue.common.js ***!
  55107. \*********************************************/
  55108. /*! no static exports found */
  55109. /***/ (function(module, exports, __webpack_require__) {
  55110. if (false) {} else {
  55111. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55112. }
  55113. /***/ }),
  55114. /***/ "./node_modules/webpack/buildin/global.js":
  55115. /*!***********************************!*\
  55116. !*** (webpack)/buildin/global.js ***!
  55117. \***********************************/
  55118. /*! no static exports found */
  55119. /***/ (function(module, exports) {
  55120. var g;
  55121. // This works in non-strict mode
  55122. g = (function() {
  55123. return this;
  55124. })();
  55125. try {
  55126. // This works if eval is allowed (see CSP)
  55127. g = g || new Function("return this")();
  55128. } catch (e) {
  55129. // This works if the window reference is available
  55130. if (typeof window === "object") g = window;
  55131. }
  55132. // g can still be undefined, but nothing to do about it...
  55133. // We return undefined, instead of nothing here, so it's
  55134. // easier to handle this case. if(!global) { ...}
  55135. module.exports = g;
  55136. /***/ }),
  55137. /***/ "./node_modules/webpack/buildin/module.js":
  55138. /*!***********************************!*\
  55139. !*** (webpack)/buildin/module.js ***!
  55140. \***********************************/
  55141. /*! no static exports found */
  55142. /***/ (function(module, exports) {
  55143. module.exports = function(module) {
  55144. if (!module.webpackPolyfill) {
  55145. module.deprecate = function() {};
  55146. module.paths = [];
  55147. // module.parent = undefined by default
  55148. if (!module.children) module.children = [];
  55149. Object.defineProperty(module, "loaded", {
  55150. enumerable: true,
  55151. get: function() {
  55152. return module.l;
  55153. }
  55154. });
  55155. Object.defineProperty(module, "id", {
  55156. enumerable: true,
  55157. get: function() {
  55158. return module.i;
  55159. }
  55160. });
  55161. module.webpackPolyfill = 1;
  55162. }
  55163. return module;
  55164. };
  55165. /***/ }),
  55166. /***/ "./resources/js/app.js":
  55167. /*!*****************************!*\
  55168. !*** ./resources/js/app.js ***!
  55169. \*****************************/
  55170. /*! no static exports found */
  55171. /***/ (function(module, exports, __webpack_require__) {
  55172. /**
  55173. * First we will load all of this project's JavaScript dependencies which
  55174. * includes Vue and other libraries. It is a great starting point when
  55175. * building robust, powerful web applications using Vue and Laravel.
  55176. */
  55177. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55178. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55179. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55180. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55181. /**
  55182. * The following block of code may be used to automatically register your
  55183. * Vue components. It will recursively scan this directory for the Vue
  55184. * components and automatically register them with their "basename".
  55185. *
  55186. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55187. */
  55188. // const files = require.context('./', true, /\.vue$/i)
  55189. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55190. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55191. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55192. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55193. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55194. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55195. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55196. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55197. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55198. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55199. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55200. /**
  55201. * Next, we will create a fresh Vue application instance and attach it to
  55202. * the page. Then, you may begin adding components to this application
  55203. * or customize the JavaScript scaffolding to fit your unique needs.
  55204. */
  55205. var app = new Vue({
  55206. el: '#app'
  55207. });
  55208. $(function () {
  55209. $('[data-toggle="tooltip"]').tooltip();
  55210. });
  55211. var clipboard = new Clipboard('.btn-clip');
  55212. clipboard.on('success', function (e) {
  55213. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55214. position: "right",
  55215. className: 'success'
  55216. });
  55217. e.clearSelection();
  55218. });
  55219. /***/ }),
  55220. /***/ "./resources/js/bootstrap.js":
  55221. /*!***********************************!*\
  55222. !*** ./resources/js/bootstrap.js ***!
  55223. \***********************************/
  55224. /*! no exports provided */
  55225. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55226. "use strict";
  55227. __webpack_require__.r(__webpack_exports__);
  55228. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55229. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55230. /**
  55231. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55232. * for JavaScript based Bootstrap features such as modals and tabs. This
  55233. * code may be modified to fit the specific needs of your application.
  55234. */
  55235. try {
  55236. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55237. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55238. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55239. } catch (e) {}
  55240. /**
  55241. * We'll load the axios HTTP library which allows us to easily issue requests
  55242. * to our Laravel back-end. This library automatically handles sending the
  55243. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55244. */
  55245. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55246. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55247. /**
  55248. * Echo exposes an expressive API for subscribing to channels and listening
  55249. * for events that are broadcast by Laravel. Echo and event broadcasting
  55250. * allows your team to easily build robust real-time web applications.
  55251. */
  55252. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55253. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55254. broadcaster: 'pusher',
  55255. key: "upccrt",
  55256. wsHost: window.location.hostname,
  55257. wsPort: 6001,
  55258. disableStats: true
  55259. });
  55260. /***/ }),
  55261. /***/ "./resources/js/components/ExampleComponent.vue":
  55262. /*!******************************************************!*\
  55263. !*** ./resources/js/components/ExampleComponent.vue ***!
  55264. \******************************************************/
  55265. /*! exports provided: default */
  55266. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55267. "use strict";
  55268. __webpack_require__.r(__webpack_exports__);
  55269. /* 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&");
  55270. /* 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&");
  55271. /* 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");
  55272. /* normalize component */
  55273. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55274. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55275. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55276. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55277. false,
  55278. null,
  55279. null,
  55280. null
  55281. )
  55282. /* hot reload */
  55283. if (false) { var api; }
  55284. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55285. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55286. /***/ }),
  55287. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55288. /*!*******************************************************************************!*\
  55289. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55290. \*******************************************************************************/
  55291. /*! exports provided: default */
  55292. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55293. "use strict";
  55294. __webpack_require__.r(__webpack_exports__);
  55295. /* 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&");
  55296. /* 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"]);
  55297. /***/ }),
  55298. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55299. /*!*************************************************************************************!*\
  55300. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55301. \*************************************************************************************/
  55302. /*! exports provided: render, staticRenderFns */
  55303. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55304. "use strict";
  55305. __webpack_require__.r(__webpack_exports__);
  55306. /* 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&");
  55307. /* 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"]; });
  55308. /* 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"]; });
  55309. /***/ }),
  55310. /***/ "./resources/js/components/assetinfo.vue":
  55311. /*!***********************************************!*\
  55312. !*** ./resources/js/components/assetinfo.vue ***!
  55313. \***********************************************/
  55314. /*! exports provided: default */
  55315. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55316. "use strict";
  55317. __webpack_require__.r(__webpack_exports__);
  55318. /* 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&");
  55319. /* 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&");
  55320. /* 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");
  55321. /* normalize component */
  55322. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55323. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55324. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55325. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55326. false,
  55327. null,
  55328. null,
  55329. null
  55330. )
  55331. /* hot reload */
  55332. if (false) { var api; }
  55333. component.options.__file = "resources/js/components/assetinfo.vue"
  55334. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55335. /***/ }),
  55336. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55337. /*!************************************************************************!*\
  55338. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55339. \************************************************************************/
  55340. /*! exports provided: default */
  55341. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55342. "use strict";
  55343. __webpack_require__.r(__webpack_exports__);
  55344. /* 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&");
  55345. /* 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"]);
  55346. /***/ }),
  55347. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55348. /*!******************************************************************************!*\
  55349. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55350. \******************************************************************************/
  55351. /*! exports provided: render, staticRenderFns */
  55352. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55353. "use strict";
  55354. __webpack_require__.r(__webpack_exports__);
  55355. /* 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&");
  55356. /* 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"]; });
  55357. /* 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"]; });
  55358. /***/ }),
  55359. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55360. /*!******************************************************************!*\
  55361. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55362. \******************************************************************/
  55363. /*! exports provided: default */
  55364. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55365. "use strict";
  55366. __webpack_require__.r(__webpack_exports__);
  55367. /* 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&");
  55368. /* 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&");
  55369. /* 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");
  55370. /* normalize component */
  55371. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55372. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55373. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55374. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55375. false,
  55376. null,
  55377. null,
  55378. null
  55379. )
  55380. /* hot reload */
  55381. if (false) { var api; }
  55382. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55383. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55384. /***/ }),
  55385. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55386. /*!*******************************************************************************************!*\
  55387. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55388. \*******************************************************************************************/
  55389. /*! exports provided: default */
  55390. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55391. "use strict";
  55392. __webpack_require__.r(__webpack_exports__);
  55393. /* 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&");
  55394. /* 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"]);
  55395. /***/ }),
  55396. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55397. /*!*************************************************************************************************!*\
  55398. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55399. \*************************************************************************************************/
  55400. /*! exports provided: render, staticRenderFns */
  55401. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55402. "use strict";
  55403. __webpack_require__.r(__webpack_exports__);
  55404. /* 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&");
  55405. /* 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"]; });
  55406. /* 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"]; });
  55407. /***/ }),
  55408. /***/ "./resources/js/components/credential-form-modal.vue":
  55409. /*!***********************************************************!*\
  55410. !*** ./resources/js/components/credential-form-modal.vue ***!
  55411. \***********************************************************/
  55412. /*! exports provided: default */
  55413. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55414. "use strict";
  55415. __webpack_require__.r(__webpack_exports__);
  55416. /* 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&");
  55417. /* 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&");
  55418. /* 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");
  55419. /* normalize component */
  55420. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55421. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55422. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55423. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55424. false,
  55425. null,
  55426. null,
  55427. null
  55428. )
  55429. /* hot reload */
  55430. if (false) { var api; }
  55431. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55432. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55433. /***/ }),
  55434. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55435. /*!************************************************************************************!*\
  55436. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55437. \************************************************************************************/
  55438. /*! exports provided: default */
  55439. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55440. "use strict";
  55441. __webpack_require__.r(__webpack_exports__);
  55442. /* 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&");
  55443. /* 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"]);
  55444. /***/ }),
  55445. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55446. /*!******************************************************************************************!*\
  55447. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55448. \******************************************************************************************/
  55449. /*! exports provided: render, staticRenderFns */
  55450. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55451. "use strict";
  55452. __webpack_require__.r(__webpack_exports__);
  55453. /* 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&");
  55454. /* 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"]; });
  55455. /* 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"]; });
  55456. /***/ }),
  55457. /***/ "./resources/js/components/credential.vue":
  55458. /*!************************************************!*\
  55459. !*** ./resources/js/components/credential.vue ***!
  55460. \************************************************/
  55461. /*! exports provided: default */
  55462. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55463. "use strict";
  55464. __webpack_require__.r(__webpack_exports__);
  55465. /* 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&");
  55466. /* 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&");
  55467. /* 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");
  55468. /* normalize component */
  55469. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55470. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55471. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55472. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55473. false,
  55474. null,
  55475. null,
  55476. null
  55477. )
  55478. /* hot reload */
  55479. if (false) { var api; }
  55480. component.options.__file = "resources/js/components/credential.vue"
  55481. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55482. /***/ }),
  55483. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55484. /*!*************************************************************************!*\
  55485. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55486. \*************************************************************************/
  55487. /*! exports provided: default */
  55488. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55489. "use strict";
  55490. __webpack_require__.r(__webpack_exports__);
  55491. /* 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&");
  55492. /* 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"]);
  55493. /***/ }),
  55494. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55495. /*!*******************************************************************************!*\
  55496. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55497. \*******************************************************************************/
  55498. /*! exports provided: render, staticRenderFns */
  55499. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55500. "use strict";
  55501. __webpack_require__.r(__webpack_exports__);
  55502. /* 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&");
  55503. /* 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"]; });
  55504. /* 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"]; });
  55505. /***/ }),
  55506. /***/ "./resources/js/components/errorlist.vue":
  55507. /*!***********************************************!*\
  55508. !*** ./resources/js/components/errorlist.vue ***!
  55509. \***********************************************/
  55510. /*! exports provided: default */
  55511. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55512. "use strict";
  55513. __webpack_require__.r(__webpack_exports__);
  55514. /* 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&");
  55515. /* 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&");
  55516. /* 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");
  55517. /* normalize component */
  55518. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55519. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55520. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55521. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55522. false,
  55523. null,
  55524. null,
  55525. null
  55526. )
  55527. /* hot reload */
  55528. if (false) { var api; }
  55529. component.options.__file = "resources/js/components/errorlist.vue"
  55530. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55531. /***/ }),
  55532. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55533. /*!************************************************************************!*\
  55534. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55535. \************************************************************************/
  55536. /*! exports provided: default */
  55537. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55538. "use strict";
  55539. __webpack_require__.r(__webpack_exports__);
  55540. /* 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&");
  55541. /* 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"]);
  55542. /***/ }),
  55543. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55544. /*!******************************************************************************!*\
  55545. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55546. \******************************************************************************/
  55547. /*! exports provided: render, staticRenderFns */
  55548. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55549. "use strict";
  55550. __webpack_require__.r(__webpack_exports__);
  55551. /* 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&");
  55552. /* 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"]; });
  55553. /* 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"]; });
  55554. /***/ }),
  55555. /***/ "./resources/js/components/modal.vue":
  55556. /*!*******************************************!*\
  55557. !*** ./resources/js/components/modal.vue ***!
  55558. \*******************************************/
  55559. /*! exports provided: default */
  55560. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55561. "use strict";
  55562. __webpack_require__.r(__webpack_exports__);
  55563. /* 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&");
  55564. /* 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");
  55565. var script = {}
  55566. /* normalize component */
  55567. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55568. script,
  55569. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55570. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55571. false,
  55572. null,
  55573. null,
  55574. null
  55575. )
  55576. /* hot reload */
  55577. if (false) { var api; }
  55578. component.options.__file = "resources/js/components/modal.vue"
  55579. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55580. /***/ }),
  55581. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55582. /*!**************************************************************************!*\
  55583. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55584. \**************************************************************************/
  55585. /*! exports provided: render, staticRenderFns */
  55586. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55587. "use strict";
  55588. __webpack_require__.r(__webpack_exports__);
  55589. /* 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&");
  55590. /* 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"]; });
  55591. /* 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"]; });
  55592. /***/ }),
  55593. /***/ "./resources/js/components/notes.vue":
  55594. /*!*******************************************!*\
  55595. !*** ./resources/js/components/notes.vue ***!
  55596. \*******************************************/
  55597. /*! exports provided: default */
  55598. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55599. "use strict";
  55600. __webpack_require__.r(__webpack_exports__);
  55601. /* 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&");
  55602. /* 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&");
  55603. /* 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");
  55604. /* normalize component */
  55605. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55606. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55607. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55608. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55609. false,
  55610. null,
  55611. null,
  55612. null
  55613. )
  55614. /* hot reload */
  55615. if (false) { var api; }
  55616. component.options.__file = "resources/js/components/notes.vue"
  55617. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55618. /***/ }),
  55619. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  55620. /*!********************************************************************!*\
  55621. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  55622. \********************************************************************/
  55623. /*! exports provided: default */
  55624. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55625. "use strict";
  55626. __webpack_require__.r(__webpack_exports__);
  55627. /* 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&");
  55628. /* 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"]);
  55629. /***/ }),
  55630. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  55631. /*!**************************************************************************!*\
  55632. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  55633. \**************************************************************************/
  55634. /*! exports provided: render, staticRenderFns */
  55635. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55636. "use strict";
  55637. __webpack_require__.r(__webpack_exports__);
  55638. /* 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&");
  55639. /* 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"]; });
  55640. /* 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"]; });
  55641. /***/ }),
  55642. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  55643. /*!*******************************************************!*\
  55644. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  55645. \*******************************************************/
  55646. /*! exports provided: default */
  55647. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55648. "use strict";
  55649. __webpack_require__.r(__webpack_exports__);
  55650. /* 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&");
  55651. /* 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&");
  55652. /* 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");
  55653. /* normalize component */
  55654. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55655. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55656. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55657. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55658. false,
  55659. null,
  55660. null,
  55661. null
  55662. )
  55663. /* hot reload */
  55664. if (false) { var api; }
  55665. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  55666. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55667. /***/ }),
  55668. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  55669. /*!********************************************************************************!*\
  55670. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  55671. \********************************************************************************/
  55672. /*! exports provided: default */
  55673. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55674. "use strict";
  55675. __webpack_require__.r(__webpack_exports__);
  55676. /* 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&");
  55677. /* 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"]);
  55678. /***/ }),
  55679. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  55680. /*!**************************************************************************************!*\
  55681. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  55682. \**************************************************************************************/
  55683. /*! exports provided: render, staticRenderFns */
  55684. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55685. "use strict";
  55686. __webpack_require__.r(__webpack_exports__);
  55687. /* 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&");
  55688. /* 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"]; });
  55689. /* 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"]; });
  55690. /***/ }),
  55691. /***/ "./resources/js/components/woinfo.vue":
  55692. /*!********************************************!*\
  55693. !*** ./resources/js/components/woinfo.vue ***!
  55694. \********************************************/
  55695. /*! exports provided: default */
  55696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55697. "use strict";
  55698. __webpack_require__.r(__webpack_exports__);
  55699. /* 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&");
  55700. /* 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&");
  55701. /* 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");
  55702. /* normalize component */
  55703. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55704. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55705. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  55706. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55707. false,
  55708. null,
  55709. null,
  55710. null
  55711. )
  55712. /* hot reload */
  55713. if (false) { var api; }
  55714. component.options.__file = "resources/js/components/woinfo.vue"
  55715. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55716. /***/ }),
  55717. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  55718. /*!*********************************************************************!*\
  55719. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  55720. \*********************************************************************/
  55721. /*! exports provided: default */
  55722. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55723. "use strict";
  55724. __webpack_require__.r(__webpack_exports__);
  55725. /* 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&");
  55726. /* 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"]);
  55727. /***/ }),
  55728. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  55729. /*!***************************************************************************!*\
  55730. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  55731. \***************************************************************************/
  55732. /*! exports provided: render, staticRenderFns */
  55733. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55734. "use strict";
  55735. __webpack_require__.r(__webpack_exports__);
  55736. /* 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&");
  55737. /* 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"]; });
  55738. /* 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"]; });
  55739. /***/ }),
  55740. /***/ "./resources/js/mixins/dateMixin.js":
  55741. /*!******************************************!*\
  55742. !*** ./resources/js/mixins/dateMixin.js ***!
  55743. \******************************************/
  55744. /*! exports provided: default */
  55745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55746. "use strict";
  55747. __webpack_require__.r(__webpack_exports__);
  55748. /* harmony default export */ __webpack_exports__["default"] = ({
  55749. methods: {
  55750. treatAsUTC: function treatAsUTC(date) {
  55751. var result = new Date(date);
  55752. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  55753. return result;
  55754. },
  55755. daysSinceToday: function daysSinceToday(date) {
  55756. var currentDate = new Date();
  55757. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  55758. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  55759. },
  55760. getHRDate: function getHRDate(dateString) {
  55761. var date = new Date(dateString);
  55762. return date.toLocaleString('default', {
  55763. month: 'short',
  55764. day: 'numeric',
  55765. year: 'numeric',
  55766. hour: 'numeric',
  55767. minute: 'numeric'
  55768. });
  55769. },
  55770. isZero: function isZero(dateString) {
  55771. return dateString === '0000-00-00 00:00:00';
  55772. }
  55773. }
  55774. });
  55775. /***/ }),
  55776. /***/ "./resources/js/notify.min.js":
  55777. /*!************************************!*\
  55778. !*** ./resources/js/notify.min.js ***!
  55779. \************************************/
  55780. /*! no static exports found */
  55781. /***/ (function(module, exports, __webpack_require__) {
  55782. 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); }
  55783. (function (e) {
  55784. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  55785. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  55786. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  55787. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  55788. })(function (e) {
  55789. function A(t, n, i) {
  55790. typeof i == "string" && (i = {
  55791. className: i
  55792. }), 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);
  55793. }
  55794. var t = [].indexOf || function (e) {
  55795. for (var t = 0, n = this.length; t < n; t++) {
  55796. if (t in this && this[t] === e) return t;
  55797. }
  55798. return -1;
  55799. },
  55800. n = "notify",
  55801. r = n + "js",
  55802. i = n + "!blank",
  55803. s = {
  55804. t: "top",
  55805. m: "middle",
  55806. b: "bottom",
  55807. l: "left",
  55808. c: "center",
  55809. r: "right"
  55810. },
  55811. o = ["l", "c", "r"],
  55812. u = ["t", "m", "b"],
  55813. a = ["t", "b", "l", "r"],
  55814. f = {
  55815. t: "b",
  55816. m: null,
  55817. b: "t",
  55818. l: "r",
  55819. c: null,
  55820. r: "l"
  55821. },
  55822. l = function l(t) {
  55823. var n;
  55824. return n = [], e.each(t.split(/\W+/), function (e, t) {
  55825. var r;
  55826. r = t.toLowerCase().charAt(0);
  55827. if (s[r]) return n.push(r);
  55828. }), n;
  55829. },
  55830. c = {},
  55831. h = {
  55832. name: "core",
  55833. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  55834. 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}"
  55835. },
  55836. p = {
  55837. "border-radius": ["-webkit-", "-moz-"]
  55838. },
  55839. d = function d(e) {
  55840. return c[e];
  55841. },
  55842. v = function v(e) {
  55843. if (!e) throw "Missing Style name";
  55844. c[e] && delete c[e];
  55845. },
  55846. m = function m(t, i) {
  55847. if (!t) throw "Missing Style name";
  55848. if (!i) throw "Missing Style definition";
  55849. if (!i.html) throw "Missing Style HTML";
  55850. var s = c[t];
  55851. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  55852. var o = "";
  55853. i.classes && e.each(i.classes, function (t, n) {
  55854. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  55855. return p[t] && e.each(p[t], function (e, r) {
  55856. return o += " " + r + t + ": " + n + ";\n";
  55857. }), o += " " + t + ": " + n + ";\n";
  55858. }), o += "}\n";
  55859. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  55860. var u = {},
  55861. a = e(i.html);
  55862. y("html", a, u), y("text", a, u), i.fields = u;
  55863. },
  55864. g = function g(t) {
  55865. var n, r, i;
  55866. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  55867. try {
  55868. r.html(t);
  55869. } catch (s) {
  55870. r[0].styleSheet.cssText = t;
  55871. }
  55872. return r;
  55873. },
  55874. y = function y(t, n, r) {
  55875. var s;
  55876. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  55877. var n;
  55878. n = e(this).attr(s), n || (n = i), r[n] = t;
  55879. });
  55880. },
  55881. b = function b(e, t) {
  55882. return e.is(t) ? e : e.find(t);
  55883. },
  55884. w = {
  55885. clickToHide: !0,
  55886. autoHide: !0,
  55887. autoHideDelay: 5e3,
  55888. arrowShow: !0,
  55889. arrowSize: 5,
  55890. breakNewLines: !0,
  55891. elementPosition: "bottom",
  55892. globalPosition: "top right",
  55893. style: "bootstrap",
  55894. className: "error",
  55895. showAnimation: "slideDown",
  55896. showDuration: 400,
  55897. hideAnimation: "slideUp",
  55898. hideDuration: 200,
  55899. gap: 5
  55900. },
  55901. E = function E(t, n) {
  55902. var r;
  55903. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  55904. },
  55905. S = function S(t) {
  55906. return e.extend(w, t);
  55907. },
  55908. x = function x(t) {
  55909. return e("<" + t + "></" + t + ">");
  55910. },
  55911. T = {},
  55912. N = function N(t) {
  55913. var n;
  55914. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  55915. return e(r).attr("name") === t.attr("name");
  55916. }), t = n.first()), t;
  55917. },
  55918. C = function C(e, t, n) {
  55919. var r, i;
  55920. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  55921. if (isNaN(n)) return;
  55922. 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;
  55923. },
  55924. k = function k(e, t, n) {
  55925. if (e === "l" || e === "t") return 0;
  55926. if (e === "c" || e === "m") return n / 2 - t / 2;
  55927. if (e === "r" || e === "b") return n - t;
  55928. throw "Invalid alignment";
  55929. },
  55930. L = function L(e) {
  55931. return L.e = L.e || x("div"), L.e.text(e).html();
  55932. };
  55933. A.prototype.loadHTML = function () {
  55934. var t;
  55935. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  55936. }, A.prototype.show = function (e, t) {
  55937. var n, r, i, s, o;
  55938. r = function (n) {
  55939. return function () {
  55940. !e && !n.elem && n.destroy();
  55941. if (t) return t();
  55942. };
  55943. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  55944. 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 {
  55945. if (!!o || !!e) return r();
  55946. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  55947. }
  55948. return n.push(r), i[s].apply(i, n);
  55949. }, A.prototype.setGlobalPosition = function () {
  55950. var t = this.getPosition(),
  55951. n = t[0],
  55952. i = t[1],
  55953. o = s[n],
  55954. u = s[i],
  55955. a = n + "|" + i,
  55956. f = T[a];
  55957. if (!f || !document.body.contains(f[0])) {
  55958. f = T[a] = x("div");
  55959. var l = {};
  55960. 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);
  55961. }
  55962. return f.prepend(this.wrapper);
  55963. }, A.prototype.setElementPosition = function () {
  55964. 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;
  55965. 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"];
  55966. for (w = 0, S = B.length; w < S; w++) {
  55967. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  55968. }
  55969. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  55970. if (!this.options.arrowShow) this.arrow.hide();else {
  55971. 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";
  55972. for (E = 0, x = a.length; E < x; E++) {
  55973. D = a[E], P = s[D];
  55974. if (D === L) continue;
  55975. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  55976. }
  55977. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  55978. }
  55979. 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);
  55980. if (r) return this.arrow.removeAttr("style").css(r);
  55981. }, A.prototype.getPosition = function () {
  55982. var e, n, r, i, s, f, c, h;
  55983. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  55984. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  55985. 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";
  55986. return e.length === 2 && (e[2] = e[1]), e;
  55987. }, A.prototype.getStyle = function (e) {
  55988. var t;
  55989. e || (e = this.options.style), e || (e = "default"), t = c[e];
  55990. if (!t) throw "Missing style: " + e;
  55991. return t;
  55992. }, A.prototype.updateClasses = function () {
  55993. var t, n;
  55994. 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) {
  55995. return r + "-" + n.name + "-" + e;
  55996. }).join(" "), this.userContainer.attr("class", t);
  55997. }, A.prototype.run = function (t, n) {
  55998. var r, s, o, u, a;
  55999. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56000. if (this.container && !t) {
  56001. this.show(!1);
  56002. return;
  56003. }
  56004. if (!this.container && !t) return;
  56005. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56006. for (o in s) {
  56007. r = s[o], u = this.userFields[o];
  56008. if (!u) continue;
  56009. 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);
  56010. }
  56011. 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));
  56012. }, A.prototype.destroy = function () {
  56013. this.wrapper.data(r, null), this.wrapper.remove();
  56014. }, e[n] = function (t, r, i) {
  56015. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56016. }, e.fn[n] = function (t, n) {
  56017. return e(this).each(function () {
  56018. var i = N(e(this)).data(r);
  56019. i && i.destroy();
  56020. var s = new A(e(this), t, n);
  56021. }), this;
  56022. }, e.extend(e[n], {
  56023. defaults: S,
  56024. addStyle: m,
  56025. removeStyle: v,
  56026. pluginOptions: w,
  56027. getStyle: d,
  56028. insertCSS: g
  56029. }), m("bootstrap", {
  56030. html: "<div>\n<span data-notify-text></span>\n</div>",
  56031. classes: {
  56032. base: {
  56033. "font-weight": "bold",
  56034. padding: "8px 15px 8px 14px",
  56035. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56036. "background-color": "#fcf8e3",
  56037. border: "1px solid #fbeed5",
  56038. "border-radius": "4px",
  56039. "white-space": "nowrap",
  56040. "padding-left": "25px",
  56041. "background-repeat": "no-repeat",
  56042. "background-position": "3px 7px"
  56043. },
  56044. error: {
  56045. color: "#B94A48",
  56046. "background-color": "#F2DEDE",
  56047. "border-color": "#EED3D7",
  56048. "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=)"
  56049. },
  56050. success: {
  56051. color: "#468847",
  56052. "background-color": "#DFF0D8",
  56053. "border-color": "#D6E9C6",
  56054. "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==)"
  56055. },
  56056. info: {
  56057. color: "#3A87AD",
  56058. "background-color": "#D9EDF7",
  56059. "border-color": "#BCE8F1",
  56060. "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=)"
  56061. },
  56062. warn: {
  56063. color: "#C09853",
  56064. "background-color": "#FCF8E3",
  56065. "border-color": "#FBEED5",
  56066. "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)"
  56067. }
  56068. }
  56069. }), e(function () {
  56070. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56071. e(this).trigger("notify-hide");
  56072. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56073. var n = e(this).data(r);
  56074. n && n.show(!1);
  56075. });
  56076. });
  56077. });
  56078. /***/ }),
  56079. /***/ "./resources/sass/app.scss":
  56080. /*!*********************************!*\
  56081. !*** ./resources/sass/app.scss ***!
  56082. \*********************************/
  56083. /*! no static exports found */
  56084. /***/ (function(module, exports) {
  56085. // removed by extract-text-webpack-plugin
  56086. /***/ }),
  56087. /***/ 0:
  56088. /*!*************************************************************!*\
  56089. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56090. \*************************************************************/
  56091. /*! no static exports found */
  56092. /***/ (function(module, exports, __webpack_require__) {
  56093. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56094. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56095. /***/ })
  56096. /******/ });